As part of the ongoing push to v1.0, I pushed up a refactor to WebSockets mere moments ago that improves both reliability and performance.
With this refactor we've moved away from a single-fiber-per-websocket model and now use a connection pool (backed by a nio4r selector) to read from all open websockets in a single thread. This work was originally inspired by Tony Arcieri's recent post. See Realtime::ConnectionPool for the result (I also found ActionCable::Connection::StreamEventLoop to be a helpful reference).
In my local testing, each WebSocket connection adds < 5kb of memory overhead. This is satisfactory for now but can probably be improved by not holding onto so much state in the `Realtime::Connection` object. At some point I'd like to benchmark it in a real production environment to see how many open connections a single process can support (locally I ran out of file descriptors around 10k connections).
If you're feeling brave, run your app from
master and tell me how it goes