Cloudflare operates authoritative DNS services for tens of millions of domains, ingesting an average of 700 record modifications per second worldwide. While a typical domain consists of fewer than a dozen DNS records, large enterprise zones frequently contain upwards of 20 million distinct records. Historically, Cloudflare's compilation pipeline was monolithic: whenever any record within a zone was added, modified, or deleted, the pipeline recompiled the entire zone into a compressed binary artifact before broadcasting it to edge datacenters worldwide.
For multi-million-record zones, recompiling the entire dataset on every change placed intense strain on build workers. Recompilations consumed as much as 79 GiB of RAM per worker and took several minutes to complete. When automated deployment pipelines or customer API scripts submitted rapid batches of record modifications, build queues quickly backed up, causing 99th-percentile propagation delays to spike to 14.6 minutes.
To eliminate the compilation bottleneck, Cloudflare's DNS engineering team designed a Targeted Zone Build planner that inspects incoming change diffs and classifies them into five distinct execution paths: Resources Only (accounting for 86.81% of changes), Resources plus Metadata (2.54%), Apex plus Metadata (2.30%), Purge (1.30%), and Full Zone Builds (7.04%). By routing updates into granular, targeted workflows, the pipeline completely avoids full-zone recompilation for 92.95% of incoming mutations.
Production telemetry demonstrated substantial improvements across all key infrastructure metrics. Peak worker memory usage dropped by 85%, falling from 79 GiB to 12 GiB, stabilizing memory consumption and preventing container restarts. Median propagation delay across the global edge network was reduced by more than half, falling from 7.7 seconds to 3.3 seconds.
Crucially, the 99th-percentile tail latency collapsed from 14.6 minutes down to 1.21 minutes—a 12-fold reduction that ensures rapid configuration propagation even during massive programmatic API batch jobs. To verify that targeted builds introduced no correctness regressions, Cloudflare built a DNS Mirror Dashboard that compared production query responses from both the legacy and targeted compilers, finding an identical response rate of 99.69%, with the remaining 0.31% difference attributable entirely to standard TTL clock drift.