Code Room
System designMediumsd-g664
Subject Database read replica routingLevel Mid–Senior~35 minCommon in Databases & SQL · Networking & APIs · Distributed systems interviewsIndustries Technology, Software development

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.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.