MongoDB Deployment - MongoDB

How to prepare MongoDB Deployment?

While preparing MongoDB deployment, user should try to understand how the application will hold up in production. It is good to develop a reliable and repeatable approach for managing the deployment environment to minimize any surprises when you are in production.

Best approach incorporates prototyping the set up, conducting load testing, monitoring key metrics, and using that information to scale the set up. Main part of the approach is proactively monitoring the entire system - this will help in understanding how the production system holds up before deploying, and determines where to add capacity. Having insight into possible spikes in the memory usage will help in putting out a write-lock fire before it starts.

To monitor your deployment, MongoDB provides some of the below commands

mongostat

This command will check the status of all running mongod instances and will return counters of database operations. These counters include inserts, queries, updates, deletes, and cursors. Command will also show when you’re hitting page faults and displays your lock percentage. This means that you're running low on memory, hitting write capacity or have some performance issue.

To run the command, start the mongod instance and in another command prompt, go to bin directory of your mongodb installation and type mongostat.

Below is the output of the command

mongostat

mongotop

This command will track and reports the read and write activity of MongoDB instance on a collection basis. By default, mongotop will return information every second and it can be changed accordingly. User should check that this read and write activity is matching their application intention and the user is not firing too many writes to the database at a time, reading too frequently from a disk, or are exceeding the working set size.

To run the command, start your mongod instance and in another command prompt, go to bin directory of your mongodb installation and type mongotop.

Below is the output of the command

mongotop

To change mongotop command and to return information less frequently, specify a specific number after the mongotop command.

Above example returns values every 30 seconds.

Apart from MongoDB tools, 10gen provides a free, hosted monitoring service, MongoDB Management Service (MMS) which provides a dashboard and gives you a view of the metrics from the entire cluster.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

MongoDB Topics