Clustering of Workers.

Hi Team,

This query is related to more of Clustering of workers rather than mediasoup.
So here it is, Nodejs runs in single thread and to take advantage of all of its cores we can use the clustering of workers. Since we use mediasoup.createWorker() api to create a worker and we create as many workers as the length of the CPU cores. Does the createWorker() API internally do the clustering of workers so the number of threads running the server would be equal to the number of workers?

What do you mean with “clustering of workers”? Do you mean “mediasoup Worker” or Node Workers?

mediasoup does not launch N threads but N mediasoup-worker subprocesses. The OS is the one of running each subprocess in the available CPU cores. We cannot decide that.

I was referring to Node workers here…

I wanted to have cluster of node workers so that the application’s performance would improve a lot if more threads are spawn, i was assuming when a mediasoup worker is created it internally does the cluster fork operation… Now, i believe that PM2 would solve everything for me.

Thanks for the reply☺

mediasoup does not deal with that. You can use a single Node thread or many threads (Workers) and call mediasoup.createWorker() in each. That will work.