It's always DNS, so why are we running our own? s2.dev · 11 points · 4 comments ...
HN Best 200 @best
It's always DNS, so why are we running our own? s2.dev · 11 points · 4 comments · HN thread
TL;DR S2 describes replacing AWS Route53 with a custom authoritative DNS server so it can serve an unlimited number of per-basin CNAME records with instant consistency. Route53's API limit of roughly 5 UPSERTs per second, hit during a basin-flooding incident, drove the decision; the server reads records live from its Cloud Spanner account database and sits behind Cloudflare's DNS Firewall.
- Basins become subdomains (my-basin.b.s2.dev) via CNAME records, so unlimited basins required unlimited DNS records that resolve instantly after creation.
- Route53 API throttling (about 5 UPSERTs per second, per the author's reading at the time) backed up normal DNS updates for hours after a actor created tens of thousands of basins, leading to a 100-basins-per-account limit.
- Other managed providers (GCP Cloud DNS, Cloudflare, Azure DNS) were judged to have similar API update limits.
- The server is written in Go with miekg/dns, answers A, AAAA, NS, CNAME and SOA queries, reads records live from Spanner, and is tested with unit tests, RFC compliance testing (Ferret) and smoke tests.
- Cloudflare DNS Firewall fronts the origins, which accept traffic only from Cloudflare IPs; the team fears NXDOMAIN floods most, since each random query becomes a database lookup.
- Runs on two GKE clusters in separate regions with TCP and UDP load balancers; ACME DNS-01 challenges are delegated to a separate Route53 zone.
Discussion The thread is small, with a few comments. One commenter asks whether PowerDNS backed by CloudSQL, fed from a Spanner stream, was considered, arguing it would keep DNS query spikes off Spanner. The original poster offers to answer questions. Another asks about the scale of a graph that the article does not seem to show clearly. The most substantive reply disputes the article's claim of strong consistency, noting that DNS is eventually consistent by design and speculating that clients query a specific server directly. The mood is curious and mildly skeptical, with no hostility.
- Strong consistency claim conflicts with DNS's design (some): A commenter argues DNS is eventually consistent by design and cites RFC 1034 favoring availability over instant updates. They suspect S2 gets consistency in practice by having clients query a specific server directly.
- Alternative: PowerDNS on CloudSQL fed by Spanner (a few): One commenter asks whether PowerDNS backed by CloudSQL, populated from a Spanner stream, was considered. They argue it would isolate DNS query spikes from the Spanner database.
- Running DNS is not that scary (a few): A commenter notes that a Kubernetes cluster already runs a DNS server, so operating one is less daunting than the article suggests, though they admit possible bias from past DNS tooling work.
- Article needs background on S2 and access patterns (a few): A reader asks for an appendix explaining what S2 is and how clients typically reach the service, since the post assumes context the reader may lack.
#DNS #Route53 #Spanner #Cloudflare #infrastructure #rateLimits