using only one router in a worker

I just read the docs regarding to scalability. (
Then I found out that the physical limitation is upon worker, not router. (is that right?)
Although mediasoup allows us to create multiple routers in a worker, I am considering just create a single router per each worker. The main reason is to achieve simplicity of implementation.

Here is my question.
I want to know the proper situation to use multiple routers in a worker.
Also I want to avoid potential hazard when putting bunch of consumers in a single router even I am going to implement inter-worker, inter-host load balancing.
I think there might be some reasons why multiple routers in a worker are needed.

You may wish to use more than one Router per Worker if those Routers will handle not so many Producers and Consumers so a CPU in your server can handle more than a single Router.

Otherwise, if you create a Worker per Router, you may end with more Workers than CPU cores, which is kinda inefficient (instead of allowing each Worker run in a separate CPU you’ll have N Workers competing in the same CPU). However it won’t be that bad anyway, so if it simplifies things for you that’s probably ok.

1 Like