MongoDB inefficincies

Hi, in the axonframework docs (https://docs.axonframework.org/part-iii-infrastructure-components/repository-and-event-store#mongodb-event-storage-engine) i have seen a note in the MongoDb documentation, concretely this one:

“In pre Axon Framework 3 release we found MongoDb to be a very good fit as an Event Store. However with the introduction of Tracking Event Processors and how they track their events, we have encountered some inefficiencies in regards to the Mongo Event Store implementation. We thus typically recommend using a RDBMS based Event Store (the JPA or JDBC implementations for example), and would only suggest to use Mongo for this use case if you have found its performance to be beneficial for your application.”

Can somebody explain me what are this “inefficiencies”? thanks!!

Best Regards.

Hi Jorge,

The main inefficiency is that MongoDB doesn’t have an (efficient) way to put documents in a specific order, similar to auto-increment columns that SQL databases have. That makes it less efficient to use Tracking Processors with MongoDB.
We have just seen too many situations like “Mongo is cool and Axon supports it, so let’s just use it”, without realizing what the consequences could be. SQL database, although not always the fastest, have shown to be more reliable as event stores in the long run.
But obviously we would recommend using AxonDB instead…

Hope this helps.

Cheers,

Allard

Hi Allard,

thanks for your huge support here. Can you please be a little bit more specific regarding the problems with mongo? Unfortunately the AxonDB is not yet an option, so we have to decide between mongo and Postgres for golive.

When you talk about “more reliable” SQL databases, what exactly do you mean?
I know there are some downsides like “multiple events” per documents, no push, … - but are there any sever problems in the axon/mongo (HA) combination which would lead to a crash/downtime or big performance issue?
I alway thought a RDBM’s would have big troubles with 10k-100k events per day.

Thanks a lot!

Hi,

the tracking processors tracking documents in Mongo perform somewhat heavier queries and produce larger tokens than the ones using SQL databases, to accomodate for the lack of “general order” between Mongo Documents. That may or may not be a problem for your setup.
The reports that we have received were more about managing mongo instances, which may be challenging when dealing with essential data, such as events. I don’t have enough experience with managing Mongo myself, but I did want to relay the concerns.

Why is AxonDB not (yet) an option?

Cheers,

Allard

Hi Allard,

thanks for you update - We are 2 weeks before golive and it’s to close for changes now. But I will give AxonDB a try as soon as we calm down after.

Regards.