Layer 3 · Go deeper · 8 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.
How long until Route 53 calls a dead endpoint unhealthy?
Build-up · 6 steps
One failover, second by second
PostgreSQL with Patroni and etcd, apps reaching the primary through HAProxy, all on default timers. The primary dies; watch the clock.
Step 1 of 6
The primary holds the key
Patroni’s primary holds a leader key in etcd that expires after 30 s, renewing it every 10 s. A replica streams WAL about a second behind, and clients write.
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 1 of 4
Interviewer
“Your platform fails over nodes, cache shards, zones and, rarely, a whole region. Which failovers should trigger automatically?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Your payments ledger replicates asynchronously, and lag averages 0.1 s. How do you set and enforce its RPO?”
Illustrative peak of 3,000 writes per second.
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Your primary freezes in a long GC pause. Its lease expires and a replica is promoted. How do you stop the old one’s writes?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“App servers and database nodes sit in different subnets. Every app must switch within seconds. How do they find the new primary?”
Your move. Pick an approach:
Build-up · 6 steps
Quorum to notice, majority to act
Three Sentinels in three zones guard a Redis master and two replicas. Then a partition cuts off the master’s zone.
Step 1 of 6
Three zones, three Sentinels
Each zone runs a Sentinel. The master sits in zone a with client C1 writing to it; R1 and R2 replicate, R1 slightly ahead. Quorum is 2.