Page Cache Hit Rate
When using a page cache in your application, that caches the whole HTML or API response to serve back to clients, an important metric for the health of the cache is the hit rate.
It specifies how often a request has a corresponding response cached, "hitting" thee cache. When no response is found in the cache, a "miss" is recorded. The page cache hit rate is then the number of hits compared to the total number of requests that are either hits or misses.
When the hit rate is low this means a lot of information is stored in the cache, but is not often needed again, leading to a cache hit. This can be inefficient because the data storage for the cache is used to cache potentially thousands of pages that are rarely used again.
When does Tideways warn about an inefficient page cache?
-
At a hit rate below 70% a warning is issued, the cache is not inefficient but about every third or second request needs to calculate a response and is not served from cache.
-
At below 50% an error is issueed for the page cache inefficiency. A lot of space is wasted and response calculation happens at least every second request or more often.