New ask Hacker News story: Ask HN: Replacing Cloudflare Durable Object with Hibernate WebSocket for Hetzner

Ask HN: Replacing Cloudflare Durable Object with Hibernate WebSocket for Hetzner
6 by spxneo | 1 comments on Hacker News.
So like the title says im looking at Hetzner's 6 core, 64GB ram for running uWebsocket.js (maybe ill try Bun/Elysia for a small performance hit but tryna squeeze every bit of performance) after I learned how expensive cloudflare durable objects would be (with Hibernate) for 1 million websocket connections (sending 1 message per minute): Requests: 10,000 WebSocket connections * 100 Durable Objects to establish the WebSockets = 1,000,000 initial WebSocket connection requests. 10,000 messages per minute * 100 Durable Objects * 60 minutes * 24 hours * 30 days = 43,200,000,000 requests. 1,000,000 + (43.2 billion requests / 20 for WebSocket billing ratio) = 2,160,010,000 million requests. (2.16 billion requests - included 1 million requests) * $0.15 / 1,000,000 = $324.00. Compute Duration: 100 Durable Objects * 100 seconds * 60 minutes * 24 hours * 30 days = 432,000,000 seconds (since now each DO is active for 100 seconds per minute). 432,000,000 seconds * 128 MB / 1 GB = 55,296,000 GB-s. (55,296,000 GB-s - included 400,000 GB-s) * $12.50 / 1,000,000 = $686.20. Estimated Total: Requests: $324.00 Compute Duration: $686.20 Minimum $5/mo usage fee. Total Estimated Monthly Cost: $1015.20. Now Hetzner's 64gb ram/6-core server costs $40 euros / month should be able to handle 1 million connections here with uWebsocket.js but keep in mind this is the absolute bare minimum and im being conservative (since theoretically 64gb = 6.4 million connections) Are my calculations/expectations correct here? Feels a bit scary since I've been on the "cloud" for over a decade, have to look at PaaS/hardening box but the cost savings here is immense.

Comments