What Is A Cache Miss ?

Join whatsapp group Join Now
Join Telegram group Join Now
what is a cache miss
What Is A Cache Miss ?

What Is A Cache Miss ? – A cache miss occurs when the system looks for data in a cache (fast temporary storage) but cannot find it. The system must then fetch the data from a slower main memory or storage, which increases access time and reduces performance.

How a Cache Miss Works

Caches store copies of frequently used data closer to the processor or application for quick access.

When a request happens:

  1. The system checks the cache first (cache lookup).
  2. If the data is present → Cache hit (fast).
  3. If the data is absent → Cache miss. The system fetches it from slower memory (RAM, disk, or database), copies it into the cache, and returns it.

Frequent cache misses lead to higher latency and lower overall system speed. Modern systems use various replacement policies (LRU, FIFO, etc.) to decide which data to evict when the cache fills up.

Types of Cache Misses

  • Compulsory Miss (Cold Miss) — Happens the first time data is accessed. The cache simply hasn’t seen it yet.
  • Capacity Miss — Occurs when the cache is too small to hold all needed data, forcing eviction of useful items.
  • Conflict Miss — Happens in set-associative caches when multiple data items map to the same cache location, even if space is available.
  • Coherence Miss — Specific to multi-core systems when one core invalidates data cached by another core.

Also Read-What Is Happening In Indonesia ?

Impact and Real-World Examples

Cache misses slow down CPUs, web applications, databases, and CDNs.

Examples:

  • CPU Cache — A processor repeatedly accessing scattered data in RAM causes many misses and reduces instructions per second.
  • Web Browser — Loading a page for the first time results in cache misses for images and scripts; subsequent visits become faster (hits).
  • Database — Querying rarely used records leads to misses, forcing disk reads instead of memory access.
  • Content Delivery Network (CDN) — First request for a file from a new edge server causes a miss and pulls from the origin server.

Cache Hit vs Cache Miss

  • Cache Hit — Data found in cache. Fast response, lower latency.
  • Cache Miss — Data not in cache. Slower response, higher resource usage.

The cache hit ratio (hits / total requests) measures cache effectiveness. A high ratio means good performance; a low ratio signals too many misses.

FAQs : What Is A Cache Miss ?

What causes a cache miss?

First-time access, full cache, poor data locality, or data being evicted before reuse.

How do you reduce cache misses?

Improve data locality, use larger caches, better replacement algorithms, prefetching, or optimize code to access data more predictably.

Is a cache miss bad?

Yes, it adds latency. However, some misses (compulsory) are unavoidable. The goal is to minimize avoidable ones.

Where do cache misses occur?

Everywhere caching is used — CPU caches, web browsers, databases, CDNs, DNS caches, and applications.

What is cache thrashing?

Extreme situation where the cache constantly evicts and reloads data, resulting in mostly misses and very poor performance.

Join WhatsApp Group!

Leave a Comment