People compare Cloudflare with a VM as if the choice were about where to run the same server. For the systems I build, that's the wrong comparison.
A VM is a good fit when the application is shaped like a server: a long-running process, a local runtime, predictable network dependencies, and state held by a database or the process itself. I still use that model where it fits, including some ML services.
But the products I keep building are shaped around entities that need coordination: a live match, a browser session, an organization, a scheduled workflow, an autonomous test run. For those, the useful question isn't “which machine runs the handler?” It's “which object owns this decision?”
Make the domain noun the coordination unit
SkipChat has lobbies, matches, reveal decisions, timers, signaling, and disconnect handling. A test run has a snapshot, a browser session, evidence artifacts, retries, and a terminal result. These objects have lifecycles. They aren't just rows a request returns.
Durable Objects are useful because a named object gives one coordination unit a single serialized execution context. The object can own live connections, validate transitions, schedule alarms, and persist whatever it needs to resume.
flowchart LR
Request["HTTP request"] --> Router["Worker router"]
Router --> ObjectId["Derive coordination key"]
ObjectId --> Object["Durable Object instance"]
Object --> State["Object state and SQLite"]
Object --> Events["Queues / Workflows"]
Object --> Records["D1 durable records"]Not every entity should become an object. The point is that the entity with serialized decisions finally has a place to live.
What a state owner should do
A good state owner has a narrow command surface:
type MatchCommand =
| { kind: "join"; participantId: string }
| { kind: "offer_reveal"; participantId: string }
| { kind: "accept_reveal"; participantId: string }
| { kind: "skip"; participantId: string }
| { kind: "disconnect"; participantId: string };
type MatchResult =
| { kind: "accepted"; events: MatchEvent[] }
| { kind: "rejected"; reason: string };The object validates the command against current state, applies one transition, persists what it needs, and emits events for the rest of the system. Callers don't update several tables and hope the result is coherent. That's a stronger boundary than a distributed lock around a pile of rows — a lock protects a critical section, but a state owner also defines which commands are legal and which transitions mean something.
What changes versus a stateless service
In a conventional service, each request rebuilds enough context from a database, cache, queue, and convention to make a decision. That can scale well, but the coordination logic ends up spread across the whole system.
With a Durable Object, the coordination logic sits next to the state it governs:
- WebSocket attachment and detachment
- participant membership
- timers and expiration
- state transitions
- per-entity rate limits
- idempotency for commands
- notifications to connected clients
The database still matters. D1 holds durable product records, configuration, moderation history, and reporting data. The object isn't a replacement for a relational database — it's an owner for live coordination.
The trade-offs are real
Durable Objects don't make distributed-systems problems disappear. They make one class of problem more explicit.
Concern | Design question |
|---|---|
Object key | What is the right unit of serialization? |
Hot object | Can one entity get more work than one object should handle? |
Cross-object transaction | Can the operation be made asynchronous or idempotent? |
Recovery | What state is required after eviction or restart? |
Durable history | Which records must outlive the live object? |
External effects | How are retries and duplicate deliveries handled? |
An object key that's too broad creates a bottleneck. One that's too narrow recreates coordination in shared storage. The domain model has to answer the question.
Latency is product behavior
The edge argument isn't only “closer is faster.” For live systems, latency and coordination are part of the experience. A delayed reveal, a stale match, a duplicated notification, a signaling message routed to the wrong peer — those are product defects.
Keeping the request handler, the coordination object, and the durable state close together cuts down the distributed choreography those decisions need. It doesn't erase network latency to every dependency, but it gives the core lifecycle a smaller, more inspectable path.
Where I wouldn't use it
I wouldn't force Durable Objects onto a workload that's naturally batch-oriented, compute-heavy, or already well served by a conventional service. ML inference, large analytical queries, and anything needing a single global transaction usually want other infrastructure.
I also wouldn't reach for an object just because the platform offers one. The object should map to a real ownership boundary. If no domain entity needs serialized decisions, a stateless Worker and a database are simpler.
The architectural decision
The question was never whether Cloudflare replaces a VM. It's whether the platform lets the deployment model match the product model. For real-time and agentic products, I want the match to own the match, the run to own the run, and the organization to own organization-level decisions. That alignment turns infrastructure primitives into domain boundaries, and it makes the failure modes far easier to reason about.