# High CPU utilization

**URL:** <https://mediasoup.discourse.group/t/high-cpu-utilization/1902>\
**Category:** mediasoup-demo\
**Created:** [October 21, 2020, 5:05am UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902 "2020-10-21T05:05:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@Monika](https://mediasoup.discourse.group/u/Monika)\
**Post date:** [October 21, 2020, 5:05am UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902/1 "2020-10-21T05:05:54Z")

</div>

I have configured the sample demo from [https://github.com/versatica/mediasoup-demo](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

---

<div class="post-metadata">

**Author:** ![jmillan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/jmillan/32/9_2.png) [@jmillan](https://mediasoup.discourse.group/u/jmillan)\
**Post date:** [October 21, 2020, 8:40am UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902/2 "2020-10-21T08:40:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@Monika](https://mediasoup.discourse.group/u/Monika)\
**Post date:** [October 21, 2020, 5:17pm UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902/3 "2020-10-21T17:17:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jmillan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/jmillan/32/9_2.png) [@jmillan](https://mediasoup.discourse.group/u/jmillan)\
**Post date:** [October 26, 2020, 8:18am UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902/4 "2020-10-26T08:18:34Z")

</div>

> 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](http://docs.libuv.org/en/v1.x/) 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.

---

<div class="post-metadata">

**Author:** ![Monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@Monika](https://mediasoup.discourse.group/u/Monika)\
**Post date:** [October 28, 2020, 7:28am UTC](https://mediasoup.discourse.group/t/high-cpu-utilization/1902/5 "2020-10-28T07:28:20Z")

</div>

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.
