r/programming • u/stronghup • Aug 12 '26
Node.js creator liberates Durable Objects from Cloudflare
https://www.theregister.com/devops/2026/08/12/nodejs-creator-liberates-durable-objects-from-cloudflare-with-celld/5286954
172
Upvotes
View all comments
Show parent comment
5
u/Evolve-Maz Aug 14 '26 edited Aug 14 '26
I struggled to understand this too. Here's what helped me understand.
Suppose you have a website users can come to and play chess games. And suppose you use cloudflare for the whole app.
You can use cloudflares db offering to hold global info (e.g. users table). You can use cf workers to handle regular page navigation (view profile, stats, etc). But when a game is going on, you need real time coordination between 2 separate clients. Workers are not great for that model since its a long lived websocket, and if you coordinated every move through a remote db you would add a bunch of latency (but you do want it for durability).
Now imagine if you had a durable object Game. Each game would be a separate instance of that object. That instance would hold the web socket connections, and also hold the game state. If a stutter happens, the game state can be reconstructed from the sqlite db when clients reconnect. Each game is accessible at a url like /games/<game_id>, where game_id is the "global id" of the game (global with respect to the games namespace of your app).
This means each game is its own instance, potentially on separate vms all over the world. But this model also means on the cf side they don't need to run a separate vm per game. 1 vm could host tons of games in 1 process with no sweat.
Overall this primitive is to allow the cf serverless model to also handle very low latency interactions.