CDN Cache Hit Ratio and Cache Miss Ratio Explained

Video streaming has become a ubiquitous part of modern life, and Content Delivery Networks (CDNs) have become an essential tool for delivering high-quality video content to a global audience. The effectiveness of a CDN can be measured by two critical metrics – CDN Cache Hit Ratio and Cache Miss Ratio. These two metrics inform us of the CDN’s ability to cache frequently accessed content and reduce the number of slow main memory accesses.

This technical article will explore the CDN cache hit ratio and cache miss ratio metrics and how they relate to video streaming. We will discuss the following –

  • How these ratios are calculated.
  • How they can be used to optimize the CDN configuration to improve video streaming performance.
  • Discuss the factors affecting the CDN cache hit ratio and cache miss ratios, such as the origin server’s location, the CDN cache’s size, and the video content’s popularity.

Note: If you are new to CDN, please read this article to understand cache hits, cache misses, and TTL (Time To Live) metrics.

Let’s get started with the Cache Hit Ratio metric.

Cache Hit Ratio

A cache hit ratio measures how effectively a cache is being used. To clarify, a cache is a small amount of fast memory that stores frequently accessed data to speed up access times.

What is a Cache Hit? Quoting from this article,

CDN (Content Delivery Network) cache hit occurs when the CDN can successfully serve a requested asset from its cache rather than retrieving it from the origin server. To put it another way, the request “hit” the CDN’s cache successfully and did not need to be served from the origin.

The cache hit ratio is the percentage of data requests satisfied by the cache, as opposed to being satisfied by the main memory or video origin server.

  • It is calculated by dividing the number of cache hits by the total number of memory accesses.
  • For example, if there are 100 memory accesses and 80 cache hits, the cache hit ratio is 80%.

What Does a High Cache Hit Ratio Imply?

  • A high cache hit ratio indicates that the CDN effectively stores frequently accessed video content or data and reduces the number of requests to the main origin server.
  • A low cache hit ratio means that the CDN cache is not being used effectively, and more requests are being sent to the origin server. That is, there are a lot of cache misses. Therefore, monitoring the cache hit ratio is essential to ensure the CDN is used efficiently.
CDN Cache Hit Ratio and Cache Miss Ratio
Well-tuned Cache-Control Algorithms are critical for High Cache Hit Ratios

Cache Miss Ratio

A cache miss ratio complements the cache hit ratio we just learned about. The cache miss ratio measures the percentage of memory accesses not satisfied by the cache and instead requires accessing slower main memory or origin servers.

  • The cache miss ratio is calculated by dividing the number of cache misses by the total number of memory accesses or requests.
  • For example, if there are 100 memory accesses and 20 cache misses, the cache miss ratio is 20%.

What Does a High Cache Miss Ratio Imply?

A high cache miss ratio implies that the CDN cache is not effectively storing frequently accessed video segments or data. As a result, many memory accesses are not satisfied by the cache.

A high cache miss ratio can be caused by several factors, such as

  • A cache that is too small for the data being accessed,
  • A cache that is not being managed effectively,
  • Or poor cache control and purging mechanisms.

Therefore, a low cache miss ratio is desirable, as it indicates that the cache effectively stores frequently accessed data and reduces the number of slower main memory accesses. A cache miss ratio close to zero is ideal.

Related:  CDN Request Collapsing and the Thundering Herds Problem Simplified

How to increase Cache Hit Ratio and reduce Cache Miss Ratio?

A well-tuned CDN configuration is essential for high-quality, seamless video delivery. We’ve discussed the power of a great CDN network in our “9 Top Reasons to use a CDN” article, and now, let’s look at some ideas to improve your CDN’s performance.

Check the TTL value in your CDN configuration:

TTL, or Time-To-Live, is a CDN setting that determines how long a piece of data stays on the CDN cache. If you set a TTL value of 24 hours, that data can be evicted after 24 hours, and a fresh copy will be fetched from the origin server.

If the TTL is too small, cached data gets frequently evicted from the cache, and the following requests will require a long trip to the origin server because of the high cache miss ratios.

On the other hand, if the TTL is too high, stale data will stay on the CDN longer, and the cache will get filled up. This might cause “out of memory” problems, leading to Cache Misses and an increase in the Cache Miss Ratio.

Cache your static content with a longer TTL

Some parts of your video delivery service, like poster art, CSS, images, etc., rarely change and can be cached for a long time on your CDN.

Optimize your video encoding and packaging

Video encoding and packaging can affect the CDN cache hit ratio and impact the quality of experience for your users. Let’s see how!

Let’s assume that you have too many bitrates in your bitrate ladder, and use multiple variations of HLS and MPEG-DASH (segment size, DRM, etc.). This will result in various combinations of streaming protocol, bitrate, and DRM for every video segment. And if you have multiple variations with different segment durations, then the problem is even worse.

In this situation, the CDN might have to cache multiple versions of every video segment, which is not a good use of constrained memory/cache.

However, suppose you can optimize the encoding & packaging to reduce the number of variations in the video content or use only HLS streaming with only one segment duration. In that case, the CDN can cache only a couple of variations of each segment, and this will improve the cache hit ratio.

Multi-CDN strategy

Using a multi-CDN strategy can distribute the load and reduce the number of cache misses. This can be achieved by using multiple CDNs and dynamically routing traffic to the CDN with the lowest latency and highest cache hit ratio. We’ve explained in this article how a multi-CDN configuration works and common multi-CDN architectures.

These are some methods for improving your cache hit ratios. Do you have any other ideas that we can add to this list?

Conclusion

In conclusion, I hope you have a better idea of cache hit and miss ratios, which will help you better tune your CDN and video streaming service. If you are interested in CDNs, read these articles to learn more about their applications.

  1. How does a CDN work?
  2. What is the Thundering Herd Problem in CDNs? What is Request Collapsing?
  3. How does a Multi-CDN work?
  4. What is the advantage of using a CDN for Live Streaming?
  5. What are Cache Hit, Cache Miss, and TTL (Time-To-Live) in CDNs?
  6. 9 Powerful Reasons To Use a CDN for Video Streaming (Live and VOD)

krishna rao vijayanagar
Krishna Rao Vijayanagar

Krishna Rao Vijayanagar, Ph.D., is the Editor-in-Chief of OTTVerse, a news portal covering tech and business news in the OTT industry.

With extensive experience in video encoding, streaming, analytics, monetization, end-to-end streaming, and more, Krishna has held multiple leadership roles in R&D, Engineering, and Product at companies such as Harmonic Inc., MediaMelon, and Airtel Digital. Krishna has published numerous articles and research papers and speaks at industry events to share his insights and perspectives on the fundamentals and the future of OTT streaming.

Leave a Comment

Your email address will not be published. Required fields are marked *

Enjoying this article? Subscribe to OTTVerse and receive exclusive news and information from the OTT Industry.