Cloudflare has added experimental workerd clustering, so teams can spread Workers and Durable Objects over several machines they own. Until now, workerd (the open-source engine under Cloudflare Workers) mainly served local development. A single instance handled everything and kept its data on one local disk.
What changed in workerd
Multiple workerd instances can now join together and share one object storage bucket. That bucket has to support conditional writes, which Cloudflare R2, Amazon S3 and Google Cloud Storage do.
The SQLite database behind each Durable Object is stored in the bucket. Instances rely on conditional writes to elect a single leader for every object, so no separate consensus service is involved. A request can land on any instance, which passes it along to the leader.
To scale, you start one more instance pointed at the same bucket. When an instance dies, a different one picks up its objects, and writes that were already acknowledged are not lost.
What teams can build
- Stateful AI agents, each backed by a Durable Object with SQLite memory and alarms. Agents that sit idle are dropped from memory while their state remains in the bucket.
- Real-time apps, where a chat room or shared document gets a SQLite database of its own and nothing needs a common database or message broker.
- Coordination tools like locks, counters and job schedulers, each living in one Durable Object that all instances send traffic to.
Self-hosting also lets workloads run in a VPC, on Kubernetes or on-premises servers, close to internal systems and inside data residency rules.
Why object storage doubles as the coordinator
Most distributed systems lean on a separate service to decide which node owns which piece of state. workerd skips that. The bucket holds each object’s database, and a conditional write is the tiebreaker: only one instance can win the write, so only one becomes leader for that object. Everyone else forwards requests to it.
The result is a short list of moving parts. You run workerd instances and one bucket. There is no broker to patch and no database cluster to size for the objects. The trade is that your bucket must support conditional writes, which is why the supported list names R2, S3 and Google Cloud Storage.
Config and setup
workerd can now load wrangler.json and wrangler.jsonc itself. A Workers project that sticks to the supported keys should run on your own servers with no edits. Support for worker.config.json, using the schema the cf command writes, is planned to replace wrangler.json.
You launch a project with the workerd serve command through npx, yarn or pnpm. Docker and Kubernetes users get a docker.io/cloudflare/workerd image with each release, built for linux/amd64 and linux/arm64. It ships without esbuild, so the config needs “no_bundle”: true and a main file that is an ES module bundled ahead of time.
Clustering requires the –experimental flag. Every instance gets the shared bucket, a shared cluster key of at least 32 bytes, and an address of its own. With R2 or S3, you supply AWS_ENDPOINT_URL, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as well.
More of the Cloudflare stack in one binary
Previously workerd handled only Workers and Durable Objects on its own. Anything touching D1, Workflows or other services required Miniflare and Wrangler. More of the platform is now built into the single workerd binary. Like clustering, those built-in services need –experimental.
There are gaps. Inside a cluster, KV and Queues still call for a Cap’n Proto setup in config.capnp, with wrangler.json support to follow.
The security caveat
Cloudflare says a cluster should host one application whose code you trust, and describes workerd as no hardened sandbox. Cloudflare points to its security documentation for details.
What happens next
Early workerd clustering is a feedback exercise more than a finished product.
Cloudflare calls this an early, experimental release meant to gather feedback. People who try workerd clustering are asked to file issues in the cloudflare/workerd repository on GitHub. Expect the configuration to move toward worker.config.json and for the list of limitations to shrink as more services gain wrangler.json support. Teams weighing a self-hosted setup should test with non-critical workloads first, since the experimental flag signals the behavior can still change.
Source: Cloudflare Docs