Node server process cpu usage increases with mediasoup worker process cpu usage

With around 210 consumers my worker is at 20% and the node server process is around 50%.

Only the worker process should go up while the node server should not as node is just signaling, handling workers etc. Whenever node server process is around 100% then the signaling process, socket events, slows down, which is understandable.

Why is my node server process going up like that?

Is mediasoup worker process is detached from main node server process? If not can I run it as a detached process?

I am saving consumers, producers, transports objects to their specific arrays. It should cause memory consumption not cpu consumption.

Can someone guide me?

Worker is separate process,

The issue would fallback on the server.js potentially performing too many tasks and with that setup it’d fail immediately; Signal/Route only and that’ll stay as low as 1-5% all times with all those cores.

Question is what is your server.js doing more than just connecting users, you running observers or anything crazy like intervals/timeouts/etc?

Nothing special, there are bunch of socket events for signaling purpose and other small stuff like that.
Nothing major.

One thing I noticed is cpu usage of main node process increase as the number of consumer increases and when there is no consumer it stays around 1% which is ok. So something in consumer part is causing this issue.

To make sure it is not related to mediasoup directly I tried another demo application and this issue was not there so it doesn’t seems to be issue with mediasoup directly, some issue seems to be on my side but can’t think which thing is causing issues as I am not doing anything heavy on my server, also my server is a high end server if main node process is going to 50% it means there is some heavy operation being performed on main process.

I will dig deeper into my code to check which thing is causing issue and why cpu usage of main node process increases with increasing number of consumers. It doesn’t makes sense.

Will update here.

Sounds like when a new connection is opened you send them messages 24/7 without breath. If you re-created an interval to handle ping for each user that’d do it as well slowly but surely.

I’d seek out what the connection is setup to do when it’s created.

Yes it seems like this, thanks for your assistance. I will update you soon