Code Room
System designMedium
Question
Design a read-replica and routing layer in front of a Postgres primary with 6 read replicas, handling a 95/5 read/write ratio at 100k QPS. Routing must send writes to the primary, spread reads across healthy replicas, and avoid the 'read-your-own-write' bug where a user updates a profile and immediately sees stale data. How do you route, track replica health, and handle replication lag?
What a strong answer looks like
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.
Learn the concepts
Loading whiteboard…
Run or narrate your approach, then ask the coach.