All Concept Bites
34 views
Cloud & DevOpsintermediate

Targeted Rebuilds: Cutting DNS Build Delay Safely

Rebuild only what a config change can affect — and prove it before you skip the rest.

Reviewed by Abhijith N M · 24 October 2026 · Editorial standards

The Simple VersionNo jargon

A DNS zone is a database of records: names mapped to addresses, mail servers, verification strings. Cloudflare says that when someone changed a zone setting, its system rebuilt the whole zone — even zones holding tens of millions of records. Most of those records had nothing to do with the setting that changed. So Cloudflare built a planner. Before building, it works out the smallest set of records a given change could affect, builds that set, and skips the rest. It reports that this cut full builds by 40%, peak memory by 85%, and halved build delay. The evidence gives outcomes, not the planner's internals, so the mechanism below is the general principle, not a description of their code. The principle: a change has a dependency footprint. If you flip a setting that only affects how records are served at the edge, records that don't reference that setting can't change. Compute the footprint, rebuild inside it, keep everything outside it as-is. The hard part is proving the footprint is complete — miss one dependent record and you serve stale data. That is why the fallback matters. When the planner can't prove a change is contained — an unknown setting, a dependency it can't trace — it does the full build. Correctness first, speed second. This is analysis, not a claim about Cloudflare's design. The pattern generalizes: any system that recomputes everything on every config change (search indexes, cache manifests, compiled configs) can ask the same question. What is the smallest set I can safely rebuild, and can I prove it?

Targeted Rebuilds: Cutting DNS Build Delay Safely — Visual Breakdown

Click any step below to inspect
Zone setting changes
Planner: compute affected set
Can containment be proven?
Targeted build (subset)
Full zone build
Serve updated zone
Sequence of Events
Why It Matters in Production
Most teams hit this wall on a smaller scale: a config change triggers a full reindex, a full cache purge, a full recompile. The targeted approach pays off most where the data is large and the change is small — exactly the shape of a DNS zone with tens of millions of records. The cost is correctness risk: an incomplete dependency set means stale data served silently. So the design needs a conservative planner that returns "unknown" rather than guessing, plus monitoring on fallback rates. If full builds stay high, your planner is too cautious or your dependencies are too tangled to contain.
Implementation & Syntax
🐍Python
# Analysis: the general shape of a dependency-aware rebuild.
# Not Cloudflare's implementation.

def rebuild(changed_setting, zone, planner):
    affected = planner.affected_records(changed_setting, zone)
    if affected is None:          # planner could not prove containment
        return full_build(zone)   # correctness first
    for record in affected:
        zone[record] = build_record(record, zone.settings)
    return zone                   # untouched records stay as-is

# The planner's job is the hard part: return None whenever it
# cannot trace every dependency of the changed setting.

Quick Concept Check

Test your understanding in 15 seconds

Why does the planner fall back to a full build instead of always doing a targeted one?

Bite Progression18 / 36

Related Concepts

Complementary topics

Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.