FOR PEOPLE BUILDING WHAT'S NEXT✳
VOL. 1 · NO. 1 DECEMBER 04, 2026
THE TREND TIMES
Signals, Not Noise.
Join ↗
DEV TOOLS

Cloudflare DNS Builds: The Smallest Safe Rebuild at Scale

A DNS change reaches the edge through Kafka, a planner and Quicksilver. Here is how five build types, soft commits and a mirror keep it safe.

BY THE TREND TIMES EDITORS
Cover card for "Cloudflare DNS Builds: The Smallest Safe Rebuild at Scale", a Dev Tools briefing from The Trend Times

Consider a customer who turns off Universal SSL on a zone holding more than 20 million DNS records. One setting changed. Under the old design, that toggle could make the system read, encode and compare every record, with the whole zone held in memory. For the largest zones, that build never finished.

If you turn database rows into edge data, you know this trap. Rebuilding everything is safe by default, but it scales with your biggest customer, not with the change.

Cloudflare described its way out on 2026-11-02 (Cloudflare). Over 24 hours, 92.95% of builds avoided rebuilding the complete zone. Below come the components, the path of one change, the build types, the failure modes and the trade-offs, with an eye on what transfers to your own system.

Why Full DNS Rebuilds Stopped Scaling

In 2022 the Zone Builder received about 250 DNS record changes per second. It now receives about 700, nearly three times as many, plus about 100 other events such as zone setting changes (Cloudflare). The real problem was work that grows with zone size. Some zones hold more than 20 million records, and Cloudflare expects growth toward hundreds of millions.

A full build reads the zone and its settings, reads every record, converts records into Quicksilver keys, compares them with stored keys, then removes stale keys and writes changed ones (Cloudflare). The final write holds only changed keys. But the read, encode and compare steps keep the whole zone in memory, and zones with tens of millions of records don’t fit.

In 2022 one full build of a one-million-record zone took up to 35 seconds, mostly database query time, and slowed other zones and services sharing the database (Cloudflare 2022).

The Components Between a DNS Change and the Edge

Eight parts matter here, all named in the 2026 post (Cloudflare).

  • DNS Records API and dashboard. Where customers edit records. Other services change zone settings directly.
  • Database. Stores every change. Read-only replicas serve build reads.
  • Kafka. Carries change events.
  • DNS Kafka Aggregator. Combines events from several Kafka topics.
  • Zone Builder. Holds the planner (what to build) and the unified scheduler (when).
  • Quicksilver. Cloudflare’s distributed key-value store, holding record keys and shared metadata keys.
  • Authoritative DNS servers. Answer queries from Quicksilver keys.
  • Mirror Zone Builder. A copy that writes to a Quicksilver with no customer traffic.

A record key holds the DNS answers for one zone and one name. A smaller shared metadata key tells servers how to use the zone, including where nameserver and wildcard records sit.

How One DNS Change Travels to Quicksilver

The path runs in six steps (Cloudflare):

  1. A customer edits a record through the API or dashboard, or a service changes a zone setting.
  2. The database stores the change.
  3. The database change, or another system, produces a Kafka event.
  4. The Aggregator combines events from several topics and sends them to the Zone Builder.
  5. The Zone Builder reads the zone data it needs and converts it into keys.
  6. It compares those keys with Quicksilver and writes only what changed. Quicksilver spreads the change across the network.

The 2022 version ran API, database, Kafka, Zone Builder, Quicksilver, network (Cloudflare 2022). The new stage is the Aggregator. Besides merging topics, it holds events long enough for database replicas to catch up, a job that returns in the failure modes.

Making Events Say What Changed

A targeted build must answer three questions: which names can change, whether shared metadata or the published-zone list can change, and what old state must leave Quicksilver.

Record events already named the record. Zone events didn’t. Cloudflare changed the event producer to carry changed zone fields and settings, with previous and new values when available, then traced each setting through the DNS output code (Cloudflare).

Some database functions only update a timestamp, meaning “something about this zone changed.” Until the team finds the caller, a timestamp-only update triggers a full build. So do missing details, unknown events and changes that may touch records anywhere in the zone. In the post’s words, “The planner never turns uncertainty into less work.”

