Mediasoup Server

Hello, I been using mediasoup to implement a media server for Livestreaming events using webRTC; from my observation: the system works fine for small number of consumers but as the number of comsumers increases; the delay increases as a result connection to the fist clients gets disconnected and new comming consumers can’t get the live streams.
I calculate the number of routers needed per workers

number of routers needed = (number of consumers / 400)  / number of Workers 

I created the routers based on this number “number of routers needed” then store it on array; and I assign the first router to the producer and the rest routers to the consumers. and I use pipeToRouter to route streams from the producer router to consumer router;
is there any way to fix this kind of problems? thanks

Event-loop sounds busy, what’s the CPU % when you run those tests?

There is no point (for performance) to have multiple routers in the same worker, quite the opposite actually if you are going to pipe from one router to another in the same worker.

I were experiencing some delays, I guess it is due to that; then what should do I to stream media to unlimited number of consumers

You scale with workers. So create one router per worker and cascade them as much as needed.

thanks for you quick reply, so If I need to scale, I need to run multiple machines concurrently and pipe them right?

If you have that many consumers - yes