Durable Objects
Studies in this cluster, in series order. Each one keeps its own URL.
Distributed systems
Raft consensus, replication, consistent hashing, saga-style distributed transactions, two-phase commit, and conflict-free replicated data types.
Durable Objects
6 studies- 1.Cloudflare Durable Objects - Single-Instance Actors, Edge State & When to Use ThemHub: a Durable Object is a single-threaded actor with its own SQLite, one live instance per ID worldwide; routing with getByName/idFromName/newUniqueId, stubs and RPC; DO vs KV, D1, R2, Queues, Redis, Postgres row locks, Orleans and Akka with a decision chart; runnable routing simulation; what happens if you pick the alternative.
- 2.Durable Objects Storage - SQLite vs Legacy KV, Transactions, Write Coalescing & Point-in-Time RecoveryStorage: SQLite backend vs legacy KV, SQL API, sync KV API, transactionSync, write coalescing, in-memory cache, allowUnconfirmed/noCache, PITR bookmarks with ctx.abort, limits quoted from docs; output-gate and PITR simulations; storage decision chart.
- 3.Durable Objects Concurrency - Single Thread, Input & Output Gates, blockConcurrencyWhile & the Races That RemainConcurrency: single thread plus input and output gates, where interleaving still happens (fetch, timers, other objects), blockConcurrencyWhile cost, the external-call oversell race reproduced under wrangler dev (reserved 6 of 3) and fixed with claim-first and version check.
- 4.Durable Objects Real-Time - WebSocket Hibernation, Alarms, Chat, Presence & Collaborative EditingReal-time: WebSocket Hibernation API (acceptWebSocket, tags, attachments, auto-response), real chat room with presence and history, alarms, collaborative editing via CRDT or server ordering, fan-out batching and backpressure, hibernation cost math ($20.65 vs $420.65 docs example), transport decision chart.
- 5.Durable Objects Scaling - Sharding by ID, Hot Objects, Location Hints, Limits & CostScaling: per-object throughput soft limits, sharding by ID, hot objects and sharded counters, location hints and jurisdictions, cold starts and eviction, pricing; real rate limiter, lease with fencing token and counter run under wrangler dev; shard sizing and global-vs-per-key simulations.
- 6.Durable Objects in Production - Resets, Deploys & Class Migrations, Observability, Testing & Interview Q&AProduction: failure catalog (deploys, eviction, write failure resets, blockConcurrencyWhile throws, overloaded vs retryable errors), version skew, declarative exports class lifecycle (create, rename three-deploy alias, transfer, delete), at-least-once alarms, observability, testing with @cloudflare/vitest-plugin (4 real passing tests), interview Q&A.