Hacker News new | ask | show | jobs
by gamache 2555 days ago
The cognitive load is quite low when deploying changes which only involve your app code (i.e., no dependency upgrades). My app has a few tens of millions of open websockets at a time, and it's worth it to me to avoid mass reconnects. I'm not everyone, but my use case isn't totally unique either.
2 comments

I am not sure about your specific use case but it owuld be hard to imagine that graceful reconnect on websocket + a more traditional deploy would not be much more effective resourcing vs that hurdles you have to go through to properly appup. Is it really an advantage to you or has it slowed your ability to get to market for something that seems like it "should" be an advantage.

Its not like you don't need graceful reconnect handling logic for the websockets anyways -- net-splits and endpoint failures are a thing.

It really depends on how much effort is involved in setting up the connections, and how much effort is involved in directing connections to a new host.

If I'm running 1M sessions per machine, and each machine can handle 10k new connections / second, rolling restart is really expensive. If I'm running 10k sessions per machine, and can handle 10k new connections / second, rolling restart isn't too bad. This generalizes to really anything that gather essentially ephemeral state, but that state is costly to gather (tcp flows in this case, data caches in others, etc).

BEAM excels at applications with huge numbers of sessions per machine, which is why some users really value hot reloading.

Editted to add -- the OTP application update sequence doesn't necessarily need to be used. Where I work, we certainly don't do that. Just a little bit of logic around code:soft_purge/1 and code:load_file/1

"Few tens of millions of open websockets" is more than Slack and Discord combined, not?

BTW: we were the first who did 1M long-living connections load test with Cowboy on a single EC2 instance back in 2011. And 3M long-polling HTTP requests on a single beefy physical server.

It was before WhatsApp upstreamed their optimizations and before Phoenix team made it easy.

I imagine both Slack and Discord have much higher numbers than this, as well as a very different workload (they're doing chat, we're not).

I don't want to give the impression that this is happening on a single server, either! I did the cowardly thing and threw more boxes at the problem. :)