Analysis & Intelligence

Cloudflare Reworks D1 Control Plane for Million-Database Scale

Cloudflare Reworks D1 Control Plane for Million-Database Scale FAYFO Media © fayfo.com
Cloudflare Reworks D1 Control Plane for Million-Database Scale © fayfo.com
Daily active D1 databases have grown 18-fold. Cloudflare separates edge queries from centralized management and uses asynchronous updates and health checks to keep failures from disrupting routing or metadata.

Cloudflare says daily active D1 databases grew 18-fold over a year. D1 is a serverless SQL database built on SQLite and integrated with Cloudflare Workers. Its redesigned control plane separates query traffic from centralized systems that track database metadata and account limits, aiming to avoid bottlenecks as the service scales.

The architecture gives each system a distinct job. Postgres is the source of truth for transactional metadata and database existence. ClickHouse handles analytics, while Workers KV stores globally replicated routing data. That separation keeps database queries out of Postgres.

A request passes from an Edge API Worker through an Eyeball Worker to the relevant D1 Durable Object. The Edge API Worker handles authentication, authorization, rate limiting and request validation. The Eyeball Worker trusts the database-specific authorization encoded in D1 Bindings, so the query path avoids repeating those checks.

Failures in database creation or deletion are handled through reconciliation. Every 30 seconds, with jitter added per database, a heartbeat checks each D1 Durable Object against Postgres. If an operation leaves an orphaned object, the heartbeat can mark it deleted. It can also repair Workers KV routing metadata when a best-effort update fails.

David Laban, a full stack software engineer at Cloudflare, and Lambros Petrou, a principal engineer at Cloudflare, write in Cloudflare’s article: “Heartbeats can tolerate slightly out-of-date data, meaning they can be served by Hyperdrive’s multiple caching layers or by a Postgres read replica. This heartbeat flow enables the Durable Object to self-correct to reflect the source of truth (Postgres) regarding the creation and deletion of databases.”

Workers KV also keeps routing reads away from Postgres during cache misses. Laban and Petrou explain: “You might also wonder why we use Workers KV when we already have Hyperdrive Caching. Workers KV is a durable datastore, not just a cache: if an item falls out of KV’s edge cache, the read is served from KV’s own storage rather than Postgres, keeping Postgres out of the data plane. In a catastrophic cache purge scenario, a million databases trying to fetch their routing information would lead to metastable failures.”

Storage enforcement uses a separate asynchronous workflow. Usage updates are queued and batched to protect Postgres from write spikes, while incremental storage deltas maintain pre-aggregated account totals. Durable Objects check those totals through Hyperdrive’s short-lived cache and block writes that would push an account over its limit.

Cloudflare announced D1 in 2022. The serverless SQL database is built on SQLite and designed to run close to applications on the company’s global network. In a Reddit thread, user isaackogan described the design as “an in-process database running on edge storage near you” and characterized the surrounding systems as orchestration that benefits from Cloudflare’s scale. A separate popular Reddit thread included users’ concerns about D1’s reliability for production workloads; the supplied material does not establish how representative those views are. The distinction between infrastructure and demonstrated outcomes also appears in earlier SEO automation coverage, which noted that coincident visibility gains did not establish causation.

D1’s permanent free tier includes 5 GB of storage, 5 million rows read per day and 100,000 rows written per day. Paid storage costs $0.75 per GB-month; reads cost $0.001 per million rows and writes cost $1 per million rows. Cloudflare does not charge for compute or data transfer.

Paul Christiano Editor FAYFO Media
Editor

Paul Christiano

American journalist with a strong focus on AI and content technology.

You Might Also Like