Hosting of Axon application


I am Thinking about writeing an application with axon, I wanted to clarify some thoughts, just to be on the save side:

  • Has the Domain Model to fit in the Memory as a whole? At least of the current used aggregate?I assume it’s getting really slow, if the events need to be replayed on every request.
  • How to deal with multy tenancy? Should I use an dedicated eventstore for every tenant’s dataset? Amount of data is not the issue. I need to have every dataset to be archiveable (stored to AWS glacier, or simmilar) and restoreable later on.
  • Is there any rule for rough estimate how much e.g. AWS EC2 instances I will need for a certain load? I know, this can be only really rough…

Thanks for input!


Hello Andreas,

a single Aggregate will have to fit in memory. In very special circumstances, you can leave data “on disk” and access it using a repository from within your aggregate. Axon allows you to inject “resources” (such as Spring beans) by adding them as a parameter to your @CommandHandler method. However, this is really very rarely necessary.
EventSourcing isn’t that much slower than ORM. You can optimize by using Snapshotting, and/or a cache.

Multi tenancy is dealt with exactly the same way as you would with other architectural styles. However, you should add the “tenantID” (or whatever identifier you use) to each command and event, so you can track the responsible tenant throughout the message flow. You can simply add it as a meta data entry.
In the Event Store, you can choose to ignore the tenant, but check the “owner” of an aggregate from your repository. If someone sent a command to an aggregate that doesn’t belong tothe correct tenant, it will fail.

In terms of EC2 instances, it’s very similar to what you would need with another architectural style. Maybe even less. This depends so much on so many details, that there is nothing sensible I can say about this.



Hi Allard,

thanks for the answer!