Slow replay

Hello,

At the moment I have 1 149 486 events in domain_event_entry table.
When I replay a token event listener, it takes 12 hours to process all events.

  1. Is there a way to boost performance? (besides the implementation of the listener itself)
  2. I’m using JPAEventStorageEngine on MySQL now. Can a JDBCEventStorageEngine help?

Kind regards,
Koen

Hi Koen,

have you checked how much of that time is being spent in the query/Axon components, and how much time in the event handlers?

At the moment, Axon 3.0 is limited to only a single thread in the TrackingEventProcessors. In Axon 3.1, we have added support for multi-threading. That should bring the processing time down significantly. But even with (for example) 4 threads, it will take at least 3 hours. That seems like a very long time. The queries invoked for Tracking are based on the primary key, and should not really take very long. Serialization takes up some time, but should only be performed for events that are actually being used. Potentially, there is a lot to win by either more selectively replaying (by splitting handlers into separate Processors) or by optimizing the event handlers.

Cheers,

Allard

Hi Koen,

We had a similar issues at our project. Root cause turned out to be the default batch size of 100 for the stream reader.
This causes a lot of roundtrips to the database. Increasing that to 50K or 100K (depending on your memory consuption etc.) made it a whole lot faster!

In the definition of the JpaEventStorageEngine you can specify the batchsize like:

return new JpaEventStorageEngine(serializer, null, null, batchSize, entityManagerProvider, transactionManager, null, null, true);

We’ve made it configurable so in normal operations the size is a bit lower.