</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 6: A Brain That Writes, a Fleet That Converges - High-Level Architecture

Executive Summary: The architecture splits into two planes that never share a hot path. The control plane is small and careful: a release API, stateless orchestrator workers holding one lease per rollout, a strongly consistent state store, a health analyzer and a global deploy guard. The data plane is large and dumb on purpose: 100,000 host agents that pull their desired state, fetch bytes through zone caches, verify signatures and converge. This section draws both planes, walks Sam's r-1432 from registration to stage 4, and answers the question every interviewer asks here: why not just use the scheduler's rolling update?

Twenty-five minutes in, the interviewer slides the marker across. "Draw it."

You: "I'll draw two pictures. First the control plane, which decides what should run where. Then the byte path and the health path, which is how the fleet gets there and how we learn whether it worked."

The Control Plane

Control plane: CI sends digest, signature and provenance to the Release API and starts rollouts on merge via the Rollout API, as do UI, CLI and API callers; both APIs write to the global store, which feeds the rollout orchestrator workers on a 5 s tick; the health analyzer sends gate verdicts and the deploy guard can freeze or pause all; the orchestrator writes desired state with a new generation to the regional state store and logs every action to the audit log; a change feed drives desired-state distribution, which watch-streams to 100,000 host agents that report actual state and heartbeats back

Each box has one job, a rejected alternative and, where one exists, a flip trigger.

Component Job Rejected alternative Flip trigger
Release API Accepts a built, signed artifact from CI and records it by digest, once Rebuilding per environment; mutable tags like latest None: the same digest goes through every stage
Rollout API Writes control verbs to the rollout row with compare-and-set Calling the lease-holding worker directly (workers come and go; the row stays) None
Rollout orchestrator Stateless workers; each rollout is held by one lease; a 5 s loop advances batches and stages One global leader for all rollouts (a bottleneck with a fleet-wide blast radius); no leases (two workers both start the same batch) None
Global store Releases, rollout rows and their leases, in one small strongly consistent cluster spread across regions Rollout rows in a regional store, orphaned when that region fails None
Regional state store Desired and actual state per host slot, strongly consistent within the region An eventually consistent store, where an agent can see desired state go backwards None
Desired-state distribution Regional fan-out of desired state over long-lived watch streams The orchestrator pushing commands host by host A fleet of tens of hosts, where a script is honest
Host agents Watch, fetch, verify signature, drain, restart, report SSH loops from a central runner Same as above
Health analyzer Queries the monitoring platform, compares canary with control, issues gate verdicts Comparing with yesterday's baseline; a human watching dashboards Low-traffic services that need longer bakes or synthetic traffic (Section 9)
Deploy guard Global, regional or per-service freeze; pauses all rollouts when fleet health degrades Per-service autonomy with no global view None

Pull versus push for the agents is Section 4's argument and I won't replay it. Its consequence is visible here: the orchestrator holds zero connections to hosts. The per-region distribution tier holds the 100,000 watch streams and absorbs 10,000 heartbeats a second.

Key Insight: The orchestrator writes intent; it never executes. Every arrow from the brain to the fleet goes through a store, and so does every arrow from a human to the brain: a pause is a write to the rollout row, which the lease holder reads on its next tick, so it lands within 5 s. That gives you three things for free: a crashed worker loses nothing (the next lease holder reads the rollout and resumes), a host that was offline catches up by reading its current desired state, and the audit trail is the same data the system runs on.

Quick check before moving on:


Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.