2009/6/11 Rafael Schloming <rafa...@redhat.com>:
> Martin Ritchie wrote:
>>
>> Hi,
>>
>> Just wanted to generate some discussion on peoples thoughts around
>> changing the Java prefetch from its current 5000 value to 1.
>>
>> Having a default of 1 will work for all users and prevent users from
>> hurting themselves when they use priority queues or TTL and expect
>> things to just work.
>>
>> If users know what they're messaging profile is and so know what they
>> are doing then they can set the maxprefetch to a higher value.
>>
>> Thoughts/ Comments?
>
> I'm generally in favor of changing the default to something safer than 5000,
> assuming that it is prominently documented how to adjust it for performance.
>
> One thought though -- shouldn't the default for consumers with no listeners
> actually be zero so that you don't have a messaging sitting around waiting
> for a receive() call that may never come?
>
> --Rafael
>

I'm a little concerned about this proposal (without some more details)...

Having a very small prefetch works fine for when you use
MessageListeners ... but if you are using receive() then you can't
guarantee that the next message that you get is going to be for the
"correct" consumer... (you would need to be able issue credit on a per
consumer basis - as in AMQP1-0).  If you have only one consumer on the
session then there is no issue, but if you have multiple consumers
using receive() then I would think that you're pretty likely to
deadlock if prefetch is set too low (to fix this you would need to
have some way of automatically increasing prefetch when doing a
receive() every time you get a message for the "wrong" consumer in the
hope you'll eventually get a message for the "right" one).

The problem with the default is that is an absolute number when what
you really want is something related to the consumption rate...  If
you are getting through 500,000msg/s then a prefect of 5000 is
nothing... if you are processing 1 msg/s then 5000 is a significant
backlog to be holding on to.

-- Rob

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to