cache-hit-ratio.gif

Cache hit ratio is the number of requests delivered by the cache server, divided by the total number of requests.

Overview

Web caching provides significant benefits when the requested assets are served from a nearby server. The cache hit ratio depends on the effectiveness of the caching system and is influenced by factors such as the cache policy, the number of cacheable objects, the size of the cache memory, and the expiry time of the object.


An efficient cache policy maximizes the number of cache hits while minimizing the number of cache misses, leading to a higher cache hit ratio, lower latency, and better resource utilization. A cache hit ratio of 90% and higher means that most of the requests are satisfied by the cache. A value below 80% on static files indicates inefficient caching due to poor configuration. 

How to Measure Cache Hit Ratio

Most cache servers have inbuilt tools that monitor metrics such as cache hits, cache misses, and cache hit ratio. For instance, in the StackPath control panel you can easily see how your CDN cache is performing in terms of cache hits and misses. We also provide the cache hit ratio by making the following calculations:

  1. Determine the number of cache hits and misses over a given period of time
  2. Divide the cache hits by the combined number of hits and misses
  3. Multiply that number by 100

Cache hit ratio =  [Cache Hits / (Cache Hits + Cache Misses)] x 100 %

Example of Cache Hit Ratio 

Facebook users upload and view over 350 million photos per day. These photos are usually stored on Haystack machines that are optimized for photo storage. To deliver these photos, Facebook uses several photo-serving stacks with many layers of caches. In a study to determine the effectiveness of these caches, Facebook was able to  determine that:

  1. Cache hit ratio is higher with the most popular photos.
  2. Cache ratio improves with larger caches. (Doubling the size of the edge cache increased the ratio from 59% to 65%. Tripling the size increased the ratio to 65%.)
  3. Advanced caching algorithms led to a higher cache hit ratio but at different rates. The rate increased slightly when using FIFO, LFU, and LRU, while the S4LRU algorithm (intermediate between LRU and LFU algorithms) gave the best results. S4LRU increased the ratio to up to 67.7 % and was expected to reach about 72% when the size of the edge cache was doubled.

Conclusion

A high cache hit ratio greatly improves the browsing experience while reducing costs in terms of energy, bandwidth, and computation power. Therefore it’s important to monitor the effectiveness of the caching system, then make adjustments to achieve a higher cache ratio.

Start 15-day Trial

Every Secure Content Delivery Plan includes WAF and DDoS mitigation.

Choose plan