Caching Strategies and Eviction
medium 25 minPlace fast memory between applications and persistent storage to slash read latency and protect databases.
What each level should show
The same question is judged differently for mid, senior and staff.
Mid
Must show
- Explains hit, miss and TTL
- Draws cache-aside
- Deletes on a change
Will be probed on
- Where the cache sits
- What happens on a miss
Stands out
Gives the oldest acceptable age in seconds.
Senior
Must show
- Estimates hit rate, memory and database load
- Handles stampede, penetration and a cold cache
- Picks an eviction policy with a reason
Will be probed on
- The stale-set race
- Key design
- What to measure
Stands out
Plans for the moment the cache is empty.
Staff
Must show
- Decides per kind of data, including no cache
- Weighs layers against each other
- Names who owns invalidation
Will be probed on
- Many services writing the same data
- Cost against benefit
- Failure drills
Stands out
Removes a cache that does not pay for itself.