Performance question

Hi there

I’m setting up a mediasoup(v2) demo on a local server, then i have 6 chrome in a room, each chrome produce one video stream and one audio stream, send about 700k bps to the server, consume 5 videos and 5 audios, so the server recv about 700k * 6=4200k bps, send about 700k * 6 * (6-1)=21000k bps, it
take 20% of one cpu, everything works great.
when the 7th chrome join the room, the server recv bandwidth is about 700k*7=4900k bps, but the send trafic of the server is near 90000k bps, more than 700k * 7 * (7-1)=29400k bps it shoud be. and the the cpu went to about 90%, the console print a lot warn log like:
RTC::RtpStreamSend::RequestRtpRetransmission() | ignoring retransmission for too old packet [seq:11006, max age:2000ms, packet age:2336ms]
and
RTC::DtlsTransport::OnSslInfo() | received DTLS warning alert: close notify
RTC::DtlsTransport::Reset() | resetting DTLS transport

i’m guessing maybe because when the cpu got busy (above a threshold),it can’t process the network packet fast enough(may be ack packet), which cause it resend all the packet a lot, and it takes more cpu time, slow down the network packet process more, like a vicious circle. is it possible?

have anyone have this problem? thank you for any help!

Are those 7 Chrome browsers running in the same computer?

no, in 7 computers, and those computer’s cpu percentage is fine.

mediasoup (v2 and v3) can handle many more than just 7 audio+video producers in a room/router. However:

  • Verbose logging in mediasoup (logLevel: "debug" and logTags: [ "rtx", etc ] consume lot of CPU. Do not set them in production.
  • RTP retransmissions in mediasoup v3 has been optimized and it’s much more efficient.
1 Like

thank you for your reply.
i will disable the log and try again, and update to v3 ASAP.
thanks.

i have change the config logLevel from “warn” to “error”, and disable all logTags, but no luck, still have the same problem. i have read that mediasoup can handle 400-500 comsumers in one room on the google group, how to config mediasoup to do that, right now, i am running it with the offical demo with default config.

Have you tested with v3?

not yet, i am going to test v3, i will report the result here.

just tested with v3,at first i use the default config, the client auto changed to the worst layer of simulcast, then i disabled simulcast by set simulcast=false in the url, same thing as the test in v2 happened, the bandwidth and the cpu went high when the 7th peer join the room.
i will try to print some log in the cpp code to figure where goes wrong, thank you for your help.

The WebRtcTransport bandwidth estimation can be tuned by properly setting some parameters in the transport creation:

I’m afraid that just taking the mediasoup-demo and running it cannot be used to report bad behavior in mediasoup, as it’s just a demo which does not cover al use cases. For example: in a real application you do not want to receive 7 videos in high definition.

BTW I’ve just connected 7 Chrome browsers sending audio and video to the mediasoup v3 demo app. CPU usage does not exceed 10%. I don’t know your server capabilities, but the one in which the demo app runs are not specially high.

yes, i agree with you, i don’t think this is bad behavior in mediasoup, just i’m not sure how to do it right, and i’m still trying :smile: , because i have some scenario that similar to the demo, the client runs on computer that has multi-screen like TelePresence, it need all consumer in high definition.

Does your scenario require receiving 7 videos in HD at the same time?

hi,
the CPU usage of my server is less than 10% too when the simulcast option is true, it’s just what i wanted for now. when i turn off the simulcast option, the cpu went high.

Whether you need to enable simulcast or not is up to your application requirements. It’s not “all or nothing” for all scenarios.

not HD video, in the test, i set the video resolution to 640*360, and the max bitrate to 600k bps.
my scenario is like this: each client has three screen(1920 * 1080), each screen will display 4 video max(the idea resolution will be 900 * 540), so we will allow 12 peer in one room at the same time.

yes, i understand that, just in this quick test, simulcast drop the video resolution, i disable it for a try, and want to see whether i can do it when the simulcast is off :smile: .

As I told before, there are per WebRtcTransport settings to tune the bandwdith estimation and enforce a higher initial available bandwidth. Use with caution:

thank you for your kind response, i will try the WebRtcTransport settings.
thanks!