Stress test with 30 subscriber publisher on audio/video/datachannel cpu usage "normal"?

Hey janus Team,

we use janus gateway with the rust sfu from GitHub - networked-aframe/janus-plugin-sfu: Janus plugin to act as a kind of SFU for game networking data. it runs very stable and we are super happy with this setup, at the last days i have done some more testing, wie one Room and 30 subscriber/publisher with audio/video/datachannels, as a result
using event_loops=8 ( server has 8 cpu) cpu is a little better than the standard config but still high
~400% gprof shows me
time seconds seconds calls ms/call ms/call name
39.12 4.71 4.71 janus_ice_outgoing_traffic_prepare
22.22 7.39 2.68 1687955 0.00 0.00 janus_ice_outgoing_traffic_handle
12.08 8.84 1.46 janus_ice_cb_nice_recv
4.24 9.35 0.51 22883 0.02 0.02 janus_cleanup_nack_buffer
3.99 9.83 0.48 2368685 0.00 0.00 janus_rtp_payload
2.91 10.18 0.35 1799462 0.00 0.00 janus_ice_relay_rtp
2.49 10.48 0.30 9267428 0.00 0.00 janus_flags_is_set
1.33 10.64 0.16 6853161 0.00 0.00 janus_get_monotonic_time

are the most used is this normal? or can we still optimize this?

Thanks
Arnold

using event_loops=2 for this config looks best performance at the moment

full gprof output gist:7ff5ca43f5084ae82f031efb44138b72 · GitHub

@lorenzo would it make sense to add a config for loops per room?

with this setup we could host 4 rooms with 30 subscriber/publisher ( video/audio/datachannels) at this server

No, I don’t think it would. Janus knows nothing about what plugins do, and viceversa, and this is on purpose. If you want to put users of specific rooms on specific loops, that’s up to you to do.

1 Like

make sense! and from your experience this cpu usage is “normal” for this setup?

I never used the Mozilla SFU plugin so I can’t provide any feedback.

1 Like

from gprof it looks like all cpu is used in the janus ice and not in the plugin

Nevertheless, I’m not going to say anything else, since it’s not code that’s in our repo.

1 Like

how i understand the loop_index, the publisher and the subscriber should always be on the same loop right?

A publisher and a subscriber are different handles. They’ll only use the same loop if you pass the same loop_index for both when attaching the handle.

yes this was the idea to always use the same loop_index for publisher/subscriber handlers

what i testing is something like this:

let clientId = String(crypto.getRandomValues(new Uint32Array(1))[0]);
using this as the client janus Id
and on attach loop_index is set with “loop_index”: parseInt(clientId) % 8 ( 8 are the CPU cores)

Hi there,
I’m trying to setup the stress test. However, when I run squawkers.html on the api-version=103. I got the error as below on terminal running janus.

[ERR] [sdp-utils.c:janus_sdp_get_codec_pt_full:780] Unsupported codec ‘’
[ERR] [sdp-utils.c:janus_sdp_generate_offer:1379] First attribute is not JANUS_SDP_OA_MLINE or JANUS_SDP_OA_DONE
’ panicked at ‘Mysterious error generating SDP offer :(’, src/lib.rs:656:32

The SFU plugin seems to be loaded correctly:
Loading plugin ‘libjanus_plugin_sfu.so’…
Loaded SFU plugin configuration: Config { auth_key: None, max_room_size: 100, max_ccu: 1000, message_threads: 0 }
message_threads is set to 0, setting it to 128 (number of cpus)
Janus SFU plugin initialized!

Did you run into any such problem? Any help would be appreciated!

I have no idea what this is, we don’t have any Rust in our code. You may want to ask your question to whoever wrote that code.