Optimizing High-Scale DNS Pipelines with Targeted Builds
Cloudflare updated its DNS propagation pipeline to use targeted builds and a unified scheduler, reducing peak memory usage by 85% and halving median build delays.
Cloudflare announced an architectural change to its DNS update pipeline, moving from full-zone rebuilds to a targeted build planner and unified scheduler. According to the source, this optimization reduces peak memory usage and lowers tail latency for high-volume DNS domains.
What Changed in the Pipeline
According to the source, Cloudflare replaced its legacy approach of rebuilding an entire DNS zone for every setting or record change. Instead, the system now uses a targeted build planner that selects the smallest safe build type out of five options: resources only, resources and metadata, apex and metadata, purge, or full zone. Over a 24-hour measurement period cited in the source, 92.95% of builds avoided rebuilding the complete zone.
To validate that these targeted builds matched legacy outputs, the source states that Cloudflare ran a controlled side-by-side mirror environment consuming the same production Kafka stream. A comparer tool checked a 20% sample of zones for mismatches, observing a stable diff rate of around 0.31% before full rollout.
Practical Implications for Developers
For developers building high-scale state pipelines, this approach illustrates how to avoid the computational bottlenecks of full-state scans. In a naive pipeline, a minor setting update to a large zone triggers a full-state scan that reads and encodes millions of records. By implementing a targeted planner, the pipeline evaluates the event, identifies the specific resource change, and executes a localized update instead.
As reported by the source, optimizing these pipelines yielded several performance metrics:
- Memory Reduction: Average working-set memory for the Zone Builder deployment fell from 49 GiB to 7 GiB, while peak memory dropped from 79 GiB to 12 GiB.
- Tail Latency Improvements: The largest p99 build completion delay dropped from 14.6 minutes down to 1.21 minutes.
- Median Delay Reduction: Median build completion delay dropped from about 7.7 seconds to about 3.3 seconds.
Limitations of Targeted Builds
While targeted builds reduce resource consumption, the architecture includes explicit boundaries and fallbacks:
- Uncertainty Fallbacks: The source notes that if an event timestamp is ambiguous, metadata is missing, or an event does not explicitly state what changed, the planner defaults to a full zone build. The system never converts uncertainty into reduced work.
- Requirement for Full Builds: Complete zone rebuilds remain necessary for specific scenarios, such as initial zone publication or changes that globally impact records across an entire zone.
- Measurement Boundaries: The source specifies that build completion delays measure the time until data is written to Quicksilver; they explicitly do not include subsequent propagation time across the global edge network.