activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petter Nordlander <>
Subject Re: How to limit queue depth by #msgs
Date Thu, 08 Jan 2015 16:25:49 GMT
Thanks for the reply. Prefetch is not really a problem, since in this
scenario I tend to use 1 as reliability is the only concern, not
performance in this case.

Number of messages is sometime a better measurement than memory, and a
more valid constraint. It¹s easier to cope with a requirement that ²we
will buffer N orders² rather than ²we will buffer N MB worth of orders².

I will consider adding a feature request and, if it¹s not too time
consuming, see what it takes to submit a patch.

BR Petter

Den 2015-01-08 16:08 skrev Tim Bain <>:

>I'm not aware of a way to limit queue depth by number of messages that
>invoke producer flow control, which is the behavior I assume you want to
>result when you hit the limit.  We actually just disabled per-destination
>memory limits in our broker because of the difficulty of guaranteeing that
>we'd always be able to fit a full prefetch buffer worth of messages into N
>MB of space; without that, we risked flow controlling producers when
>consumers were slow (or entirely unresponsive) before the broker built up
>enough messages to consider the consumer slow and abort it via the
>AbortSlowConsumerStrategy.  So there's probably an enhancement request
>should get submitted to allow per-destination limits to be set in terms of
>number of messages.  (I just searched for an existing enhancement request
>to cover this and didn't find one.)
>If you're looking to discard messages when you hit the limit rather than
>flow control producers, you can use one of the
>implementations to discard messages without flow controlling producers.
>But I'd guess this probably isn't what you're looking for.
>On Thu, Jan 8, 2015 at 12:35 AM, Petter Nordlander <
>> wrote:
>> Hi,
>> Is there a way to limit the queue depth of an ActiveMQ queue in number
>> messages?
>> I know there are ²per destination policies² that can detect queue usage
>> terms of memory used. However, the number of messages may indicate other
>> things, like how many .log files (kahadb) that can be tied up by a
>> queue where the consumer is infrequent (or just unstable).
>> BR Petter

View raw message