Mediasoup v2 worker using single core of cpu

I am using mediasoup v2 library with 4 core cpu and 8 GB Ram.
I found that when concurrent users increase then cpu usage not exceed 25%-28% but facing issue to serve consumer to more users.
First i thought server side bandwidth issue but that i tested server has sufficient bandwidth.

Is there any method i can use full resources of server?
In v3 it is possible but not found anything for v2.

in config i am using this parameters to define mediasoup.

const mediaServer = mediasoup.Server({
  numWorkers: null, // Use as many CPUs as available.
  logLevel: 'warn',
  logTags: [
  rtcIPv4: true,
  rtcIPv6: true,
  rtcAnnouncedIPv4: null,
  rtcAnnouncedIPv6: null,
  rtcMinPort: 40000,
  rtcMaxPort: 49999

 room = mediaServer.Room(config.mediasoup.mediaCodecs);

I noticed in mediaServer.Room we can pass second argument workerIdx
workerIdx is number from 0 to (no. of cores -1)
it means one room can only use one worker.
does it creates limitation ?

Very difficult to utilize things 100% and not crash,

I’d not get into the habit of sharing assigning workers to rooms unless it were some kind of premium/dedicated addon server for the room. Due to costs and all sorts it’d be more ideal to just share 100 cores with 60 rooms than 240cores dedicated. Fact here is rooms can sit idle most hours of the day and use up nothing. Don’t be cheap but could cut lot of expenses and solve major issues sharing the wealth.

A fun problem that will hurt most site owners too is legitimately having entire rooms crash, few users dropping is acceptable but anything more than that is too much so having more servers is ideal but really your call?

Yes. In the demo code, one room runs on one worker.

This is where pipeToRouter() comes in - it will allow one room to utilise all available workers.
Optimising CPUs internally.

You can event extend pipeToRouter() to setup pipelines between different machines (and their workers), and not just the primary machine.

unfortunately v2 doesn’t have this function

@danisharora099 have you implemented this before? Have any github gist of this solution?