Understanding Janus Performance and WebSocket Connections

Hello,

I would like some help in understanding Janus’ performance a bit better. I would like to think my test is a simple setup, but I was conducting some investigations to see if Janus can handle multiple WebSocket connections. In my case, I would like to dynamically increase the number of connections depending on traffic, as I am using a single point of access in my system.

The test is straightforward—I attempt to create as many connections as possible while also creating sessions and handles. However, I am encountering timeout errors when trying to create a session. So far, I have tested the following:

  • With 1,000 session creation attempts, I get 9-11 failed attempts. Multiple WebSocket connections are created, but it seems like only one connection is allowed.
  • With 2,000 session creation attempts, I encounter 22 errors.

Here is a sample from the logs:

[WSS-0x75dd98019e20] Destroying WebSocket client
[WSS-0x75dd980031f0] Destroying WebSocket client
[WSS-0x75dd9801c850] Destroying WebSocket client
[WSS-0x75dd98026090] Destroying WebSocket client
[WSS-0x75dd9801e480] Destroying WebSocket client
[WSS-0x75dd9802c9d0] Destroying WebSocket client
[WSS-0x75dd9800d350] Destroying WebSocket client
[WSS-0x75dd98031ae0] Destroying WebSocket client
[WSS-0x75dd9802f140] Destroying WebSocket client
[WSS-0x75dd9800add0] Destroying WebSocket client
[WSS-0x75dd98023c80] Destroying WebSocket client
[WSS-0x75dd98017100] Destroying WebSocket client
[WSS-0x75dd98029020] Destroying WebSocket client
[WSS-0x75dd98012e00] Destroying WebSocket client
[WSS-0x75dd98008790] Destroying WebSocket client
[WSS-0x75dd98004ef0] Destroying WebSocket client
[WSS-0x75dd98027540] Destroying WebSocket client
[WSS-0x75dd98024860] Destroying WebSocket client
[WSS-0x75dd98015f90] Destroying WebSocket client
[WSS-0x75dd98010d80] Destroying WebSocket client

I am unsure what this behavior indicates. Could it be that Janus is rejecting multiple connections from the same IP at the same time? What could be the determining factor in removing some of my connections?

I would appreciate any insights you can provide on this issue.

It is not clear the frequency of your requests (e.g. open requests per second).
There is no kind of security enforcing when establishing a WebSocket connection with Janus.

Your issues might be related to:

  • an unknown hot path in Janus code that does not handle well such a high number of connections / request frequency
  • resource exhaustion on the host machine (open files, network buffers and other kernel related settings)

Your test is interesting but we always recommend using a proxy/application server for large scale deployments. For example a middle tier between clients and Janus might be able to support thousands of WS client connections, while redirecting requests to the Janus backend through a single (or a pool of) WS connection.

1 Like