Layer 3 · Go deeper · 8 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How fast does Redis’s LFU counter climb?
How much more can a better policy serve from the same memory?
Build-up · 5 steps
Follow keys through S3-FIFO
Three plain FIFO queues that beat LRU on most traces. New keys must prove themselves before they get real space.
Step 1 of 5
New keys enter S
S3-FIFO splits the cache into a small queue S, with 10% of the space, and a main queue M with the other 90%. Every new key starts in S.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Your Redis cache holds a sale catalogue whose hot products stay popular for days. Which maxmemory-policy do you set?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“You’re adding an in-process cache to a Java service whose keys mix steady favourites with sudden bursts. Which policy?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Redis runs volatile-lru, but the app writes every key without a TTL. The cache fills up. What happens next?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“A blog post says S3-FIFO beats LRU by 18%. Should you switch your production cache’s policy?”
Your move. Pick an approach: