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?
Channel Prefetch Count and Consumer Prefetch Count The channel prefetch value defines the max number of unacknowledged deliveries that are permitted on a channel. Setting a limit on this buffer caps the number of received messages before the broker waits for an acknowledgment.
A connection is a TCP connection between your application and the RabbitMQ broker. A channel is a virtual connection inside a connection. In other words, a channel multiplexes a TCP connection. Typically, each process only creates one TCP connection, and uses multiple channels in that connection for different threads.
RabbitMQ has a plugin for consistent hash exchange. Using that exchange, and one consumer per queue, we can achieve message order with multiple consumers. The hash exchange distributes routing keys among queues, instead of messages among queues. This means all messages with the same routing key will go the same queue.
The RabbitMQ message broker was deployed atop Google Compute Engine where it demonstrated the ability to receive and deliver more than one million messages per second (a sustained combined ingress/egress of over two million messages per second).
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With