Commandbus slow


We are using axon (3.2) SimpleCommandbus with springboot and mongodb as event store. Sadly it’s terribly slow. When about 20 commands come in it takes up to 10 seconds before the last command is done (all on the same aggregate). While doing nothing else

I would like to get some pointers at where to look to make this better.

Things i already did:

  • Removing all logic and blocking operations in commandhandlers
  • Checking mongodb indexes (these are default: id, aggregateidentifier,ordereventstreamIndex)
  • Using AsyncCommandbus (didn’t really make a difference)

Thanks in advance

Hello Yannick,

My guess is the slowness occurs because the application is using the Subscribing Event Processor instead of the Tracking Event Processor.
I am taking this option as (1) you do not state any changes in that area and (2) the Subscribing Event Processor is the default in Axon 3.x.

What this essentially means is that the exact same thread which publishes your command, is the thread loading your Aggregate from the Repository.
But, this thread is also in charge of calling your Command Handling operation, which makes it the thread in charge of storing your Event.
And after that even, it’s also the thread being used to call all Subscribing Event Processor to say “hey, here’s a new event!”.
Lastly, that makes it the exact same thread updating all your Query Models.

Simply put, I would have a look at the configuration of the query side of your application.
Tracking Event Processors are by design different threads.
This will thus decouple your application more, essentially embracing an asynchronize set up.

Lastly, note that Axon 3.2 is already quite an old release of Axon Framework.
I would recommend to upgrade to the latest version, being Axon 4.2, to benefit from all the new features (and performance improvements) which we are introducing.

Hope this helps you out Yannick!
If any further guidance in improving application performance in combination with Axon is needed, you can always start contacting AxonIQ directly for support.


Steven van Beelen

Axon Framework Lead Developer

Axon in Action Award 2019 - Nominate your project


Updating to 4.2 made a significant increase of perfomance. The tracking event processor is a lot faster.

Thx for the help