Streams are buffering when server is busy

Hi there,

We have a Janus server set up with no issues at all. We use the videoroom plugin. When our app is not very busy, every video stream is working fine. No buffering issues, or streams falling out.
But when the Janus server gets more busy, so more streams, buffering issues start occurring.

The weird thing is, that the RAM and CPU usage on the Janus server is still very low.

We are using H264 streams. Mainly 720x720 30fps and 960x720 30fps with the ‘42e01f’ profile for H264.

What can we change on the server, or in the video room itself to solve these buffering issues and streams falling out?
Maybe set a max bitrate on the video room? And what would you advice, something around 1.5 mbps bitrate as a max for those two resolutions?

These are our video room settings:

        let create = {
            request: 'create',
            destroy_if_empty: true,
            empty_timeout: 3600,
            videocodec: 'h264',
            audiocodec: 'opus',
            h264_profile: '42e01f',
            is_private: false,
            publishers: 10,
        };

Maybe set the publishers to a lower number? Do not think it will fix anything but maybe!

We do have all the plugins enabled on our server. Maybe only enabling the videoroom plugin will help?

These are our server settings:

  "janus": "server_info",
  "version": 1202,
  "version_string": "1.2.2",
  "author": "Meetecho s.r.l.",
  "log-to-stdout": true,
  "log-to-file": true,
  "log-path": "/var/log/janus.log",
  "data_channels": false,
  "accepting-new-sessions": true,
  "session-timeout": 60,
  "reclaim-session-timeout": 15,
  "candidates-timeout": 45,
  "server-name": "MyJanusInstance",
  "ipv6": false,
  "ice-lite": false,
  "ice-tcp": false,
  "ice-nomination": "aggressive",
  "ice-consent-freshness": false,
  "ice-keepalive-conncheck": false,
  "hangup-on-failed": false,
  "full-trickle": false,
  "mdns-enabled": false,
  "min-nack-queue": 200,
  "nack-optimizations": false,
  "twcc-period": 200,
  "dtls-mtu": 1200,
  "static-event-loops": 0,
  "event_handlers": false,
  "opaqueid_in_api": false,

Kind regards,
Jesse de Wild

The VideoRoom has a few bottlenecks in critical paths, which is why it’s not really meant for many viewers out of the box. It’s why we’re adding helper threads as we did for the Streaming plugin:

Please test and let us know if it helps. We haven’t received enough feedback on it, and I’d like it to be merged sooner or later.

1 Like

Hi Lorenzo, how can I add this to the videoroom plugin?

It’s a pull request. You need to pull Janus from that branch and use that version.

Note it’s disabled by default. You’ll need to pass a threads property when creating a room (via config or API) to specify a number of threads to use to assist (default will be 0, so disabled).

1 Like
  • configure janus.jcfg “event_loops” properly, setting it to the number of available cores or a multiple of it
  • For the described h264 stream, putting a limit of 1 mbps is enough imho
  • Lower log verbosity if not needed

As Lorenzo mentioned, the videoroom is not intended to be used with a large number of subscribers. If that is your scenario, consider implementing a different architecture where feeds are being forwarded to streaming mountpoints and attendees use those to fetch the streams.

Hi Lorenzo,

What is an ideal starting point for the threads? And do we need to enable it on our server as well?

There’s no ideal starting point, since it’s a new feature and not benchmarked. You’ll have to experiment with that, possibly doing some benchmarking of your own.