Before you deploy, it is important to set up some type of monitoring. Monitoring should allow you to track what your server is doing and alert you if something goes wrong. This chapter will cover:
How to track MongoDB’s memory usage
How to track application performance metrics
How to diagnose replication issues
Examples use chapters from the Mongo Monitoring Service (MMS) to demonstrate what to look for when monitoring. There are installation instructions for MMS at https://mms.10gen.com. If you do not want to use MMS, please use some type of monitoring. It will help you detect potential issues before they cause problems and let you diagnose issues when they occur.
Accessing data in memory is fast and accessing data on disk is slow. Unfortunately, memory is expensive (and disk is cheap) and typically MongoDB uses up memory before any other resource. This section covers how to monitor MongoDB’s interactions with disk and memory, and what to watch for.
Computers tend to have a small amount of fast-to-access memory and a large amount of slow-to-access disk. When you request a page of data that is stored on disk (and not yet in memory), your system page faults and copies the page from disk into memory. It can then access the page in memory extremely quickly. If your program stops regularly using the page and your memory fills up with other pages, the old page will be evicted from memory and only live on disk ...