Interview › Databases & Caching
What is a cache hit ratio, and how do you improve it?
Databases & Caching · Advanced level
Answer
Cache hit ratio is hits divided by total lookups. I improve it by caching the right data, sizing memory, avoiding evictions, using stable keys, warming hot keys, choosing good TTLs, and avoiding unnecessary invalidation.
Technical explanation
Hit ratio equals hits divided by hits plus misses.
A global hit ratio can hide a low-hit critical endpoint, so break down by key prefix or API.
Improving hit ratio requires better key choice, TTLs, memory sizing, warmup, and avoiding unnecessary invalidation.
Hands-on example
Calculation:
keyspace_hits=900000
keyspace_misses=100000
Hit ratio = 900000 / 1000000 = 90%.
If evictions are high, add memory, reduce value size, or tune TTL/policy.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- What is Amazon RDS, and what does it manage for you versus self-managed databases?
- What database engines does RDS support?
- What is the difference between RDS and Aurora?
- What is Multi-AZ in RDS, and how does automatic failover work?
- How long does an RDS Multi-AZ failover typically take, and what triggers it?
- What is the difference between Multi-AZ and a read replica?
- When would you use a read replica, and can it become a standalone database?
- Can a read replica be in a different region, and why would you do that?