As far as I could check, MongoDB doesn’t have a page (or bytes) hit metric. So, how can I calculate it? I am trying to get the page (bytes) hit to get to the hit ratio.
I saw in another post the suggestion to use the following metrics from the wiredTiger.cache section. But what logic should be applied to them to get the page (bytes) hit and, therefore, the hit ratio?
In the db.serverStatus().wiredTiger.cache command you will see some metrics. To perform the calculation we use the pages read in the cache (Pages Read Into Cache) and the total number of requests to the cache (Total Pager Requests).
The calculation is done as:
Cache hit rate = (1 - (Pages read from cache / Total requests)) * 100%
E.g
pages read into cache: 30
pages requested from the cache: 218
Cache hit rate = (1 - (30 / 218)) * 100% Cache hit rate = 86.24%