disabling Keep alive for each session..

405 views
Skip to first unread message

Viswa

unread,
Mar 8, 2016, 7:25:06 AM3/8/16
to meetecho-janus

Hi,

We tried to call Janus  API(websocket) from our server using websocket.

We are having one websocket connection to Janus and managing all the sessions through that connection , But we have to send keep alive for each session(We tried 2000 sessions and had to send 2000 keep alives).

I understand Keep alives were kept with HTTP in mind, Do we need them for websocket also??

Is there a way to disable keep alives or at least change the Keep alive time??

Thanks for your help.

Best Regards,
Viswanath..

Lorenzo Miniero

unread,
Mar 8, 2016, 8:08:59 AM3/8/16
to meetecho-janus
Keep alives are NOT for HTTP only. They are needed also when you have some kind of control channel like WebSockets, as you can't be sure the user is still there even though no TCP disconnection has been detected (e.g., still waiting for timeouts to fire). This is standard practice in other frameworks as well. Anyway, I agree that it's a bit awkward to keep-alive each session when you're sharing the channel across multiple sessions, but unfortunately there's not much we can do about that, considering the modular nature of transports (different transports may have different requirements).

If you want to reduce that number, and you're already wrapping the communication on the server side, one thing you may want to do is using a single session and add all the handles there, so that you only have to keep-alive one: the downside is it might be trickier to keep track of individual users (e.g., if you're using a session for each of them) and to get rid of a specific session (you have to know which handles to remove, when before you could just remove the session entirely).

L.

Lorenzo Miniero

unread,
Mar 8, 2016, 8:11:27 AM3/8/16
to meetecho-janus
That said, even by keeping each session separate, the keep-alive timer is about 60 seconds in Janus (defined in janus.c). This means you can send a keep-alive in a really relaxed way (e.g., once every 45 seconds), so I really don't think it's going to affect much the traffic on the channel, the overhead is minimal (sessions/handles traffic is much higher).

L.
Reply all
Reply to author
Forward
0 new messages