What is difference between produce.close() and produce.pause()? Is there any difference in CPU’s performance when I use produce.pause() rather that produce.close()?
close()
closes the Producer. Terminates it and hence makes it unusable anymore. You don’t want to use it just to save CPU.
Thank you.
I have 1 producer and 7 consumers and when I see CPU usage for mediasoup-worker, these are the results.
When I paused their producer the CPU usage is around 13.2%.
When I closed their producer it reached to almost 11.4%.
You think it’s normal?
Hi, Ali. We write full documentation for something:
Thank you.
Yes. You’re right and I’m sorry about that.
But I didn’t find anything about how CPU behaviors when producer is paused. I got that when we close producer it becomes no longer usable.
Look for zeroRtpOnPause
option.
Thank you. You are right. I didn’t read anything.
I’ve done what you said, it worked and I’m so happy now.
Hi dear Iñaki.
I tested zeroRtpOnPause=true
option for 2 weeks and now I realized that in comparison with producer.close()
, it uses more CPU.
I have 7 producers and 200 consumers (every producer has about 30 consumers), my server has 4 CPUs and all of these eat about 70% of all CPUs.
Maybe my users don’t use browsers that support zeroRtpOnPause
. Am I somewhere wrong.
Please avoid direct mention. I’m not the only one here that can give support.
You can check (via stats or “trace” events) in server side whether those Producers
in mediasoup are receiving RTP or not while paused. I cannot speculate much more if you don’t confirm that.
I’m sorry about that I didn’t know that. Maybe you’re the good one.
I’ve checked that and all browsers except chrome do not support zeroRtpOnPause
option.
Because of CPU saving of server and battery lifetime of devices I think producer.close()
is better choice rather than zeroRtpOnPause
.
I said that because I control students with teacher and I do that with sending some commands to students for behave as a producer or not. I’m going to test it in this week and report it (I did it before but I didn’t pay attention what the result was).
Thank you for being nice.