Five Build Types and the Smallest Safe One

The planner picks one of five build types (Cloudflare):

  1. Resources only. Rebuild records at specific names, metadata untouched. Ordinary A, AAAA, TXT and CNAME changes usually land here.
  2. Resources and metadata. Specific names plus shared metadata, for nameserver and wildcard changes.
  3. Apex and metadata. The zone apex, the bare domain such as example.com, plus metadata. Settings like Universal SSL can use it.
  4. Purge. Remove a zone that should no longer be published.
  5. Full zone. Rebuild every record when smaller work can’t be proven safe.

Universal SSL needs the apex type because toggling it updates metadata and can change Certification Authority Authorization (CAA) records at the apex. CAA records tell certificate authorities whether they may issue certificates for the domain.

One rule governs all five. Every key a targeted build writes must be byte-for-byte identical to what a full build would write. If the team can’t prove that, it runs a full build. Stale keys under each rebuilt name get dropped, as in 2022.

When One DNS Name Means Several Zones

Quicksilver stores each zone’s record keys separately, plus one metadata key shared by every Cloudflare zone with the same domain name (Cloudflare). That key works like a directory: it lists the internal zone IDs servers may use to answer a query.

During onboarding, offboarding and other lifecycle changes, multiple zone objects can briefly exist for one domain. A priority policy publishes a small, bounded set. A TXT change in one of them touches only its record keys. A nameserver or wildcard change also touches the metadata key.

Two habits keep the directory honest. The Zone Builder rebuilds the whole metadata key from a fresh read of the zone list instead of patching the old copy. And it writes the triggering zone’s records before the metadata that points to them.

Planning Twice and Checking the Replica

An event describes the past, and a queued build may wait while the database moves on. So planning happens twice (Cloudflare). The event first yields a conservative work list. Right before execution, the Zone Builder reads a fresh publication snapshot: current settings, whether it should publish the zone to its network, and which same-name IDs belong in the metadata key.

A network is one isolated Quicksilver copy, such as the China Network. Fresh state can change the plan four ways:

  1. A targeted build escalates to a full build if the zone now needs complete-zone work.
  2. A build becomes a purge if the zone should no longer be published to this network.
  3. A build is skipped if the triggering zone no longer belongs in the metadata key.
  4. A metadata build reconstructs the shared key from the current candidates.

The fresh read hits a replica so builds don’t compete with customer writes. But Kafka delivery and database replication move independently, so an event can arrive before its change reaches the replica. The Aggregator delays events to cover normal lag, and a final database check rejects the read if the replica is still behind.

Failure Modes in the DNS Build Pipeline

Five failure modes shaped the design, all documented in the 2026 post (Cloudflare) unless noted.

A full build that can’t finish. It holds every database record and Quicksilver key for the zone in memory, and the largest zones don’t fit. While it retries, it holds back every other change on its Kafka partition. So above a fixed record-count threshold, the Zone Builder never escalates. It rebuilds the apex, the metadata and every name the queued events identified. Rare leftovers, like enabling a zone on another network, get manual name-by-name rebuilds.

A commit that runs ahead of the work. Kafka splits topics into partitions, and a consumer reads each partition in the order events were written (Apache Kafka). Cloudflare keeps one committed offset per partition, the point before which every message is done. If a slow message 2 is still running, messages 3 through n can’t commit, and a restart replays 2 through n (Cloudflare). The team “deliberately” chooses repeated work over losing a change.

That technique, soft committing, comes from Cloudflare’s secondary DNS work: keep messages sorted by offset, drop each as it completes, and commit only when the finished one is the oldest (Cloudflare 2020). It only works across consumers when messages are keyed by zone ID, so one zone always reaches one consumer.

Two schedulers writing one key. Same-name zones share a metadata key. On different schedulers, both could write it. Rollout hashed the zone name, not the ID, so every zone sharing a name landed on one scheduler.

An event that outruns its data. The Aggregator delay and replica check above cover replica lag.

