$linuxjunkies
>

cache hit

also: cache hit rate

A cache hit occurs when requested data is found in a cache, avoiding a slower access to main memory or disk. It's the opposite of a cache miss.

A cache hit happens when the CPU or system retrieves data from a fast cache memory instead of having to fetch it from slower main RAM or storage. Modern CPUs maintain multiple levels of cache (L1, L2, L3) between the processor and main memory to speed up data access.

For example, if a program repeatedly reads the same variable in a tight loop, the first access may populate the L1 cache. Subsequent accesses find the data already there, resulting in cache hits with latency measured in nanoseconds rather than the hundreds of nanoseconds required for main memory access.

Cache hit rates directly impact system performance. High hit rates mean the CPU spends less time waiting for data, while low rates (cache misses) force expensive trips to slower storage, causing performance bottlenecks. Tools like perf can measure cache hit/miss statistics on Linux systems.

Related terms