Consumer Prefetch Count

208 views
Skip to first unread message

n2p...@googlemail.com

unread,
Feb 6, 2015, 3:50:12 PM2/6/15
to rabbitm...@googlegroups.com
Hi MK,

We have been having some trouble setting the right value for the prefetch count on a consumer.
I thought prefetch count is determined through the ratio of the RTT (Round trip time) + processing time / processing time of a give message consumed from a queue by the consumer?
I see values varying from 26 to 50, and even up to 10000 or more.
What will be the right value in this wide rage. What is the default value that you recommend?
In addition, should prefetch count not be set at a connection rather than on a channel level, especially given that you can have multiple channels reading from the same connection?

Thanks,

Pascal

Michael Klishin

unread,
Feb 6, 2015, 4:09:38 PM2/6/15
to rabbitm...@googlegroups.com, n2p...@googlemail.com
  On 6 February 2015 at 23:50:13, n2p...@googlemail.com (n2p...@googlemail.com) wrote:
> We have been having some trouble setting the right value for
> the prefetch count on a consumer.
> I thought prefetch count is determined through the ratio of the
> RTT (Round trip time) + processing time / processing time of a
> give message consumed from a queue by the consumer?
> I see values varying from 26 to 50, and even up to 10000 or more. 

basic.qos prefetch is set by clients (it is 0 — or unlimited — by default).

What are these numbers you are seeing? Number of unacknowledged messages?

> What will be the right value in this wide rage. What is the default
> value that you recommend?

There are most commonly 3 types of consumers:

 * Those processing one-by-one
 * Those processing with a certain degree of concurrency
 * Those processing with a high degree of concurrency (as high as hardware resources allow)

Which category does your consumer fall into?

For #1, the answer is obvious. For #2, it is usually the max allowed degree of concurrency (e.g. 8).
For #3 it can be 50-250 (higher values are unlikely to yield much improvement) and the only way to
know is to benchmark and see your consumer utilisation both in the management UI and using
runtime profilers.

> In addition, should prefetch count not be set at a connection
> rather than on a channel level, especially given that you can
> have multiple channels reading from the same connection?

Just set it per channel.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages