Skip to main content

Read replicas, sharding keys and back-of-the-envelope math

How do you scale a database step-by-step before sharding, and what makes a good shard key?

Official Reference

Model Answer & Explanation

Exhaust vertical scaling, query/index tuning, caching, and read replicas before sharding (sharding breaks cross-shard joins and transactions). Pick a high-cardinality shard key aligned with your dominant access pattern (e.g. tenant_id or user_id) to avoid scatter-gather queries and celebrity hotspots. Quick math rule: 1M req/day ~ 12 QPS avg (~35–60 peak QPS).

Follow-up Interview Question · How do you handle a single whale tenant that outgrows one shard?

Module Context & References

System Design · Popular interview theory The 20% of distributed systems building blocks behind 80% of architecture rounds
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.