Skip to content
News

AI insights

Cloudflare workerd Clustering: Self-Host Workers & Durable Objects

Cloudflare's open-source workerd runtime now supports experimental multi-machine clustering over R2, S3, or GCS buckets. Architecture and limits explained.

#Cloudflare#workerd#Durable Objects#Self-Hosted

Cloudflare workerd Clustering: Self-Host Workers & Durable Objects

Q. Can you run Cloudflare Workers and Durable Objects as a cluster on your own servers or VPC? Yes. With Cloudflare's December 3, 2026 release of experimental multi-machine clustering in its open-source workerd runtime, multiple instances can share a single R2, S3, or GCS bucket to run Workers and Durable Objects on your own infrastructure.

⚠️ Accuracy guardrail: This article is based strictly on Cloudflare's official December 3, 2026 Changelog and the workerd.dev documentation reviewed on December 4, 2026. Clustering currently requires --experimental, and real-world production write latencies or exact dates for wrangler.json KV/Queues cluster support are not published in the official docs.

30-second summary

  • What changed: Previously limited to single-instance local execution, workerd now experimentally supports multi-machine clustering backed by a shared R2, Amazon S3, or Google Cloud Storage bucket.
  • No consensus server needed: Instead of ZooKeeper or Raft, workerd elects one leader per Durable Object using conditional writes on object storage.
  • Expanded single binary: D1, R2, Workflows, Cron Triggers, Static Assets, and Cache API are now built into the single workerd binary under --experimental.
  • Key caveats: workerd is not a hardened multi-tenant sandbox, and inter-node cluster traffic is unencrypted—private network isolation is mandatory.

Cloudflare workerd self-hosted clustering announcement

Why workerd clustering matters now

Although workerd has been open source, storing state only on a local disk kept it mostly in local development workflows. The December 3 update lets multiple workerd instances form a single cluster over a shared object storage bucket.

Cloudflare highlights four primary use cases: running inside your own VPC, Kubernetes cluster, or on-premises servers for data residency; stateful AI agents where each agent gets a Durable Object with SQLite memory and alarms (evicted from memory when idle while state remains in the bucket); real-time chat or collaborative apps with per-room SQLite databases; and distributed coordination primitives such as locks, counters, and job schedulers.

This aligns closely with frameworks like Vercel AI SDK 7.1's durable agents that rely on persistent, recoverable agent state.

Advertisement

How bucket-backed leader election works

workerd bucket-backed clustering architecture and limitations

Without running a separate consensus service, workerd uses object storage conditional writes to elect a single leader per Durable Object and handle failover.

Every instance points to the same WORKERD_CLUSTER_BUCKET. Any instance can accept a request and forward it to the object's current leader. Adding capacity is as simple as starting another instance against the same bucket, and when an instance stops or fails, another takes over its objects without losing acknowledged writes.

However, per workerd.dev/docs/limitations, every write waits for a bucket upload, so write latency is at least the bucket's latency. Objects on a crashed instance remain unavailable until their lease expires, and existing WebSocket connections close during failover so clients must reconnect.

Q. Which object storage providers are supported? workerd supports s3:// buckets with conditional writes (Cloudflare R2, Amazon S3) and gs:// Google Cloud Storage buckets. Per the official documentation, Azure Blob Storage is not supported.

Standalone, Docker, and built-in service matrix

workerd now reads wrangler.json and wrangler.jsonc directly, and each release ships docker.io/cloudflare/workerd:latest images for linux/amd64 and linux/arm64. Because the container image omits esbuild, set "no_bundle": true and point main to a pre-bundled ES module.

workerd container usage and supported services matrix

Whereas D1 and Workflows previously required Miniflare and Wrangler, the single workerd binary now bundles most of the Cloudflare stack under --experimental.

Service Status Cluster support Notes
Workers / Durable Objects / Facets Supported Yes Core runtime
D1 / R2 / Workflows / Cron / Static Assets / Cache Experimental Yes Requires --experimental
Rate Limits Experimental Per-instance Not globally shared
KV / Queues Experimental config.capnp only wrangler.json coming soon

The minimum environment variables and startup command (requiring a cluster key of at least 32 bytes) look like this:

export WORKERD_CLUSTER_BUCKET=s3://BUCKET/PREFIX
export WORKERD_CLUSTER_KEY=your-32-byte-or-longer-secret-key
npx workerd serve --experimental . --cluster-addr 10.0.0.1:7000

Operational limits and security boundaries to check first

The official documentation calls out five constraints before adopting clusters:

  1. Trusted single-app code only: workerd is not a hardened sandbox for untrusted multi-tenant code.
  2. Unencrypted cluster traffic: Inter-instance traffic is not encrypted, so cluster ports must stay inside a private VPC or encrypted mesh.
  3. Single-threaded JS: Each instance runs JavaScript on one thread (one CPU core); scale horizontally by running more instances.
  4. Cloud-only config fields: Currently, leaving routes, observability, account_id, or workers_dev in wrangler.json halts startup (a future update will warn and ignore them).
  5. No in-memory-only DO clustering or auto-rebalancing: Only disk-backed Durable Objects join the cluster, and objects stay on the instance that activated them until that instance stops.

Toris's take

  • Worth testing right away if: You need data residency or direct private-network access for stateful AI agent backends, especially if you already pair self-hosted services with tools like Cloudflare AI Gateway.
  • Hold off for now if: Your production stack relies on wrangler.json KV/Queues bindings, zero-drop WebSockets across node restarts, or untrusted multi-tenant isolation.

Sources

Advertisement