Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Cloud

65x more databases in two years: how Cloudflare scales the D1 control plane

Cloudflare explains how D1 splits data and control planes: KV as a durable store, idempotent retries and per-account caching.

Cloudflare D1

Live Cloudflare D1 databases grew 15-fold in one year and 65-fold in two, according to figures from October 8, 2026. The cause is a shift in patterns: AI-assisted development platforms create many small databases, one per user, app or preview environment, instead of one or two large clusters. On October 13 Cloudflare explained how it redesigned D1's control plane to handle millions of databases, and the post is a list of multi-tenant architecture decisions every team runs into sooner or later.

The problem

Each D1 database is backed by a Durable Object with SQLite. With millions of databases, any operation that depends on a central component (creating a database, resolving where it lives, computing storage limits) becomes a bottleneck or a single point of failure.

The solution: three planes with different rules

Cloudflare splits operations into three planes:

  • Data plane: queries. They must be fast and always resolve at the edge.
  • Control plane: the HTTP API and internal workflows. It can depend on central components in a single region.
  • Async plane: analytics and billing, eventually consistent.

Each database's ID and metadata live in Postgres (the "creation checkpoint") and the mapping is replicated to Workers KV, used as a durable store and not just a cache. On the hot path, the Edge API Worker looks the mapping up in KV, falls back to Postgres replicas via Hyperdrive only on a miss, and forwards the query to the Durable Object through an Eyeball Worker. With Worker bindings, the lookup isn't even needed.

The details are the most valuable part:

  • Creation is wrapped in a retry loop and each attempt uses a new ID, so two Durable Objects never claim the same database.
  • Each Durable Object sends a heartbeat to the control plane every 30 seconds, with per-database jitter. It drives reconciliation: orphans are marked deleted and KV gets corrected over time.
  • Storage limits (5 GB per account on the free plan, 1 TB on Workers Paid) aren't computed with a scan: deltas go into a table and a job running every second aggregates them, avoiding lock contention on large accounts.
  • Free-plan row limits are computed from usage events in ClickHouse; once exceeded, a key is written to Quicksilver that expires at the end of the day, and Durable Objects reject queries at the edge.

Lessons for your multi-tenant services

  • Retry with fresh identifiers. A retry that reuses the ID can leave duplicate state; one with a new ID, plus periodic reconciliation, converges on its own.
  • Know whether your cache is disposable. If KV were only a cache, a full purge with a million databases could trigger a metastable failure. The useful question for any system is what happens if you flush the cache all at once.
  • Pick the right key granularity. Putting the database ID in Hyperdrive's cache key would have sunk the hit rate; with per-account keys, almost every heartbeat hits.
  • Short transactions. Don't hold a Postgres transaction open while a Durable Object initializes, because the connection would stay open across continents.
  • Aggregate incrementally. Limits and counters are computed outside the request, not with scans on the hot path.

And one recommendation from the post itself: load test at a volume above your expected growth, because it's the only way to see these problems before your users do.

What doesn't transfer

KV, Quicksilver and Durable Objects are Cloudflare pieces. What carries over to any platform are the patterns: separate planes, reconcile instead of hoping everything succeeds, and take anything that depends on a single region off the hot path.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