LayerDispatchEvidence-led systems publishing
Skip to article content

2026-10-18T07:08:27Z

A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge.

Under the hood, off the hot path: How D1 scales to millions of databases A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge. We share guiding principles on how to build on the Developer Platform effectively.: Research context

A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge. While building out the D1 control plane to support millions of databases, the following tenets and principles were guiding our architecture decisions and are useful for anyone building their control and data planes on our platform. The question becomes: how do you scale the control plane for millions of databases without making every query slower by sending it through centralized bottlenecks? This post is a behind-the-scenes deep dive into how the D1 control plane works. Write the mapping from a database ID to the Durable Object ID in Workers KV (later used by the data plane and the query endpoints). In terms of operations, we fold each operation into one of the following categories: Data plane: any database query related request; should be as fast as possible and always at the edge. Heartbeats for self-correcting databases Each D1 Durable Object periodically heartbeats the control plane to get the latest database state (active or deleted) and account limits (more on this in the enforcement sections later). Each D1 Durable Object periodically checks Quicksilver at the edge to find out whether its account has been limited, and in case it is, they reject any future query execution until the limit is lifted. Avoid centralized single-region components in any hot path for data plane operations (in our case all query requests). Decoupling the hot path: keeping queries off the central database The key principle for query endpoints is to avoid talking to Postgres or any other centralized single-region component. Control plane: any HTTP API operation or internal flows that run in response to a non-query user request; they can depend on central single-region components. Conclusion The D1 architecture is designed around separating control plane concerns from hot-path query execution. 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. Use Hyperdrive to access central Postgres databases for efficient connection pooling and optimized routing and caching, using read replicas wherever possible. Each decision follows our guiding principles: reducing central regional bottlenecks, using caching and read replicas along with eventual consistency when possible to scale out read throughput, and choosing the right data store for each job: Postgres for transactional metadata, ClickHouse for analytics, and

Key findings

Workers KV for globally replicated routing data. The guiding principle here is that we use a queue to smooth out and batch writes to our central regional Postgres data store. The Edge API Worker forwards control plane requests to data centers near our Postgres cluster for endpoints that do multiple round-trips to Postgres (step 2), and the “create database” endpoint is one of them. The CRUD endpoints use Hyperdrive to query a Postgres cluster in our central data centers (referred to as “Core”). Edge API queries our Postgres read replicas over Hyperdrive with caching enabled (with cache TTL of a few seconds) to get the number of non-deleted databases for the given account. Each query request over HTTP executes our Edge API Worker close to the original user request location, and then goes straight to the D1 Durable Object via the Eyeball Worker. The D1 Durable Object executes the SQL query and returns the result through Eyeball Worker to the Edge API Worker, which returns it back to the user. The queue consumer system runs inside Cloudflare’s central data centers (“Core”), whereas the Durable Objects themselves are spread everywhere in the world at the edge. D1 has seen a 15x growth in the number of live non-deleted databases over the past one year, and a 65x growth over the past 2 years (as of October 8, 2026). We have also seen 18x growth in the number of daily active databases over the past year (as of October 8, 2026). 5 million databases and has seen a 15x growth in the number of live non-deleted databases over the past one year, and a 65x growth over the past 2 years (as of October 8, 2026). For accounts with millions of active databases, an account-based cache key means that most of the heartbeats use the same cached account information from Hyperdrive and never reach Postgres. The post also gives a glimpse into how we build our own control planes. The database from that point on is included in all the control plane operations and can be bound to a Worker to serve queries. Within 30 seconds, DO A sends its next heartbeat to the control plane and receives back a response that its database does not exist. This doesn’t scale for accounts with millions of D1 databases, like some of the agentic coding platforms built with D1. We made a lot of architectural changes to scale out D1 to support platforms with millions of created

Operational implications

databases, hundreds of thousands of which are active at any point. It allows you to create millions of databases and only pay for what you use. Use Workers KV, a globally distributed KV store, for critical routing metadata so that cache misses only rarely need to query central databases. There are more engineering principles we follow internally to build our systems, but the above are generic enough and apply to anyone building on Cloudflare. If you are building applications on Workers and the Developer Platform, the patterns and trade-offs covered here reflect real decisions made for D1. Guiding engineering principles Applications built on the Cloudflare Developer Platform range from full-stack applications to service APIs, from internal single-user portals to massive multi-tenant vibe coding platforms, and everything in between. Many of the architectural patterns we will describe can be used by anyone building on top of Cloudflare’s Developer Platform. AI-assisted development and vibe coding platforms turn this model inside out and are driving applications toward many small databases: one per user, application, preview environment, or tenant. Someone building on the Developer Platform can use Workers KV Instant, which is built on top of Quicksilver. We share guiding principles on how to build on the Developer Platform effectively. First of all, each D1 database is backed by one SQLite Durable Object, which makes it very easy to create millions of them. Growth in numbers There was already a steady growth in D1 usage when we started planning these changes, but we knew we would need to support a much bigger scale once large platforms started building with D1. A database is considered active if it executed at least one query during that day. The following sections will dive into the main system components and processes of the D1 control plane regarding the lifecycle of a D1 database, and showcase how to put these principles into practice with a real-world system. This schema design is a pattern used by many other Cloudflare teams, and it lets us scale to millions of resources per account without each additional resource making common operations more expensive. The cost of this query scales linearly with the number of databases on each account. The diagram shows the HTTP endpoints that allow users to execute SQL queries against their databases as the “Query endpoints”. The control plane does not need to process every update synchronously: it is fine if a load spike is not reflected immediately and our usage information is stale.

If you are building applications on Workers and the Developer Platform, the patterns and trade-offs covered here reflect real decisions made for D1.

Read the original sources cited in the article for the full material.

Frequently asked questions

What does the collected research say about Under the hood, off the hot path: How D1 scales to millions of databases A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge. We share guiding principles on how to build on the Developer Platform effectively.?

A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge.

What are the key details from Cloudflare Blog?

A deep dive into how D1 architected its control plane to scale and manage millions of databases, while keeping data plane query operations at the edge.