Peek into WiredTiger Cache
Ideally, if all data, including indexes, can fit into the WiredTiger cache, accessing documents would be more efficient than having to access disk files frequently. In reality, memory resources are shared to support other tasks such as file system cache, user connections, and database operations, for example, sorting. At startup, if the WiredTiger cache size is not defined, the maximum memory allocated to the WiredTiger cache size is about a little less than 50% of the RAM.
When experiencing performance degradation, users always intend to tune the WiredTiger cache size. It is recommended to use the default value unless you have a small working set that can possibly fit into WiredTiger cache or the compressed data size can fit into file system cache. In most production environments I have seen, the amount of data is much greater than RAM can contain and often allocating most memory resources to a component does not improve performance.
Realizing altering WiredTiger cache size does not improve performance, the next question raised is a witch hunt on what data is flooding the WiredTiger cache. Keyhole provides a way to view data and indexes in the WiredTiger cache. First, connect Keyhole to a mongod server, for example:
Open http://hostname:5408/wt in a browser and four charts showing data inside the WiredTiger cache are displayed as below. The animation refreshes every 5 seconds.