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

Hi.
I’m planning to build a media server using Mediasoup. so According to Mediasoup.
from the document

“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”.”

  1. Each worker take a single core of cpu. is that mean when

a. someone opens 1 room = 1 single core CPU?
b. one person opens multiple rooms = 1 single core of CPU?
c. multiple people opens multiple rooms = 1 single core of CPU?

  1. is that single core of cpu means a physical cpu core ? or hyperthreading cpu?

(For example, AMD Ryzen 9 7950X has 64 (physical cores) , 128 threads (i guess that it means virtual cores)

  1. Does it mean that i’m able to create upto 128 rooms using AMD Ryzen 9 7950X ?

i just want to be clear abt the logics to build a media server using Mediasoup. thanks!

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.

Faaaaaantastic~ i do appreciate your help . and it’s crystal clear ! super ultra magic Thanks!! :slight_smile: