You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Raffi <ra...@gmail.com> on 2016/03/21 04:44:18 UTC

How to test prefetch size is actually working

Is there a JMX metric for testing prefetch=1 vs prefetch=100? I want to
confirm reduced network activity between consumer and broker when using
large prefetchSize. DispatchedCounter and DispatchedQueueSize appear to
increment/decrement by 1, never consistent with prefetchSize. I'm missing
something simple, I know it :-)

 





--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-test-prefetch-size-is-actually-working-tp4709766.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to test prefetch size is actually working

Posted by Tim Bain <tb...@alumni.duke.edu>.
I believe that's correct, though I've never tried it myself so I don't have
firsthand knowledge.
On Mar 21, 2016 8:12 AM, "Raffi" <ra...@gmail.com> wrote:

> Tim,
>
> Wow, thank you; my assumption was totally wrong.
>
> On the flip side, to ensure my understand of optimizedAcknowlege="true"
> isn't wrong either, does the client "ack" groups of messages using a single
> network call instead of individually? (Batch size being 65% of
> prefetchSize)
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-test-prefetch-size-is-actually-working-tp4709766p4709780.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: How to test prefetch size is actually working

Posted by Raffi <ra...@gmail.com>.
Tim,

Wow, thank you; my assumption was totally wrong.

On the flip side, to ensure my understand of optimizedAcknowlege="true"
isn't wrong either, does the client "ack" groups of messages using a single
network call instead of individually? (Batch size being 65% of prefetchSize)



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-test-prefetch-size-is-actually-working-tp4709766p4709780.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to test prefetch size is actually working

Posted by Tim Bain <tb...@alumni.duke.edu>.
You're misunderstanding what the prefetch size is.  It doesn't mean the
broker dispatches messages in groups of N, it means that the broker
dispatches messages individually until there are N outstanding, and when a
message is acknowledged then another individual message will be dispatched
to get back to N.

The DispatchedQueueSize attribute you already found should always be equal
to the prefetch size (or working to get to the prefetch size).

A larger prefetch size won't reduce network traffic (in fact, it'll
increase it right after the consumer connects, because you're transferring
N-1 more messages to fill the prefetch buffer); rather it gives you a
buffer of available messages so the consumer isn't waiting for a network
transfer when you have a variable-speed network and/or a variable time to
consume messages.  If your network is fast and reliable and your messages
all take the same amount of time to process, prefetch doesn't do you any
good (and it makes it harder to load-balance across additional consumers).

Tim
On Mar 20, 2016 10:13 PM, "Raffi" <ra...@gmail.com> wrote:

> Is there a JMX metric for testing prefetch=1 vs prefetch=100? I want to
> confirm reduced network activity between consumer and broker when using
> large prefetchSize. DispatchedCounter and DispatchedQueueSize appear to
> increment/decrement by 1, never consistent with prefetchSize. I'm missing
> something simple, I know it :-)
>
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-test-prefetch-size-is-actually-working-tp4709766.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>