Get comfortable with stateful edge coordination using Durable Objects.
0 / 5 completed
1 / 5
At standup, the team needs a single coordinated, stateful instance per chat room at the edge. What fits?
A Durable Object instance provides a single-threaded, addressable, stateful object ideal for coordinating per-room state. Cloudflare guarantees one active instance per id globally. This gives strong consistency that plain Workers or KV cannot.
2 / 5
During a PR review, a dev persists state inside a DO. Which API do they use?
Durable Objects expose a built-in transactional storage API (state.storage) for durable key-value persistence local to the object. Reads and writes are strongly consistent within the instance. This is how a DO retains data across requests and restarts.
3 / 5
In a design review, the team wants a DO to wake itself up later to do work. Which feature enables this?
The alarm API lets a Durable Object schedule a future wake-up by setting an alarm timestamp via storage.setAlarm. When it fires, the runtime invokes the object's alarm() handler. This supports timers and delayed processing without an external scheduler.
4 / 5
An incident report shows idle WebSocket connections kept the DO billed continuously. Which feature reduces this cost?
WebSocket hibernation lets a Durable Object evict from memory while keeping WebSocket connections open, then rehydrate on the next message. This avoids billing for idle in-memory time during long-lived connections. It is the recommended pattern for many concurrent sockets.
5 / 5
During a code review, two requests target the same room id and hit the same instance. Why?
Cloudflare routes by the Durable Object instance id, guaranteeing all requests for a given id reach the same single instance. This is what enables coordination and consistent state. The id-to-instance mapping is the core guarantee of the platform.