Percona Server for MongoDB 8.0 has been available for over a month now. We covered the most important new MongoDB features in a previous blog post.
Earlier versions of MongoDB have a history of becoming slower with every major release, which is common with most databases. As more features are added, the code paths get longer, complexity increases, extra locking is added, and the chances of race conditions and other concurrency issues increase.
MongoDB 8.0 comes with some architectural optimizations that promise big performance benefits. The official presentation showed some impressive numbers using the YCSB benchmark. Here, we will see how mongo-perf fares instead, so let’s go ahead and run some tests.
Testing process
We deployed separate client and server machines on GCP with the following specs:
Client: n2-standard-2 (2 vCPU, 8 GB RAM)
Server: n2-standard-8 (8 vCPU, 32 GB RASM, 4 TB general purpose SSD)
The idea here is to compare the latest two major MongoDB versions against each other: Percona Server for MongoDB 8.0.4 vs. 7.0.15. As usual, Percona Monitoring & Management was used to keep an eye on the resource utilization and MongoDB metrics over time.
We ran the tests multiple times for each server and calculated the average of the results. We measured scenarios of 1/4/8 threads to see the behavior as contention and resource utilization grow.
The following test scenarios were executed:
- “simple_insert”
- “simple_multi_update”
- “simple_query”
- “simple_remove”
- “simple_text”
- “simple_update”
- “simple_update_mms”
- “simple_geo”
If you are curious about the details of each, you can check the mongo-perf testcases code.
Results
I’ve highlighted in green when there is more than a 5% difference in favor of MongoDB 8. Red is used when MongoDB 7.0 is more than 5% faster for the specific test. Here are the raw numbers (you might want to open each image on a new browser page for readability):
One thread:
On average, MongoDB 8 is 12% faster for a single thread. In some tests, the difference is as high as 20-30% in favor of MongoDB 8. These are very impressive numbers and align with the promised performance gains.
Four threads:
On average, MongoDB 8 is 7% faster for four threads. A few tests show slower performance on MongoDB 8; however, those tests perform a very small number of ops/s, so they are not representative examples.
Eight threads:
The difference here becomes smaller, with MongoDB 8 having an average edge of 9%. Also, it is important to highlight that no performance regressions were seen for any of the tests.
Conclusion
MongoDB 8.0 was 12% faster than MongoDB 7 on average for the single-thread scenario. The difference is about 7% on average when using four concurrent threads. Other factors come into play when using more threads, but the difference is still about 9%.
A small number of the tests show slower performance on MongoDB 8, however those tests performed a very small number of ops/s so they are not a very representative example. For most of the tests, MongoDB 8.0 was faster than MongoDB 7.0, with the difference being as high as 20-30% in some cases.
Ultimately, it appears MongoDB 8 lives up to the hype regarding performance gains. To get help with safely upgrading your MongoDB to the next version, feel free to contact Percona Experts.
Rising database costs, restrictive licensing agreements, and performance challenges are common pain points for organizations using MongoDB. Enter Percona for MongoDB: The Enterprise-Grade MongoDB Alternative.
It’s time to run MongoDB your way