High CPU utilization

I have configured the sample demo from https://github.com/versatica/mediasoup-demo. When testing the demo, have observed CPU utilization on the server increases with increase in number of participants. After further drilling, observed that if a client has high CPU (due to other apps running on the machine), it results in high CPU for server, that too, its the gnome-shell that consumes most of the CPU. Could it be due to the packet loss from client, that results in retransmission?

Ideally, it being SFU, I would expect least CPU consumption at the server. And for client bottlenecks, why should the server get impacted?

Let me know if there is something that I have misunderstood being new to mediasoup, or some configurations that I need to alter.

Thanks,
Monika

mediasoup is run by Node and launches C++ workers as configured (or default ones if not configured). You can check if any of those processes (Node running mediasoup or C++ workers) is increasing the CPU usage.

Not really. The only process I saw was gnome-shell. And the trace for that showed it was making calls to recvmsg, 1000s of times.

Not really.

When mediasoup runs there is at least a Node process and a C++ one launched by the former.

And the trace for that showed it was making calls to recvmsg, 1000s of times.

Mediasoup makes use of libuv for the socket layer so it’s perfectly normal to see calls to recvmsg.

Having said that, yes, mediasoup will consume more CPU if there are retransmissions being involved since it needs to process incoming NACKs, PLIs, resend buffered RTP packets etc.

Yes, I think that was the case. Lot of retransmissions were happening, resulting into CPU spikes. However it was gnome-shell that was consuming the extra CPU instead of mediasoup process.