Layer 3 · Go deeper · 7 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.
What hit ratio does a 200,000 reads a second sale need?
How much memory does the product working set need?
Build-up · 5 steps
Follow one look-aside read
The app asks the cache first and fills it on a miss. Facebook calls its memcache a demand-filled look-aside cache.
Step 1 of 5
Ask the cache first
The app looks the key up in the cache. Only data somebody asked for gets cached, so memory goes to what is actually used.
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 2 of 4
Interviewer
“Mid-sale, Redis goes down. Traffic is 200,000 reads a second and Postgres comfortably serves 10,000. What’s your plan?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“You’re bringing a brand-new cache cluster into service before a sale. How do you switch it on?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Each app server keeps its own in-process cache. Database load grows every time you add servers, and deploys hurt. What do you change?”
Your move. Pick an approach: