An authoritative DNS server sounds like a flat file: www.shop.com maps to 203.0.113.10, you serve that A record to everyone, done. That model works until you have more than one place to serve the site from. The moment you run backends in Mumbai, Frankfurt, and Virginia, the single right answer becomes many context-dependent answers: a user in Pune should get the Mumbai VIP, a user in Berlin should get Frankfurt, and if the Mumbai region is on fire, nobody should get Mumbai - and that last change has to take effect in seconds, not in whatever the record’s TTL happens to be.
This is a smart DNS traffic steering service: an authoritative DNS system that answers the same hostname with different address records depending on who is asking (geography), how fast each backend is for them (measured latency), and which backends are actually healthy right now (real-time health checks). It is the front door of global load balancing - the thing that decides, at resolution time, which region a user’s traffic lands in, before a single TCP packet reaches your infrastructure.
The genuinely hard part, and the thing this whole design is organized around, is the one in the problem statement: when a region degrades, the health-state change has to reach thousands of anycast DNS nodes worldwide and change the answers they give faster than the DNS TTL, so the blast radius of a regional outage is a narrow, bounded recovery window and not a full TTL of users black-holed into a dead region. DNS is a push-nothing, pull-on-expiry, cache-everywhere protocol; steering traffic away from failure fast is a fight against the protocol’s own caching. Let me build it properly.
Everything hard here exists to move two numbers: steering correctness (what fraction of users get sent to the best healthy region for them) and failover propagation time (how fast a region’s death stops being handed out as an answer). Get those right and a regional outage costs you a few seconds of a small slice of traffic; get them wrong and one dead region poisons DNS caches worldwide for minutes. This is not “a hostname to IP map.” It is a control plane that continuously recomputes the right answer per user and pushes that answer to the edge faster than caches can hurt you.
Functional Requirements (FR)
In scope:
- Geo steering. Answer the same hostname with different records based on the resolver’s (and, with EDNS Client Subnet, the client’s) geographic location - a user in India gets the India VIP, a user in Europe gets the EU VIP.
- Latency steering. Beyond coarse geography, route to the region with the lowest measured network latency for that client network, using a continuously built latency map of client-prefix to region RTT. Geo is a proxy; measured latency is the truth when they disagree.
- Real-time health-based failover. Continuously health-check every backend/region. If a region goes unhealthy, stop returning its records within seconds and redistribute its traffic to the next-best healthy regions. Recover it automatically when it comes back.
- Weighted and policy routing. Support weighted answers (90/10 canary, A/B, gradual region drain), active-passive failover (primary region, standby only on failure), and round-robin within a healthy region’s VIP set.
- Multiple record types and pools.
A/AAAArecords drawn from a pool of endpoints per region, with CNAME flattening so the steering hostname can sit behind a customer’s apex. - Per-record TTL control. Short TTLs on steered records so caches turn over fast, with the knobs to trade query volume against failover speed.
- Anycast global footprint. Serve authoritative answers from many PoPs worldwide behind a small set of anycast IPs, so the nearest PoP answers each query.
Explicitly out of scope (say it so you own the scope):
- Being a recursive resolver. I am the authoritative side - I own these zones and answer queries for them. I am not the 1.1.1.1-style recursive resolver that clients configure; that is a different system. (I depend on resolvers caching my answers, and fight their caching, but I do not run them.)
- Being the data-plane load balancer. I steer traffic at resolution time by handing out a VIP. The regional L4/L7 load balancer behind that VIP spreads requests across instances. I pick the region; it picks the server.
- Domain registration and the registry/TLD. Buying names and running TLDs is a commerce/registry system. I assume delegation to my nameservers already exists.
- DNSSEC key ceremony as a product. I support signing the zone (and the online-signing wrinkle it creates for dynamic answers is a real deep-dive point), but key management ceremony is a side concern.
- Application-layer routing (path, headers, cookies). That is the CDN/L7 proxy’s job once traffic arrives. DNS steering is coarse - per hostname, per client network - and I own that coarseness honestly.
The one decision that drives everything: this is a read-astronomically-heavy authoritative DNS system whose answers are a function of (who is asking, live health, live latency) rather than a static map, where the answer must change globally within seconds of a health event even though the protocol in front of me (DNS + resolver caching) is designed to hold answers for a full TTL. The entire design is about computing the right per-client answer cheaply at the edge and propagating health/latency state to every edge node faster than the TTL so failover is bounded and fast.
Non-Functional Requirements (NFR)
- Scale: Authoritative for large, high-traffic zones. On the order of millions of QPS of authoritative queries globally - call it ~2-5M QPS average, peaking 2-3x. Hundreds of anycast PoPs, thousands of DNS edge nodes, steering for tens of thousands of hostnames across thousands of backend regions/pools.
- Latency: Authoritative answer served in single-digit milliseconds at the node (it is an in-memory decision, not a recursion) plus client-to-PoP RTT via anycast; target p99 under 30ms end to end including the network.
- Availability: 99.99%+ on the answer path, realistically higher - if authoritative DNS for your zone is down, your whole site is unreachable regardless of backend health. The nameservers themselves must never be a single point of failure (anycast + multiple delegated NS).
- Failover propagation (the headline number): a region health transition must change the answers at every edge node within ~1-3 seconds (control-plane propagation), and reach end users within one short TTL on top of that. The design target: blast radius of a regional outage bounded to roughly (propagation time + TTL), on the order of 10-30 seconds, not minutes.
- Consistency: The answer is eventually consistent and TTL-bounded by the nature of DNS. During the propagation window different edge nodes may briefly give different answers; that is acceptable. The hard guarantee is bounded staleness of health state at the edge - no edge node should be steering to a region that has been dead for more than a few seconds.
- Durability: The zone/policy config (the steering rules, pools, weights) is the system of record and must be durable and strongly consistent on write. The live health/latency state is disposable and reconstructed from live probes - losing it just means re-probing. The authoritative answer is computed, not stored.
- The real budget is propagation time and steering correctness. At millions of QPS, the edge must answer from local in-memory state with zero per-query control-plane calls. So the entire fight is: how fresh is the health/latency state sitting in each edge node’s memory, and how fast did it get there.
Back-of-the-Envelope Estimation (BoE)
Real numbers, because they dictate the topology and - more importantly - the propagation design.
Query volume:
Zones served: tens of thousands of steered hostnames.
Target authoritative QPS: ~3 million QPS average.
3e6 QPS over 86,400 s = ~2.6e11 queries/day = ~260 billion/day.
Peak at ~2.5x average = ~7.5 million QPS.
Effectively 100% reads: an authoritative answer is a computed read.
"Writes" are config changes (rare) and health-state updates (the control plane),
which are orders of magnitude lower volume than query QPS.
Why TTL is the lever (query volume vs failover speed):
A hostname with TTL=30s, getting 100,000 real users behind caching resolvers.
A resolver re-queries me roughly once per TTL per popular name.
Shorter TTL -> more authoritative QPS, but faster cache turnover on failover.
TTL=300s: a dead region keeps being served to cached users for up to 5 min.
TTL=30s : worst-case cached-user exposure ~30s after I change the answer.
TTL=10s : ~10s exposure, at ~3x the query volume of TTL=30s.
Steered records live at 20-60s TTL. This is the central knob:
failover speed is gated by TTL, so TTL is deliberately short and query volume
is the price we pay for a narrow blast radius.
Control-plane / health event volume (the thing that must be fast, not big):
Backend pools/regions: ~5,000 endpoints under health check.
Health check interval: ~1-2s per endpoint (aggressive, this is the failover clock).
Checks/sec from the checking layer: 5,000 / 1.5 ≈ ~3,300 checks/sec.
Health STATE CHANGES (the events that must propagate): rare in steady state,
maybe a handful/sec, bursting to hundreds during a regional incident.
Each state change must reach THOUSANDS of edge nodes within ~1-3 seconds.
The asymmetry is the whole story: query volume is millions/sec and must be absorbed locally at the edge; health-change volume is tiny but each event has a hard, low-latency fan-out requirement to thousands of nodes. Two completely different scaling problems in one system.
State size at the edge (fits in RAM, trivially):
Per endpoint health record: id, region, status, weight, last_change ≈ ~200 bytes.
5,000 endpoints * 200B ≈ 1 MB of health state.
Latency map: client /24 prefixes that matter ≈ a few million, * region RTT vector.
Keep it compact: ~tens of MB, aggregated to /20-/24 and nearest-k regions.
Zone/policy config for tens of thousands of hostnames: a few hundred MB.
Everything the edge needs to answer a query lives in memory. No disk on the hot path.
Bandwidth:
Avg DNS response ~150-300 bytes (A records + EDNS). Say 250B.
3e6 QPS * 250B ≈ 750 MB/s = 6 Gbps global egress average, ~15 Gbps peak,
spread across hundreds of PoPs -> tens of Mbps per PoP. DNS is cheap on bandwidth;
it is expensive on packet rate and on getting the ANSWER right.
The numbers say: build an edge that answers from in-memory state at millions of QPS with zero control-plane calls per query, and spend all the engineering on pushing health/latency state to that edge in seconds.
High-Level Design (HLD)
The architecture splits cleanly into a data plane (the anycast DNS edge that answers queries) and a control plane (health checking, latency measurement, policy, and the propagation fabric that keeps the edge’s state fresh). The entire point of the split is that queries never wait on the control plane - they read local state - and the control plane’s only job is to keep that local state correct and fresh fast.
┌──────────────────── CONTROL PLANE ─────────────────────┐
│ │
┌──────────┐ │ ┌───────────────┐ ┌──────────────┐ ┌────────────┐ │
│ Operators│──CRUD─┼─►│ Config / Zone │ │ Health │ │ Latency │ │
│ / API │ │ │ Store (CP, │ │ Decision │ │ Map │ │
└──────────┘ │ │ strongly │ │ Engine │ │ Builder │ │
│ │ consistent) │ │ (aggregates │ │ (RUM + │ │
│ └──────┬────────┘ │ checks -> │ │ active │ │
│ │ │ region up/ │ │ probes) │ │
│ │ │ down) │ └─────┬──────┘ │
┌──────────────┐ │ │ └──────┬───────┘ │ │
│ Health │ │ │ │ │ │
│ Checkers │───┼─────────┼──health signals──►│ │ │
│ (distributed,│ │ │ │ │ │
│ multi-vantage│ │ ▼ ▼ ▼ │
│ probes to │ │ ┌──────────────────────────────────────────────┐ │
│ backends) │ │ │ STATE PUBLISHER / PROPAGATION FABRIC │ │
└──────────────┘ │ │ (config snapshots + fast health deltas) │ │
│ └───────────────────────┬──────────────────────┘ │
└───────────────────────────┼────────────────────────────┘
│ push deltas (pub/sub) +
│ pull snapshots (versioned)
┌───────────────────────────────────────┼───────────────────────────────┐
▼ ▼ ▼
┌───────────────┐ ANYCAST IP ┌───────────────┐ ┌───────────────┐
│ DNS EDGE NODE │ ◄──────────── │ DNS EDGE NODE │ ... │ DNS EDGE NODE │
│ PoP: BOM │ (one IP, │ PoP: FRA │ (thousands │ PoP: IAD │
│ - in-RAM zone │ nearest │ - in-RAM zone │ of nodes, │ - in-RAM zone │
│ - health tbl │ PoP wins) │ - health tbl │ hundreds │ - health tbl │
│ - latency map │ │ - latency map │ of PoPs) │ - latency map │
│ - STEER ENGINE│ │ - STEER ENGINE│ │ - STEER ENGINE│
└──────┬────────┘ └──────┬────────┘ └──────┬────────┘
│ answer A record of best healthy region for THIS client │
▼ ▼
end user's resolver ─────► gets VIP of (geo+latency+health) best region
then connects to that region's L4/L7 LB
Query flow (data plane, the millions-QPS path):
- A client’s recursive resolver queries
www.shop.com. Anycast routes the UDP/53 (or DoT/DoH/DoQ) packet to the nearest DNS edge node by BGP. - The edge node identifies the client’s network: the resolver’s source IP, and if present the EDNS Client Subnet (ECS) prefix (the resolver forwarding a truncated client network), which is far more accurate than the resolver IP for geo/latency.
- The steering engine looks up, entirely in local RAM: the hostname’s policy, the client’s geo and latency-to-each-region from the latency map, and each candidate region’s current health from the local health table.
- It computes the answer: filter to healthy regions, rank by measured latency (falling back to geo distance), apply weights/policy, and return the chosen region’s VIP A record(s) with a short TTL.
- The resolver caches that answer for the TTL and hands it to the client, who connects to the regional VIP. No control-plane call happened on this path.
Health flow (control plane, the seconds-latency path):
- Distributed health checkers probe every backend endpoint from multiple vantage points every 1-2s (HTTP/TCP/gRPC). They report pass/fail to the Health Decision Engine.
- The decision engine aggregates across vantage points (quorum, hysteresis) and decides a region’s authoritative up/down state - turning raw flapping probes into a clean, debounced state transition.
- On a transition, it emits a health delta into the propagation fabric, which pushes it (pub/sub) to every edge node within ~1-3s. Each edge updates its in-memory health table, and its next answers immediately exclude the dead region.
Config flow (rare, strongly consistent):
- Operators change steering policy (pools, weights, TTLs) via an API. The change is written to the strongly-consistent config store (the system of record).
- The state publisher produces a new versioned zone snapshot and distributes it to all edges. Edges apply it atomically and report the version they are serving, so you can see global convergence.
Latency flow (continuous, background):
- The latency map builder fuses Real User Measurements (RUM) - timing beacons from actual clients to each region - with active probes, aggregated by client prefix, into a prefix -> region-RTT table. It ships periodic snapshots to the edges. This is the slow-moving brain behind latency steering; it does not need second-level freshness, unlike health.
Component Deep Dive
Four hard parts, each taken naive-first and then broken: (1) the steering decision at the edge; (2) health-state propagation faster than the TTL - the core challenge; (3) health checking that does not false-failover; (4) the latency map. The progression matters - the naive version of each is what you would reach for first, and seeing exactly where it breaks is the point.
1. The steering decision: where the answer comes from
Naive: compute the answer in the control plane, per query
Every query hits the edge, the edge calls a central “steering service” that knows health and latency, gets back the answer, returns it. Clean separation, always-fresh state.
Where it breaks:
- Latency and QPS. At 3M+ QPS, a control-plane round trip per query is both a latency tax (you just doubled or tripled answer time) and a throughput wall - the central service becomes a 3M-QPS bottleneck that no consensus-backed store can serve.
- Blast radius of the control plane. If the central steering service hiccups, every DNS answer worldwide stalls. You have coupled the millions-QPS answer path to a single logical service. That is the opposite of what authoritative DNS availability demands.
- It defeats anycast. The whole reason answers are fast is the nearest PoP serves them locally; phoning home to a central brain per query throws that away.
Better: precomputed policy + live state in edge RAM, decide locally
The edge holds everything it needs - the hostname policy, the latency map, and the live health table - in memory, and computes the answer locally per query with no network call. The control plane’s job is not to answer queries; it is to keep that in-memory state fresh. Decision cost per query is a few hash lookups and a sort over a handful of candidate regions - microseconds.
answer(hostname, client_ecs_or_ip):
policy = zone[hostname] # in-RAM, from config snapshot
client_net = ecs_prefix or resolver_ip # who is asking
candidates = policy.pools # e.g. [BOM, FRA, IAD]
healthy = [r for r in candidates if health[r].status == UP] # in-RAM table
if not healthy: healthy = failover_pool(policy) # last-resort / drain-to-any
ranked = sort healthy by latency_map[client_net][r] # measured RTT, asc
(fallback: geo_distance(client_net, r) when no latency sample)
chosen = weighted_pick(ranked, policy.weights) # policy on top of ranking
return A-records(chosen.vips), ttl=policy.ttl # short TTL
This is the only design that holds at the QPS. The cost is that the edge’s state is eventually fresh, not instantaneously - which turns the entire problem into “how fast can I update health[] and latency_map[] at every edge,” handled next. That reframing is the key move: the hard problem is not computing the answer, it is freshness of the inputs to the computation.
2. Health-state propagation faster than the TTL (the core challenge)
This is the heart of the system. A region dies; I need every edge node to stop handing out that region’s VIP within seconds, so the outage’s blast radius is bounded. Two clocks are running against me: the propagation clock (how fast the state reaches the edge) and the TTL clock (how long resolvers keep serving a cached answer after I change it). Total user-visible failover time ≈ propagation + residual TTL. I must shrink both.
Naive A: let the edge re-pull config/health on a timer
Each edge polls the control plane every N seconds for the current health table.
Where it breaks:
- N is a floor on failover. If edges poll every 30s, worst-case an edge serves a dead region for 30s before it even learns, and then the TTL clock starts. Failover time is now (poll interval + TTL), tens of seconds to minutes. The poll interval is a direct tax on blast radius.
- Thundering herd. Thousands of edges polling a central store on a timer is a synchronized load spike; tightening N to improve failover multiplies that load.
- You cannot tell who is stale. Polling gives no global convergence signal - you do not know which edges have seen the new state.
Naive B: bake health into the zone and lower the TTL to near zero
Treat health as config: when a region dies, rewrite the zone to drop it and push a new zone, and set TTL=1s so caches turn over instantly.
Where it breaks:
- TTL=1s is a self-inflicted DDoS. Resolvers re-query every second; your authoritative QPS explodes by 20-60x. You trade a bounded failover for a permanent, massive, always-on query load - and you pay it 100% of the time to buy failover speed you need 0.001% of the time.
- Full-zone pushes are heavy and slow. Rebuilding and distributing a whole zone (and re-signing it for DNSSEC) on every health flap is expensive and couples the fast health path to the slow config path.
- Resolvers clamp low TTLs. Many recursive resolvers enforce a minimum TTL floor (often several seconds to tens of seconds); your TTL=1s becomes their TTL=30s anyway, so you pay the cost without fully getting the speed.
Better: a push-based propagation fabric for health deltas, decoupled from config, plus a deliberately-chosen short TTL
Three moves together.
Move 1 - push, do not poll. Model health as a stream of deltas on a persistent pub/sub fabric that every edge node subscribes to. When the decision engine declares BOM: UP -> DOWN, it publishes one tiny message; the fabric fans it out to thousands of edges in ~1-3s. No edge waits a poll interval; propagation is event-driven and as fast as the fabric. This is the single most important mechanism in the system: the health change races the TTL, and push is what lets it win.
Health event path, with a clock on it:
t=0.0s BOM region starts failing (backends 5xx / timeouts)
t=0.0-1.5s checkers from 3+ vantage points observe failures, report
t=1.5s Decision Engine reaches quorum + passes hysteresis -> BOM DOWN
t=1.5s publish delta {region: BOM, status: DOWN, epoch: 8821}
t=1.5-3.5s propagation fabric fans out to ~thousands of edges (pub/sub)
t=3.5s every edge's health[BOM]=DOWN; new answers exclude BOM
----- propagation done in ~3.5s. Now the TTL clock on already-cached answers -----
t=3.5 .. 3.5+TTL resolvers holding a cached "BOM" answer keep using it until expiry
With TTL=30s, worst-case cached user exposed ~30s; typical ~15s (half the TTL).
Blast radius bound ≈ propagation (~3.5s) + TTL (≤30s). Bounded and known.
Move 2 - decouple the fast health path from the slow config path. Health deltas do NOT rewrite the zone. The zone/config snapshot is versioned and changes rarely (operator edits); the health table is a separate, tiny, high-frequency channel. An edge’s answer is zone_snapshot ∘ health_overlay - it applies the current health overlay on top of a stable zone. This means a health flap is a ~100-byte message, not a zone rebuild, and it never touches DNSSEC signing (because the set of possible records is pre-signed in the zone; health only selects among already-signed records - more on the DNSSEC wrinkle below).
Move 3 - choose the TTL deliberately, do not race it to zero. Pick the steered-record TTL to balance query volume against the residual-TTL half of failover. 20-60s is the sweet spot: short enough that cached users recover within a bounded, acceptable window, long enough that query volume is sane. Then shrink the other half (propagation) with push, which is free of the query-volume cost. The insight: you cannot cheat the TTL clock without paying query volume, so you minimize the propagation clock instead, where speed is cheap. For the rare hostnames that need sub-TTL failover regardless, combine DNS steering with a data-plane health-aware anycast VIP (the regional LB withdraws its anycast route on death), so even cached-at-the-old-VIP users get re-routed below the DNS layer. DNS steering plus data-plane withdrawal is belt and suspenders.
Why push beats both naive options:
| Approach | Propagation time | Query-volume cost | Convergence visibility |
|---|---|---|---|
| Timer poll | poll interval (10-30s) | herd spikes | none |
| TTL≈1s rezone | ~1s but resolver-clamped | catastrophic (20-60x) | none |
| Push deltas + 30s TTL | ~1-3s | tiny (health channel) | per-edge epoch acks |
Convergence visibility. Each delta carries a monotonically increasing epoch. Edges ack the highest epoch they have applied. The control plane watches the distribution of acked epochs and knows, globally, “99.9% of edges are on epoch 8821” within seconds - so failover is observable, not hoped-for. An edge that falls behind (missed messages, partition) detects the epoch gap and pulls a fresh health snapshot to catch up; the fabric is push-first with pull-repair as the safety net.
Fail-safe on uncertainty. If an edge loses its control-plane connection, it must not freeze on stale health. Policy: keep serving the last-known-good health for a bounded staleness window (so a brief control-plane blip does not cause mass failover), but if staleness exceeds the window, fail static to a conservative config-defined answer set (e.g. all regions, or a designated safe region) rather than confidently steering on minutes-old health. Being bounded-stale is fine; being confidently-wrong is not.
3. Health checking that does not false-failover
Failover is only as good as the signal that triggers it. A flaky checker that declares a healthy region dead will cause outages by draining traffic off good regions.
Naive: one checker, one probe, flip on first failure
A single checker pings each endpoint; one failed probe flips the region to DOWN.
Where it breaks:
- The checker’s network is not the users’ network. A single vantage point conflates “the region is down” with “the path from this one checker to the region is down.” A checker-side network blip black-holes a perfectly healthy region for every user worldwide.
- No hysteresis means flapping. A single transient 500 or a GC pause flips the region, failover fires, then it flips back - traffic sloshes between regions on noise, which is worse than either steady state.
- Single checker is a SPOF. If the checker dies, health goes stale everywhere at once.
Better: multi-vantage checks, quorum, and hysteresis in the decision engine
- Multiple vantage points. Probe each endpoint from several geographically and network-diverse checkers. A region is only DOWN if a quorum of vantage points agree it is failing. This separates “region is actually sick” (most vantages see it) from “one checker’s path is bad” (one vantage sees it). The decision engine does the aggregation; raw probes are just votes.
- Hysteresis / debounce. Require N consecutive failing cycles to go DOWN and M consecutive passing cycles to come back UP, with the down-threshold faster than the up-threshold (fail fast, recover cautiously). This kills flapping: a single bad cycle never triggers failover, and a region does not bounce back into rotation until it is convincingly healthy.
- Rich probe semantics. Not just TCP-connect: an HTTP check hits a real
/healthzthat reflects the backend’s own view (dependencies, load), so “the port is open but the app is broken” is caught. Support latency thresholds too - a region that is up but 10x slower can be marked degraded and weighted down rather than hard-failed. - Checker fleet, not a checker. The checkers are themselves a distributed, redundant fleet; losing some just reduces vantage coverage, it does not blind the system.
Region BOM, 3 vantage points, down-threshold=2 cycles, up-threshold=4:
cycle: 1 2 3 4 5 6 7 8
VP-sin: ok ok FAIL FAIL FAIL ok ok ok
VP-nrt: ok ok FAIL FAIL FAIL ok ok ok
VP-fra: ok ok ok FAIL FAIL ok ok ok <- fra path differs, still quorum
quorum: up up up DOWN DOWN up? up? UP
state: UP UP UP DOWN DOWN DOWN DOWN UP
^fires at cycle4 (quorum down 2nd time)
^waits 4 clean cycles before UP again
The hysteresis asymmetry is a deliberate trade: bias toward fast failover (protect users from a dead region) and slow recovery (do not flap a shaky region back into rotation). False DOWN costs you one region’s capacity briefly; false UP black-holes users into a region that is not really well.
4. The latency map: measuring, not guessing
Geo steering (“India IP -> Mumbai”) is a heuristic. The real goal is lowest latency, and geography lies - a client’s resolver might be in a different country than the client, or the shortest geographic path might not be the lowest-RTT network path (peering, congestion, undersea cable routes).
Naive: steer purely on a static GeoIP database
Map the resolver IP to a country via a GeoIP table and pick the region in that country.
Where it breaks:
- Resolver location is not client location. Without ECS, you see the recursive resolver’s IP, which may be a central resolver thousands of km from the user. You steer to the resolver’s region, not the user’s.
- Geography is not latency. Two regions equidistant by map can have wildly different RTT due to network topology. GeoIP cannot see peering or congestion.
- GeoIP is stale. IP-to-location data drifts; you are steering on a snapshot that is wrong at the edges.
Better: a measured latency map keyed by client prefix, with geo as fallback
- Use ECS to get closer to the client. When the resolver sends EDNS Client Subnet, key decisions on the client’s prefix, not the resolver’s IP. Cache answers per ECS prefix. This alone fixes the central-resolver problem for the large resolvers that send ECS.
- Build the map from real measurements. Collect RUM - a small timing beacon from real clients that measures RTT to each candidate region - and fold in active probes to prefixes. Aggregate by client prefix (/24 down to /20 where data is sparse) into a
prefix -> {region: rtt}table. Now the decision is “which healthy region has the lowest measured RTT for this prefix,” which is the actual objective. - Fallback hierarchy. Measured RTT for the exact prefix -> measured RTT for the covering aggregate -> geo distance (GeoIP) -> policy default. You always have an answer, degrading from precise to coarse gracefully.
- Different freshness than health. The latency map moves slowly (network topology changes over minutes/hours, not seconds), so it propagates as periodic snapshots, not real-time deltas. Health is the fast channel; latency is the slow one. Mixing their cadences into one fabric would be a mistake - they have opposite freshness needs.
The map is what turns “GeoDNS” into “smart” steering: geography selects a plausible set, measurement picks the winner, and health vetoes the dead.
API Design & Data Schema
Management API (control plane, low volume, strongly consistent writes)
# --- Zones and steering policy ---
POST /v1/zones/{zone}/records
body: {
"name": "www.shop.com", "type": "A",
"steering": "latency", # latency | geo | weighted | failover
"ttl": 30,
"pools": [
{ "region": "BOM", "vips": ["203.0.113.10"], "weight": 100 },
{ "region": "FRA", "vips": ["198.51.100.20"], "weight": 100 },
{ "region": "IAD", "vips": ["192.0.2.30"], "weight": 100 }
],
"failover_pool": "IAD", # last-resort if all preferred are down
"health_check": { "type": "https", "path": "/healthz",
"interval": "1s", "down_after": 2, "up_after": 4 }
}
201: { "record_id": "rec_7af3", "version": 412 }
PUT /v1/zones/{zone}/records/{record_id} # update weights/ttl/pools
DELETE /v1/zones/{zone}/records/{record_id}
GET /v1/zones/{zone}/records/{record_id}
# --- Health (read the live decision; writes come from checkers internally) ---
GET /v1/health/regions
200: { "regions": [
{ "region": "BOM", "status": "DOWN", "since": "2026-11-30T04:12:01Z",
"vantage_quorum": "3/3 failing", "epoch": 8821 },
{ "region": "FRA", "status": "UP", "epoch": 8821 } ] }
# --- Convergence / observability ---
GET /v1/propagation/epoch
200: { "current_epoch": 8821,
"edges_total": 9120, "edges_on_current": 9114, "p99_lag_ms": 2600 }
# --- Operator overrides (incident response) ---
POST /v1/health/regions/{region}/drain # force a region out of rotation
POST /v1/health/regions/{region}/enable
Resolution interface (data plane - this is DNS itself, not HTTP)
# Standard DNS query over UDP/53, TCP/53, DoT/853, DoH/443, DoQ.
# Example (conceptual) with EDNS Client Subnet:
QUERY www.shop.com IN A EDNS0: ECS 49.36.128.0/20 (client prefix in India)
ANSWER www.shop.com 30 IN A 203.0.113.10 (BOM VIP, healthy+nearest)
(TTL=30, scope-prefix echoed in ECS so the resolver caches per-prefix)
# If BOM is DOWN at answer time:
ANSWER www.shop.com 30 IN A 198.51.100.20 (FRA VIP, next-best healthy)
Data / storage schema
Three stores, each matched to its access pattern and consistency need.
1. Config / zone store (system of record - strongly consistent, durable):
record {
record_id string PK
zone string (indexed)
name string (indexed) # "www.shop.com"
type enum # A | AAAA | CNAME
steering enum # latency | geo | weighted | failover
ttl int # seconds, the failover knob
failover_pool string
version int64 # bumped on every edit (optimistic concurrency)
}
pool {
record_id string FK (indexed)
region string
vips list<ip>
weight int
health_check struct # type, path, interval, down_after, up_after
}
# Index: (zone, name, type) for lookup; version for CAS updates.
Store choice: a strongly consistent, durable store (a replicated SQL/NewSQL DB or a Raft-backed KV). This is the source of truth for what the answers can be; it is low write-rate and correctness-critical (a wrong pool means wrong routing for everyone). SQL-shaped relational data (records own pools own checks) with modest volume - SQL/NewSQL fits; the read path never touches it directly (it reads snapshots).
2. Live health state (ephemeral, fast, in-memory at edges and in the decision engine):
region_health {
region string PK
status enum # UP | DEGRADED | DOWN
epoch int64 # monotonic, carried on every delta
since timestamp
vantage_votes map<vantage_id, pass|fail> # in decision engine only
}
# At the edge: a tiny in-RAM table, ~5,000 entries, overlaid on the zone snapshot.
# NEVER persisted to disk - reconstructed from a snapshot pull on startup/gap.
Store choice: in-memory, propagated over pub/sub. No database. Health is high-churn, must survive control-plane partitions at the edge (serve last-known-good), and is disposable - exactly the profile that disqualifies a durable DB and calls for a push fabric plus local RAM.
3. Latency map (large-ish, slow-moving, snapshot-distributed):
latency_entry {
client_prefix cidr PK # 49.36.128.0/20
region_rtt map<region, ms> # {BOM: 18, FRA: 140, IAD: 210}
samples int # confidence / sample count
updated timestamp
}
# Built offline from RUM + active probes, shipped to edges as periodic
# compact snapshots (tens of MB). Read-only at the edge.
Store choice: built in a batch/streaming pipeline, served as immutable versioned snapshots that edges memory-map. It is read-heavy at the edge, rebuilt centrally, and does not need per-query consistency - a snapshot that is minutes old is fine for latency.
The DNSSEC wrinkle, stated honestly. If the zone is signed, you cannot sign answers on the fly per client without an online signing key at every edge (an operational and security burden). The clean approach: pre-sign every possible record (each region’s VIP RRset is signed in the zone), and let steering/health select among already-signed RRsets rather than mint new ones. Health flips choose which signed answer to serve; they never require re-signing. This is exactly why Move 2 keeps health as a selector overlay and not a zone rewrite - a rewrite would mean re-signing, which would couple the fast path to key material. Pay the cost of pre-signing the cross product of answers; keep the hot path signature-free.
Bottlenecks & Scaling
Where it breaks first, in order, and the fix for each.
1. Propagation fabric fan-out (the first thing that matters). One health delta must reach thousands of edges in seconds; a naive central publisher doing N unicast sends is a fan-out bottleneck and a SPOF. Fix: a tiered/relay pub-sub tree - regional relays subscribe to the central publisher and re-fan-out to the edges in their region, so the root publishes once per region, not once per edge. Edges ack epochs up the tree. This bounds per-node fan-out (log-style tree) and keeps WAN links lean. Run the publisher itself redundantly (multiple instances, edges subscribe to any); the fabric must be more available than the thing it protects.
2. TTL vs query-volume tension. Short TTLs (needed for the residual-failover half) multiply authoritative QPS; this is the first place cost breaks. Fix: pick TTL per-hostname by criticality (20-60s default), minimize the propagation half with push instead of chasing TTL to zero, and absorb the resulting QPS with the anycast edge (which scales horizontally - add nodes/PoPs). For the few hostnames needing sub-TTL failover, add data-plane anycast VIP withdrawal so recovery does not depend on DNS cache expiry at all.
3. Hot hostname / hot prefix at a single edge. A viral hostname or a huge resolver (one ECS prefix = millions of users) concentrates QPS on specific in-RAM entries at a PoP. Fix: the decision is a few RAM lookups, so a single node handles very high QPS already; beyond that, add nodes per PoP behind the same anycast IP (ECMP spreads packets across nodes in the PoP). All state is replicated to every node, so any node answers any query - there is no per-key owner to hot-spot. Query answering is embarrassingly parallel because it is read-only over replicated state.
4. Health flapping storms during a real incident. A regional incident can make hundreds of endpoints flap, generating a delta storm. Fix: hysteresis and quorum at the decision engine collapse raw probe noise into clean transitions (Deep Dive 3), so the fabric carries state changes, not probe chatter. Aggregate to region granularity - edges care about “BOM is down,” not about each of BOM’s 50 endpoints, so one region delta replaces fifty endpoint deltas. Coalesce rapid transitions with a short debounce window before publishing.
5. Anycast node/PoP failure. A PoP or node dies. Fix: anycast handles this natively - BGP withdraws the dead PoP’s route and the next-nearest PoP absorbs its traffic within BGP reconvergence time. Plus multiple delegated NS records on diverse anycast IPs so even losing an entire anycast cloud leaves a working nameserver. DNS resolvers already retry across the NS set - lean on it.
6. Control-plane partition isolating edges. An edge loses the propagation fabric. Fix: serve last-known-good health within a bounded staleness window, then fail static to a safe config answer (Deep Dive 2). The edge never stops answering - stale-but-up beats correct-but-down for authoritative DNS. The epoch-gap detector triggers a snapshot pull to re-converge the moment connectivity returns.
7. Config store as a write bottleneck or SPOF. All policy writes serialize through the consistent store. Fix: config writes are rare and human-paced (operators editing policy), so the volume is trivial; the store never sits on the query path (edges read snapshots), so its availability affects changes, not answers. Replicate it (Raft/multi-AZ) so losing a node loses nothing. If it is briefly down, existing answers keep flowing.
8. The DNSSEC online-signing trap. Signing per-client answers on the fly would put signing keys at every edge and add crypto to the hot path. Fix: pre-sign the cross product of possible RRsets and make steering a selector, never a minter (Deep Dive / schema). Health and latency choose among signed answers; the hot path does zero signing. Trade pre-computation and zone size for a signature-free, key-material-free edge.
Wrap-Up
The trade-offs that define this design:
- Data plane reads local state; control plane keeps it fresh. The edge answers millions of QPS from in-memory zone + health + latency with zero per-query control-plane calls. This reframes the whole problem away from “compute the answer” and toward “propagate the inputs fast,” which is where all the engineering goes.
- Push health deltas, do not race the TTL to zero. You cannot cheat the TTL clock without paying catastrophic query volume, so you minimize the propagation clock instead - event-driven push over a relay fabric gets a region’s death to every edge in ~1-3s, and a deliberately-short (not near-zero) TTL bounds the residual. Blast radius ≈ propagation + TTL, on the order of tens of seconds, by design.
- Decouple the fast health channel from the slow config channel. Health is a tiny selector overlay on a stable, pre-signed zone - so a flap is a 100-byte message, not a zone rebuild, and it never touches DNSSEC signing. Different freshness needs (seconds for health, minutes for latency, rare for config) ride different channels with different cadences.
- Fail toward availability, with hysteresis. Multi-vantage quorum and asymmetric debounce (fast down, slow up) stop false-failover; bounded-stale-then-fail-static stops a control-plane blip from black-holing users. For authoritative DNS, being briefly stale beats being confidently wrong, and being up beats being perfectly fresh.
- Measurement over geography. A real latency map keyed by ECS client prefix picks the actually-fastest healthy region; geo is only the fallback when measurement is thin. “Smart” steering is geography proposing and measurement disposing, with health holding veto.
One-line summary: an anycast fleet of thousands of DNS edge nodes answers each query from in-memory zone, health, and latency state - computing the best healthy, lowest-latency region for the client’s prefix - while a push-based propagation fabric carries debounced, quorum-decided health deltas to every edge within a couple of seconds, so a region’s failure is served out of DNS within a bounded window of roughly propagation time plus a deliberately-short TTL, not a full TTL of users black-holed into a dead region.
Comments