Recommended number of mediasoup-worker processes

What is the recommended number of mediasoup-worker.exe processes for a 40 core CPU. And how many router can be opened in each process.



Wrong question. This is not about number of routers.

What is the correct question, is it about number of transports in each router.

There is no magic response to that question, sorry.

My main question that I couldn’t have any answer on it is how can I distribute users or rooms over servers in order to have a conference without any issue from server side. Is there any rule that I can follow I can give some numbers.
We made a webinar application based on mediasoup for schools, and now we have more than 50k active users. we distributed the users on servers each with 2500 user and this number is based on the bandwidth that each server can handle with the specified maxbitrates and everything is working fine concerning the bandwidth capacity of each server. Concerning the CPU we open 40 worker on each 40 core server and distribute router in round robin across the workers and everything is working fine the CPU is not exceeding 30% at the peak time. We are also recording the webinar using FFmpeg and plain transports, also the CPU is not increasing more than 10%. Everything is fine. However, some users are experiencing some latency at specific times when creating producers, some others are facing problems in sound quality. I don’t know if these issues are network issues from client side or from mediasoup worker it self when it is handling more than one router at the same time with this number of user.
From two months till now we made a great job using mediasoup but we are still experiencing these issues we don’t know if it is a limitation from mediasoup or not.
At the same time each server is handling about 100 room each having about 25 users on average, each user has producing transport and consuming transport.

I subscribe to the fact that there are is no magic answer to your question.

Moreover, my feeling is that you are contradicting yourself:

But since I don’t want to be all negative about your question:

Do you mean consumers? Since it’s a webinar I expect that you have one main producer and lots of consumers. Or is everyone supposed to see/hear everyone else?
Usually, a keyframe is requested when a new consumer connects, which might be quite computationally intensive on the hardware and produce a bigger data packet to be sent over the network, which in turn might degrade the experience for some/all users. Did you go through this page?

Yes this is my case, a room with a teacher that produces Audio, camera and screen share, and students that produces audio. In my case if there are 30 student in a room all hearing each other from there are more than 900 consumer in a router.

From the link here I’m exceeding the limitation of a router since it can handle ~500 consumer, is that right. What kind of issues I will have in this case, and how can I overcome it.
One more thing the teacher can mute the audio for students which will pause the producer will this help in reducing the issues?

To me it’s obvious that 500 video consumers need more resources than 500 audio consumers.

I believe you are too focused on getting a definitive number that will work for your setup perfectly. But there is no such number, as already said.

Those numbers are good just to make an idea about what has been tried, but to me it’s clear that they need to be taken into account in some kind of context:

“Depending on the host CPU capabilities…”

Also, you should read the entire page, not get stuck on that single part.

Thank you, do you recommend any testing tool in order to make my tests on the platform and monitor the performance based on the number of consumers.

What I recommend is to not send 30 audio streams to every user, and just allow to speak a few of them at the same time. No magic solution for this, it’s up to your application logic.

Will the producer.pause help? ِAllowing audio for students is controlled by the teacher. Whenever the teacher allows audio for a specific student a producer is created and consumers to other students and teacher. Sometimes the teacher allows audio for all students at a time which means producers and consumers are created for all. What I’m thinking is to pause the producers unless an audio threshold is exceeded then a stream will be sent. Will this help?

I have asked same type of question here about max number of consumers per worker, this will help:

@mustafa how you managed to distribute users on different servers (machines)?
Before a call is started do you check between the servers to see which one is free then run that call on that server? Or you are piping media between different machines? Or you are doing something else?