HACKER Q&A
📣 spxneo

Replacing Cloudflare Durable Object with Hibernate WebSocket for Hetzner


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.


  👤 flagged24 Accepted Answer ✓
Whenever I read posts like this with millions of requests per small time unit, fighting over dollars. I realize I work in a completely different realm. I have barely 60 concurrent users but these users are paying top dollar for the privilege. Can't you make the revenue per request higher so this becomes a none issue ?

👤 hakanderyal
It will be much faster to try it out rather than waiting for internet strangers to answer for these type of questions. I would setup $10-$20 VPS and test max performance then extrapolate from there.