Usage of number of CPU core of each worker means physical CPU core ?

Hi,
One mediasoup worker simply means a logical mediasoup unit for managing routers, transports, producers and consumers. A worker is a C++ process running on each CPU core. A worker can have multiple routers and each router can manage 1 single room or even multiple rooms if you don’t exhaust the soft limit of ~500 consumers per worker as suggested by the mediasup authors.

Quoting the mediasoup authors from the scalability page in the mediasoup.org website

A good example of this scenario is an application that provides multi-party conference rooms. Each room uses a single mediasoup router thus each mediasoup worker (which uses a single CPU) may hold multiple “rooms”.

Depending on the host CPU capabilities, a mediasoup C++ subprocess can typically handle over ~500 consumers in total. If for example there are 4 peers in a room, all them sending audio and video and all them consuming the audio and video of the other peers, this would mean that:

Each peer receives audio and video from 3 peers, so 3x2 = 6 consumers in total.
There are 4 peers, so 4x6 = 24 consumers in total.

Depending on the needed capability, the server side application using mediasoup should launch as many workers as required (no more than the number of CPU cores in the host) and distribute “rooms” (mediasoup routers) across them.

If higher capability is required, the application backend should run mediasoup in multiple hosts and distribute “rooms” across them.

So in simple terms, you can have as many workers as the total number of virtual cores / threads, which is 128 in your case. You can run as many router aka rooms on each worker / thread until you hit the 500~ limit on each worker. It is possible to have one room in 2 separate routers on 2 different workers by using pipeToRouter() function provided by the mediasoup server library primarily for load balancing across workers / threads.

I hope this helps.

2 Likes