hard Drill: cost trade-off — bigger cache vs more DB replicas
Drill
Reads are 50K QPS. Option A: add 3 read replicas (~$0.10/GB-mo block storage + ~16 vCPU each). Option B: add 200 GB more cache (RAM) to push the hit ratio from 90%→98%. Reason about which is cheaper and why — no single exact number expected.
✅ Worked solution & bounds check
Worked solution (reasoning)
- Cache math: at 90% hit, 5K QPS hit the DB; at 98%, only 1K QPS do. The extra 200 GB cache removes ~4K QPS of DB load — likely eliminating the need for the replicas entirely.
- Cost: 200 GB RAM ≈ one larger cache node (~$1–2K/mo). Three replicas ≈ 48 vCPU + storage + ops (~$5–8K/mo).
- Verdict: cache first — it’s cheaper and faster (sub-ms vs replica round-trip). Add replicas only when the miss traffic or write-fanout still overwhelms the primary, or for availability/failover.
Gate: this is the senior move — quantify the load each option removes, then pick the cheaper lever. Cache attacks read volume; replicas attack availability + miss-path load.
🤖 Don't fully get this? Learn it with Claude
Stuck on Drill: cost trade-off — bigger cache vs more DB replicas? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.
🪜 Hint ladder (no spoilers)
Progressively stronger hints — you still solve it.
I'm working on the problem **Drill: cost trade-off — bigger cache vs more DB replicas** (System Design). Give me a HINT LADDER: start with the tiniest nudge, then wait. Only reveal the next, stronger hint when I ask. Do NOT show the full solution unless I type 'show solution'. Keep me doing the thinking. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🎨 Explain the approach visually
See the technique, not just code.
Explain the optimal approach to **Drill: cost trade-off — bigger cache vs more DB replicas** with a VISUAL walkthrough: trace it on a small concrete example using ASCII art / a step-by-step diagram, narrate what changes each step, then give time & space complexity with a one-line derivation. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔍 Review my solution
Catch bugs, edge cases, sub-optimality.
I'll paste my solution to **Drill: cost trade-off — bigger cache vs more DB replicas**. Review it for correctness, missed edge cases, and time/space complexity, then coach me toward the optimal — don't just rewrite it. Ask me to paste my code now. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔁 Drill the pattern
Lock in recognition with look-alikes.
Give me 2 problems that use the SAME underlying pattern as **Drill: cost trade-off — bigger cache vs more DB replicas**. For each, let me attempt first, then review my answer and name the trigger signal that reveals the pattern. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.