Hello, everyone! We are using Axon 2.4.5 in production and are also using the DisruptorCommandBus to act as the local segment. Noticed that the CommandHandlerInvoker$DisruptorRepository makes use of a WeakHashMap as the first level cache. We run all our JVM instances with 2GB of heap. We have a process that creates a large number of aggregates (approximately 3 million) as part of an import job.
Specifically, the load method in the DisruptorRepository piqued our interest: https://github.com/AxonFramework/AxonFramework/blob/axon-2.4.x/core/src/main/java/org/axonframework/commandhandling/disruptor/CommandHandlerInvoker.java#L184-L221
It appears we do a linear search on the first level cache to locate the cached aggregate. When there is no memory pressure, this linear search can take quite a while (in relative terms). This slows things down considerably. We noticed that the DisruptorRepository’s firstLevelCache is not very easily accessible. Changing behavior there, for e.g. disabling the first level cache requires overriding framework which we’re reluctant to do. It appears this part hasn’t changed much in the 3.0 release as well.
Can you please advise?