Handling multiple channels - what's the overhead and best practice

Hi,

I have an application that we’re planning on adding channels to - multiple per user that are auto joined each session.

My question is, do these require more processing power to keep open than our current standard HTTP request setup? Could this cause the app to lock up if we reach thousands of active channels?

And what’s the best practice for closing these gracefully? Does phoenix mind if we end up with thousands of stale channels? I can find documentation on closing down specific channels / sockets, but not for how to handle this automatically (effectively cleaning up the dead channels).

Thanks in advance,
Mark

Idle channels use very little processing power. There is a keep alive message sent from the client to make sure the client is still there, but otherwise they are quite lightweight. Phoenix benchmark testing showed something like I believe 400,000 idle channels on a single 16gb server.

Ultimately though it depends on what the channels are doing. If they’re holding on to tons of data, or doing tons of processing, you won’t get 400k.

Channels automatically close when the socket to the client is terminated.

1 Like