Increase Janus performance with Streaming plugin

Hi everyone,
we are using Janus with the streaming plugin. When we launch one video stream, we receive 300-400 listeners without errors. If there are more listeners, we are starting to receive errors: ‘Discarding too old outgoing packet’.

When we set the number of processing threads in config according to the number of CPUs, we receive a limit of 500-600 listeners.

Currently, we are using several instances of Janus as horizontal scaling, but our goal is to get 900-1000 listeners on one Janus instance. Are there any recommendations for tuning Janus and Linux to achieve maximum Janus performance in the streaming plugin on single instance?

Use helper threads. The Streaming plugin documentation will explain how to enable them.

  • Well done, you have already configured event loops according to the number of cpus
  • 1 or 2 helper threads could help decoupling mountpoint rtp socket polling and packets dispatching, but your mileage may vary (please test and report back, it might be interesting for others too!)
  • Use compilation flags intended for production (e.g. “-Ofast -march=native -flto”)
  • Limit the verbosity of logs
  • Tune the process priority through Unix “nice” value
  • Perform a profiling of the server under load (with debugging flags “-Og -fno-omit-frame-pointer -g3 -ggdb3”) and try to discover what are the hot paths. This will be very interesting and might lead to a code refactoring/optimization if you share the data (e.g. a flamegraph)