Idle transport CPU usage seems high

Hello!
My apologies if this has been addressed before (searched the forum but did not find anything).

I am noticing what seems like a strange phenomenon: after creating receive transports for peers and calling consume on them, the CPU usage of the worker on which these are created remains elevated even after closing all consumers. For example, I put 200 150kbps video consumers (1 producer) on one worker and the CPU usage goes from 0 to around 40%. After closing the producer and all the consumers, the CPU usage drops to 15-20% and stays there. The transports continue sending some data back and forth (much less than when streaming but still ~200-300kbps total). Closing the transports returns the CPU usage to 0.

When I create 200 audio consumers (40kpbs), the CPU usage goes up to ~10% and then drops to 4-5% when they are closed (the idle bitrate of the transports is also significantly less than with video). If transports have nominal overhead when idle, shouldn’t that be consistent regardless of what has been streamed?

In general, shouldn’t an idle transport consume very little? Am I doing something wrong, or is this behavior expected? Do you recommend closing idle transports?

BTW, I am new to this library and very much appreciate the work that went into it–very impressive!

Thank you!
-Igor

Definitely doing something wrong.

CPU should always return to normal when clearing the Producer/Consumer Transports. So I’d say it’s a leak in your code, have you examined any of the demo’s most have got this issue resolved for better-testing.

Thanks for your reply!

I did some more digging (debugged mediasoup and monitored packets) and the CPU load is caused by the congestion control on the server. It fires for every transport that has had video on it even if it is currently idle. Shouldn’t it only be needed when there are streams on the transport?

If there is something I am missing, I would greatly appreciate any pointers. Thanks again!
-Igor