videoroom hloop/threads

72 views
Skip to first unread message

Massimo Antinori

unread,
Feb 15, 2023, 3:51:28 AM2/15/23
to meetecho-janus
Hi Lorenzo,

I'm doing the following test on janus:
1) I set a fixed number of threads in the Janus core equal to the number of cores on the server (16).
2) I have only one publisher sending its audio/video signal to the videoroom plugi
 3) I have 1000 remote subscribers all connecting to the videoroom plugin.

During the test I noticed that the workload is distributed with the same percentage of utilization on all 16 "hloop" threads and on all CPUs of the server.
Is this equivalent to using the streaming plugin with helper threads, or might the publisher loop not be able to send the stream to all subscribers?

Regard,
Massimo

Lorenzo Miniero

unread,
Feb 15, 2023, 4:03:01 AM2/15/23
to meetecho-janus
No, the Janus core loops thing is not equivalent to helper threads, since loops in the core don't know if a PeerConnection they'll handle is a publisher or a subscriber. As such, a publisher may end up in a loop with a ton of other subscribers, which may potentially harm the handling of incoming traffic (Alessandro will correct me if I'm wrong). The real equivalent to helper threads in the VideoRoom is what's available in this PR (that I encourage you to test):


That said, loop threads are still useful, especially in broadcasting scenarios where you have to serve media to a lot of participants, since they help avoid too much context switching. Besides, the starvation example I made before can be avoided if you assign participants to specific loops yourself, and so you can decide to, e.g., group publishers in the same loop rather than having a round robin distribution which is what happens by default: https://github.com/meetecho/janus-gateway/blob/master/conf/janus.jcfg.sample.in#L108-L119

L.
Reply all
Reply to author
Forward
0 new messages