News for hackers. Stuff that matters.
Re:Migrating Millions of Concurrent WebSockets to Envoy by ex3ndr on Wednesday March 17, 2021 @06:02PM (#26497308)
I am curious about backend part - do ws is still ws on services? Why? For example, why to have thousands of connections instead of a single one (or a bunch) that simply forwards websocket packets with some "connection id" with them.

This way you could restart service without killing ws connection, move all overhead of handling millions of connections to the lb.

Re:Migrating Millions of Concurrent WebSockets to Envoy by jkarneges on Wednesday March 17, 2021 @09:19PM (#26498815)
> why to have thousands of connections instead of a single one (or a bunch) that simply forwards websocket packets with some "connection id"

For anyone wanting to do this sort of thing, check out Pushpin [1]. It's a proxy server that can manage raw WebSocket connections on behalf of any HTTP backend. There are middleware libraries (such as [2]) to make it easy to write handler code.

Disclosure: lead dev. Came up with the idea after developing a custom connection manager thing at a previous company.

[1] https://pushpin.org [2] https://github.com/fanout/js-serve-grip/blob/master/examples...

Re:Migrating Millions of Concurrent WebSockets to Envoy by bpicolo on Wednesday March 17, 2021 @08:02PM (#26498316)
If I remember right, Slack's main application was PHP, now Hack, based, so I wouldn't be surprised to hear that app doesn't hold onto websocket connections itself - long-lived connections aren't historically PHP's wheelhouse
Re:Migrating Millions of Concurrent WebSockets to Envoy by 1f60c on Wednesday March 17, 2021 @11:56PM (#26499550)
I didn't know anyone outside of Facebook used Hack! TIL.
Re:Migrating Millions of Concurrent WebSockets to Envoy by SEJeff on Thursday March 18, 2021 @01:32PM (#26505253)
https://www.youtube.com/watch?v=nPMI1uSrS8g here is a video of one of Slack's lead engineer discussing their migration from php --> hack
Re:Migrating Millions of Concurrent WebSockets to Envoy by ec109685 on Thursday March 18, 2021 @02:12AM (#26500044)
Slack has a Java server managing real-time messaging: https://www.quora.com/What-is-the-tech-stack-behind-Slack

“This part of our back-end, responsible for most of the real-time interactions happening in various clients, is implemented in Java, and accessed via a WebSocket API described here: Real Time Messaging API. A great deal of the user experience that makes Slack feel like Slack is the result of careful work on the message server. Many of the distributed systems challenges we face on the back-end are in coordinating this service with the rest of the (LAMP-ier) back-end.”

Re:Migrating Millions of Concurrent WebSockets to Envoy by Matthias247 on Wednesday March 17, 2021 @07:22PM (#26498027)
You could do that. But it would introduce a lot of head of line blocking on that connection. In return you Save a TLS handshake which might not be too important for long lived connections.

Plus it requires the backend to support that custom multiplexing layer.

Re:Migrating Millions of Concurrent WebSockets to Envoy by muxator on Wednesday March 17, 2021 @09:09PM (#26498753)
How so? Why there should be a head of line blocking? This would be a simple multiplexing of the payloads.
Re:Migrating Millions of Concurrent WebSockets to Envoy by Matthias247 on Thursday March 18, 2021 @12:38AM (#26499713)
If there on the other connection a lot of messages are exchanged (and a websocket frame could be gigabytes long according to the spec) the other stream would be blocked behind that.Of course that can be mitigated by using a non websocket framing, but that in the end reinvents yet another transport layer.
Re:Migrating Millions of Concurrent WebSockets to Envoy by winrid on Thursday March 18, 2021 @01:19AM (#26499882)
If you're looking to do this, I recommend the Nchan module for Nginx.