What is the difference between the channel prefetch count and consumer prefetch count?
A recent upgrade to RabbitMQ server sees a change in the prefetch count reported for a consumer in the admin panel.
What is the difference between the channel prefetch count and consumer prefetch count as seen below?
We are running a set-up where we have multiple threads consuming off of a single consumer/channel. We allow the thread count and prefetch count to be adjusted on the fly. What combination of parameters to the Model.BasicQos(prefetchLength, prefetchCount, global);
call on the c# client should we be using?
asked May 4 '17 at 13:05
763618
1 Answer
4
Basically prefetch in both cases means (maximum allowed) number of unacknowledged messages, per channel or per consumer. Check out here under title Channel Prefetch Setting (QoS). Important to note in case of channel prefetch (I'll just quote from aforementioned link)
Once the number reaches the configured count, RabbitMQ will stop delivering more messages on the channel unless at least one of the outstanding ones is acknowledged.
so no more messages to any of the consumers on that channel!
Nice examples on what numbers mean what and what happens when both of the prefetch values are set can be found here, so really what you need for the values in your case is arbitrary but obviously depends on various factors like: frequency of publishing, size of messages, number of consumers etc.
In the screenshot it seems that your consumer prefetch is bigger than channel prefetch. Now I don't know what the web management ui is reporting nor how do rabbitmq or the c# library handle this, but I would say that based on what is written in the documentation that consumer prefetch count can only be less or equal to channel prefetch count (I mean of course when it's actually used in runtime, not at declaring).
answered May 4 '17 at 17:57
5,67532036
-
2
I don't think that like has examples showing the difference between prefetch_size and prefetch_count – user48956Jan 26 '18 at 1:48
-
@user48956 I don't know what you mean by prefetch_size – cantSleepNow Jan 26 '18 at 9:07
-
github.com/pika/pika/blob/master/pika/channel.py#L427 -- though I now realize I came to the wrong question. I'mm confused about the difference between prefetch_size and prefetch_count. The docs make me think one is channel related, and the other connection related, but its very unclear. – user48956 Jan 26 '18 at 22:06
-
2
@user48956 actually here in RMQ docs rabbitmq.com/amqp-0-9-1-reference.html it's more nicely explained what prefetch size is, search for
long prefetch-size
– cantSleepNow Jan 26 '18 at 22:15 -
2
Thanks! That's much clearer. size=bytes, counts=messages. – user48956 Jan 26 '18 at 23:34