yes, the idea of prefetch is to deliver another message on or before an ack such that it is available on the client before it is needed. Some deviation is expected because a fast consumer will be able to ack messages faster than the broker can dispatch them because it is doing dispatch in batches of 1 when the prefetch is 1.
This is why we use a larger prefetch by default. With prefetch=0, a client pulls a single message from the broker, there is no prefetch but there is a round trip to the broker for each pull request, so while the mean will be higher, the deviation will be less. To get the lowest mean and deviation and understand what is happening further, preload with X messages and set the prefetch to X/N where N is the number of consumers. see: http://activemq.apache.org/what-is-the-prefetch-limit-for.html On 4 May 2011 16:31, Josh Carlson <jcarl...@e-dialog.com> wrote: > If I have prefetch set to 1 and I retrieve a message, is another one > dispatched before it is ack'd? I'm trying to scale the number of consumers. > My benchmark test pre-produces 50 messages for each consumer (all in one > queue). Then sets N consumers active and I measure the time it takes to pull > the message of the queue. > > In my benchmarking I've found a very nice MEAN time to retrieve a message at > 2ms, regardless of the number of consumers. However, the deviation is very > bad. My hypothesis is that some consumers are getting stuck not able to pull > messages off the queue because each consumer can actually be dispatched 2 > messages. Also the faster the consumer the worse the deviation. > -- http://blog.garytully.com http://fusesource.com