activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Komandur <>
Subject Re: [jira] Commented: (AMQ-850) add the ability to timeout a consumer to
Date Thu, 10 Aug 2006 04:49:46 GMT

>> 1. can we use an 'elastic prefetch' buffer based on a sliding window (like
>> in TCP)  - this reacts to client (mis)behavior

>We could start with a prefetch of 1 and increase it over time for well
>behaving clients. However it doesn't fix the problem as a mis-behaving
>consumer could still hog at least one message - though this would
>reduce the imact from 1000 or so to 1. 

Note that the prefetch window needs to follow the standard tcp stuff 
of multiplicative decrease during problem period  & additive increase upon
positive ack (IMHO,
there isn't much to be gained in reinventing the TCP flow control wheel,
which has been
honed for over a decade.)

This helps in several ways:

- Messages are dispatched as soon as possible, as slow consumer will
automatically have a smaller 'prefetch window'. In fact by decaying the
'prefetch window' (like in the latest implementations
of TCP flow control), a new slow consumer's window automatically shrinks.

- I am not sure I understand the  'one message hog' case. Most of the
consumers are idempotent (there are many failure cases to count on 'once and
only once' delivery). So there is no harm in redelivering this one message
for which no ack has been received yet.

>> 2. When the broker detects a misbehaving client, reclaim the unAcked
>> messages for other active consumers (and make the window size 0 or 1 in
>> step
>> 1 above)

>If a client/connection misbehaves (e.g. becomes inactive) then the
>connection is closed and all consumers are closed too causing all
>their unacked messages to be redelivered.

This sounds good. However, please note that misbehavior is not necessarily a
binary state.
Sometimes an ACK could be delayed for many reasons (either transient
consumer (mis) behavior or other network related issues). It is in the gray
areas that the tcp flow control works really well.

Thanks James,
- Sridhar Komandur

View this message in context:
Sent from the ActiveMQ - Dev forum at

View raw message