Data-driven MongoDB performance tuning
An open-source, document-oriented NoSQL database, MongoDB is chosen by many organizations because of its flexible schema design, comprehensive querying framework, and horizontal scalability. Suitable for big data storage and developing ecommerce and blogging platforms as well as location-based apps, MongoDB is now one of the most popular database management systems.
A simple MongoDB performance tuning can speed your application significantly. Before tuning, however, you need actionable data about your database's current performance.
A MongoDB database performance checklist before tuning could look like this:
- Verify your hosts’ health by looking at server data
- Ensure that your virtualization works fine by analyzing virtual machine metrics
- Optimize database access with application data
- Analyze the network impact of database communication with network data
Server data tells about your hosts’ health
By checking CPU, memory, and disk space metrics you make sure your MongoDB processes have sufficient resources available.
CPU - MongoDB will deliver better performance on faster CPUs. When monitoring virtual machines, also monitor the virtual host that the machines run on. Numbers like CPU ready time are of particular importance.
Page faults per seconds - Having thousands of page faults per second indicates that your hosts are out of memory.
Disk space - NoSQL databases eat up a lot more disk space than you would expect. MongoDB takes up less RAM than a common SQL database, but it’s a real disk space hog. For an optimal MongoDB performance make sure you have lots of disk space available on your hard drive.
Know which commands affect database performance
Knowing which services access your MongoDB is vital for finding database performance bottlenecks. If there is a single service that’s suffering from bad database response times, dig deeper into that service’s metrics to find out what’s causing the problem.
Take a deeper look into the service’s communication with the database and find out which commands affect the database performance the most.
Verify your app’s database connection
Even if the way you query your database is perfectly fine, you may still experience inferior database performance. Make sure if your application’s database connection is correctly sized.
Keep an eye on network metrics
If a database performance issue suddenly appears, process level visibility comes in handy in identifying a failing component.
Tuning your MongoDB performance with Dynatrace
Dynatrace is a unified monitoring solution that gives you a complete view of database performance from the application perspective. Our patented PurePath Technology captures timing and code-level context for all transactions hitting your database while our PureStack Technology shows you how your infrastructure affects those transactions and your application's user experience.
Dynatrace monitors and analyzes the activity of your MongoDB databases across all platforms, providing visibility down to individual database statements.
- Auto-detect your MongoDB databases
- Visualize how apps use your database
- See detailed metrics for every single database statement
- Directly relate MongoDB performance metrics to queries