Cache Hit vs Cache Miss
What you'll learn: You'll understand the difference between a cache hit and a cache miss, and why this distinction is crucial for CDN performance.
The Core Concept
When a user requests content through a CDN, the edge server checks its cache to see if it already has that content stored. This check results in one of two outcomes:
- Cache Hit: The edge server has the requested content in its cache and can serve it immediately to the user without contacting the origin server.
- Cache Miss: The edge server does not have the content in its cache, so it must fetch it from the origin server first, then deliver it to the user (and typically store it for future requests).
Why This Matters
Cache hits are what make CDNs valuable. When you get a cache hit:
- Response time is significantly faster (milliseconds instead of potentially hundreds of milliseconds)
- No load is placed on your origin server
- Lower bandwidth costs for data transfer from origin
Cache misses, on the other hand:
- Require a full round-trip to the origin server
- Take longer to complete
- Generate origin server load and bandwidth costs
The Library Analogy
Think of a CDN edge server like a neighborhood library branch. If the book you want is on the shelf (cache hit), you get it instantly. If it's not there (cache miss), the librarian must request it from the main library downtown, wait for delivery, then give it to you—much slower, but now that branch has it for the next person.
Measuring Success
CDN effectiveness is often measured by the cache hit ratio: the percentage of requests served from cache. A 90% cache hit ratio means only 10% of requests burden your origin server.
Key Takeaway: Cache hits deliver content instantly from edge servers while cache misses require fetching from origin—maximizing cache hits is essential for CDN performance and cost efficiency.