Tests that miss real combinations. No suite reproduces every customer setup, which is why the mirror exists.

How the Team Proves a Smaller Build Is Safe

Three layers sit between a planner rule and production (Cloudflare). Equivalence tests for the nameserver, wildcard and apex paths run a full and a targeted build from the same database state, pin time-dependent values, and compare every Quicksilver key the targeted plan owns byte for byte.

During rollout, a full build also ran beside every targeted build until the mirror gave the same confidence.

The mirror Zone Builder reads the production Kafka stream and database but writes to a separate Quicksilver (Cloudflare). A comparer checks a 20% sample of zones for missing keys, extra keys and different values. The two sides don’t build at the same instant, so the team looks for new kinds of difference that survive once both catch up.

A dashboard on a Worker, with Durable Objects for state and Cloudflare Access in front, groups those differences. Its screenshot shows a 0.31% diff rate across 234,313 matched zones (Cloudflare). Rollout then went by zone-name hash, free zones first, then paid.

The Results in One Day of Builds

Over 24 hours, builds split 86.81% resources only, 2.54% resources and metadata, 2.30% apex and metadata and 1.30% purges (Cloudflare). Together, 92.95% skipped a complete-zone rebuild. Full builds were the other 7.04%.

The two metadata types used to be full builds, even for large zones, and now make up 4.84% (Cloudflare). Add the 7.04% still full and you get 11.88%, so full builds fell by about 40%. The ones left average 0.35 seconds, since they mostly hit small new zones on first publication.

Consumption used to swing between about 300 and 1,550 messages per second while production sat near 600 to 800; now it tracks production in that band (Cloudflare).

Build completion delay runs from a change to the finished Quicksilver write, excluding network distribution. In a side-by-side run on the same events, the worst p99 spike (the delay within which 99% of events finished) fell from 14.6 minutes to 1.21 minutes, a 12-fold cut (Cloudflare).

Average working-set memory fell from 49 GiB to 7 GiB, an 86% cut, and peaks from 79 GiB to 12 GiB, an 85% cut (Cloudflare). That headroom let the team shorten per-zone rebuild intervals on most plans and the Aggregator hold time, halving median delay from about 7.7 seconds to about 3.3 seconds. A later native histogram put the median near 3.4 seconds, p90 near 5.5 seconds and p99 near 12 seconds.

The Trade-Offs Behind Targeted DNS Builds

Full builds remain for first publications, zone-wide changes and vague events (Cloudflare). Five design choices sit behind that.

  1. Uncertainty buys more work. Without byte-level proof, the planner falls back to a full build. Correctness stays simple, and vague event producers stay expensive.
  2. Repeated work beats lost changes. Soft commits accept replays after a restart in exchange for never dropping a customer edit.
  3. The biggest zones give up full rebuilds. Above the threshold, a build covers only the names its events identified, which keeps partitions moving but leaves the rest of the zone alone, and rare cases fall to manual rebuilds.
  4. One scheduler merges work and grows its job. It now tracks DNS work and unacknowledged Kafka messages apart, plus rebuild intervals, zone locks and old-work exceptions.
  5. Smaller builds carry proof costs. Equivalence tests, parallel full builds, a mirror and a dashboard are the price of trusting the targeted path.

To borrow the pattern for your own pipeline:

  • Add changed fields with old and new values to your change events, and count every event without them as a full-build trigger.
  • Write one equivalence test per targeted path that builds full and targeted output from one snapshot and diffs the keys byte for byte.
  • Graph how long the oldest unfinished message holds your Kafka consumer’s committed offset, and alert when it climbs.
  • Route every writer of a shared key through one scheduler by hashing the key’s owner, such as the zone name.
  • Run a mirror consumer on the production stream into an isolated store, and compare a fixed sample of outputs before each release.

Sources

THE WEEKLY SIGNAL / EVERY THURSDAY

Signals, Not Noise.

One primary-sourced deep dive into AI agent standards and micro-SaaS every Thursday. Zero spam, ever.

Free. One email a week. Unsubscribe anytime.

ONE EMAIL A WEEKUNSUBSCRIBE ANYTIME