I couldn’t find any benchmark measuring MongoDB newer versions against each other. I’ve decided to make my own.

We are going to do very very basic insertions, reads, and deletes. Regular defaults are kept for both the server and the Ruby client. Apart disabling logging on the client. Run on Ubuntu 18.04 DigitalOcean droplet with 2 CPUs and 4GB of Ram.

Overall results:

It’s a little disappointing. Performance seems to have degraded since the release of 3.6 (in yellow above). MongoDB 3.2 and 3.4 seem to be in the same ballpark of performance whereas MongoDB 3.6, 4.0, and 4.2 seem to have introduced changes that led to a degradation of performance. We are seeing this for inserts, reads, and deletes. For example, inserts in 3.4 were around 53% faster than in 3.6.

It will be very interesting to know how come it wasn’t possible to be back to this level of performance in more recent versions of MongoDB. Maybe some features or regressions will be worth checking into.

Full Ruby script to run the benchmark:

Raw results: