Producer CPU consumption vs Consumer CPU consumption

Does 1 producer takes same amount of CPU as 1 consumer does? If not what can be the reason of it?

In docs it is mentioned a normal CPU core can handle around 500 consumers, which can vary per machine, why producer CPU consumption is not taken into account when mentioning these numbers? I mean aren’t 500 producers equal to 500 consumers as far as CPU consumption is concerned?

Producer doesn’t take high CPU. Actually all the frame forwarding logic and selection logic is written in consumer. So that, consumer CPU usage is always accounted instead of producer.

In short, Poducer takes very much little CPU, which can be ignored.

Thanks, but ignoring producer CPU doesn’t make sense. Is there any ratio between producer, consumer CPU consumption to better calculate the load balancing logic?

Like if a core can handle 500 consumers, then how many producers the same core will be able to handle?

any update on this one?

Both are the same in usage give or take, the S/RTP handling guzzles. Can expect like 0.1-0.3%+ per produced/consumed track. :slight_smile:

The 500 count IMO doesn’t prove if all connections were stable, I mean unless someone wants to prove it with actual users; I couldn’t do it. :slight_smile:

More like 300-400 per core. 500 is Cappin’ but can work I think if it were just Audio. No chops.

(Processors have not gotten better per core value, in last several years so pretty much any gold/platinum XEON or a i7-4790K tests come back similar, cheers)

Thanks that makes sense. One more thing to ask is about the audio vs video. Audio CPU consumption should be less than video but what is the approx. ratio between them? Does audio takes half of the CPU as compared to video?

CPU consumption is the same generally bandwidth may affect it so audio would use a little less resources. Test and confirm for yourself.

Thanks

Many of my users want to openly talk and broadcast, so I don’t necessarily consider either audio/video but both whether the user is audio only/video only. I assume both would be potentially used and to that, I would say 0.4%-0.6% is a good range per user. This would mean you can have 200 transports, with 400 consumes.

This could be a room of 6 broadcasts (audio/video), and with 12 viewers would be about… 100+ consumes/produces. So you can maybe see a room at 12 broadcasts and 24 viewers to be 4x that… about 500+ consumes and producers which would maybe require a second core to assist; test and sort it. :slight_smile:

That is right, thanks for the insights, this thing about producer being not mentioned in the docs regarding CPU usage, makes people think that producer uses almost no CPU as compared to consumer which seems very wrong assumption. Should be mentioned in docs @ibc

The docs don’t say that a Producer doesn’t consume CPU and we cannot document how much CPU each entity uses. Basically because it depends on tons of things.

1 Like

This is right but the only place the docs mentions about cpu usage is based upon consumers. It will be more appropriate to mention it as producers/consumers instead of consumers.

Can you please confirm whether both producer, consumer take same about of CPU? I mean if 1 consumer takes lets say 1 unit of CPU, then do the producer also takes 1 unit of CPU or does it take less than that?

Docs mention consumers because typically a Producer feeds N consumers. Both a Producer and a Consumer may use similar cpu but that depends on lost packets, retransmissions etc. No magical response here.

That makes sense, thanks for clarification. One more this to ask is that audio vs video. Does the audio, video also consumes around same amount of CPU?

There is no retransmission of audio packets so video consumes much more, plus video streams are usually much more heavier than audio ones.

This is the answer I desperately needed, couldn’t find it elsewhere, thanks. For my load balancing logic can I assume that audio consumer takes half amount of CPU as compared to video? Or it is even lesser than that?

Can you please guide on this one?

Finally I’m always asked about exact CPU usage values. No, I cannot answer that, sorry. This is something you can measure by doing experiments.

Ok, I can understand, but a rough estimation should be mentioned in the docs like we have 500 consumers rough figure in the docs.

OMG the “500 consumers” stuff is based on a study that a company did. We are not gonna document how much CPU each mediasoup entity consumes.

2 Likes