How we halved DNS build delay and cut memory use by 85%
Cloudflare's DNS Zone Builder now uses a targeted build planner that picks the smallest provably safe build (resources only, resources plus metadata, apex plus metadata, purge, or full zone) and a unified per-zone scheduler that merges queued work. Zone setting changes no longer rebuild zones with tens of millions of records. The change cut peak memory by 85% and halved the time from a DNS change to its write to Quicksilver. Correctness comes from enriched Kafka events, re-planning against a fresh replica snapshot, careful handling of metadata keys shared across same-name zones, soft Kafka offset commits, byte-for-byte equivalence tests, and a mirror pipeline whose output is diffed against production.
Related posts
- Lessons Learned From Running Apache Airflow at Scale
Shopify Engineering mediumAdeptShopify runs Airflow 2.2 on Kubernetes with the Celery executor and MySQL 8, and its largest environment handles over 10,000 DAGs and 150,000 runs per day. Running at that scale meant replacing GCSFuse with an in-cluster NFS server synced from GCS, enforcing a 28-day metadata retention policy, and tracking ownership through a per-environment namespace manifest. That manifest feeds a cluster DAG policy that restricts queues, pools and Kubernetes namespaces. To smooth load spikes, Shopify uses deterministically randomized crontab schedules hashed from dag_id and manages contention with pools synced from a ConfigMap, priority weights and isolated Celery queues.
- FOQS: Making a distributed priority queue disaster-ready
Meta Engineering mediumAdeptMeta's FOQS distributed priority queue moved from isolated regional installations on semi-synchronous replicated MySQL to a single global installation, after Hurricane Florence in 2018 exposed manual traffic rebalancing and items stuck on unreachable shards. The global design uses Shard Manager so a queue node in the new region takes over a MySQL primary within seconds of failover. A routing service maps logical region preferences to shards for enqueue and keeps a heap-based cache of nodes with ready items for dequeue. Migrating the Async platform required parallelizing cache replenishment, which nearly halved its latency, and randomizing selection among top-priority nodes to fix thundering herd and starvation. The 2021 migration finished with zero downtime using shadow load testing, config-based rollouts and health dashboards.
- London Meetup Report: How Cloudflare Processes Hundreds of Millions of Rows per Second with ClickHouse
ClickHouse easyNovice
Cloudflare runs more than a thousand active ClickHouse replicas ingesting hundreds of millions of sampled rows per second. The deployment powers HTTP/DNS analytics, bot management, Workers runtime analytics, customer dashboards and Radar. Its 184 dictionaries consumed over 15 TiB of memory, with the largest above 20 GiB. Switching from the 'hashed' to the 'hashed array' layout cut that footprint by over 4x. A ClickHouse Dictionary Dumper builds dictionary bundles in Kubernetes cronjobs and ships them via object storage, decoupling replicas from load on upstream systems.
- Slack’s Incident on 2-22-22
Slack Engineering mediumAdeptA Consul agent rolling restart caused Mcrib, Slack's memcached control plane, to replace and flush cache nodes, dropping hit rates during peak traffic. A cache-fronted Group DM membership query hit a Vitess keyspace sharded by user, so every miss became a scatter query across all shards. Database load grew superlinearly, queries timed out, caches couldn't refill, and client retries kept the system stuck in a metastable cascading failure. Recovery required throttling client boots, fetching only missing keys, reading from replicas and later moving the query to a channel-sharded table; Mcrib's very efficiency at replacing nodes increased cache churn and worsened the outage.
- Building Self-driving Kafka clusters using open source components
Slack Engineering mediumAdeptSlack standardized roughly 10 Kafka clusters (0.7 PB, 6.5 Gbps peak) onto Kafka 2.0.1 and automated their operation with Chef, Terraform ASGs, Consul-assigned Zookeeper IDs, Cruise Control, Kafka Manager and a Prometheus offset exporter. Hot spots were removed by making partition counts a multiple of broker count, balancing consumers, throttling replication bandwidth and moving partitions in small batches. Chaos testing with dark traffic showed recovery was limited by packets per second, which jumbo frames helped address. It also motivated a dedicated Zookeeper per Kafka cluster and a cut-over upgrade policy instead of in-place upgrades. Splitting the largest topics off a saturated 90-broker cluster onto d3en instances gave about 2.5x efficiency, cut worst-case log latency from about 1.5 hours to 3-4 minutes, and reduced monthly alerts from 71 to 9.