You will need to restart mongod and mongos servers for new system-wide keepalive settings to take effect. 

## 11.9.3 What tools are available for monitoring MongoDB? 

The MongoDB Cloud Manager 31 and Ops Manager, an on-premise solution available in MongoDB Enterprise Ad- vanced 32 include monitoring functionality, which collects data from running MongoDB deployments and provides visualization and alerts based on that data. 

For more information, see also the MongoDB Cloud Manager documentation 33 and Ops Manager documentation$^{34}$. 

A full list of third-party tools is available as part of the Monitoring for MongoDB (page 187) documentation. 

## 11.9.4 Memory Diagnostics for the MMAPv1 Storage Engine 

## Do I need to configure swap space? 

Always configure systems to have swap space. Without swap, your system may not be reliant in some situations with extreme memory constraints, memory leaks, or multiple programs using the same memory. Think of the swap space as something like a steam release valve that allows the system to release extra pressure without affecting the overall functioning of the system. 

Nevertheless, systems running MongoDB do not need swap for routine operation. Database files are memory-mapped (page 773) and should constitute most of your MongoDB memory use. Therefore, it is unlikely that mongod will ever use any swap space in normal operation. The operating system will release memory from the memory mapped files without needing swap and MongoDB can write data to the data files without needing the swap system. 

## What is a “working set”? 

The working set is the portion of your data that clients access most often. 

## Must my working set size fit RAM? 

Your working set should stay in memory to achieve good performance. Otherwise many random disk IO’s will occur, and unless you are using SSD, this can be quite slow. 

One area to watch specifically in managing the size of your working set is index access patterns. If you are inserting into indexes at random locations (as would happen with id’s that are randomly generated by hashes), you will contin- ually be updating the whole index. If instead you are able to create your id’s in approximately ascending order (for example, day concatenated with a random id), all the updates will occur at the right side of the b-tree and the working set size for index pages will be much smaller. 

It is fine if databases and thus virtual size are much larger than RAM. 

## How do I calculate how much RAM I need for my application? 

The amount of RAM you need depends on several factors, including but not limited to: 

• The relationship between database storage (page 772) and working set. 

