You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by CASAUX Nicolas <ni...@soprasteria.com> on 2022/02/07 09:37:52 UTC

Limit prefetchSize from ActiveMQ side

Hello,

I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.

In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)

I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).

My question is: how can I set, change or force this value from ActiveMQ side ?

I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
That's why I would like to reduce this value.

Any hints on this ?
Thanks! :)

Nicolas


C2 - Usage restreint

RE: Limit prefetchSize from ActiveMQ side

Posted by CASAUX Nicolas <ni...@soprasteria.com>.
Hello!

Thank you JB, it works! :)

Nicolas



C2 – Usage restreint 

-----Message d'origine-----
De : JB Onofré <jb...@nanthrax.net> 
Envoyé : mardi 8 février 2022 08:09
À : users@activemq.apache.org
Objet : Re: Limit prefetchSize from ActiveMQ side

Hi

You can set the prefetch size on the destination policy entry in the ActiveMQ.xml. 

Regards 
JB

> Le 8 févr. 2022 à 07:53, Simon Lundström <si...@su.se> a écrit :
> 
> On Mon, 2022-02-07 at 10:37:52 +0100, CASAUX Nicolas wrote:
>> Hello,
>> 
>> I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.
>> 
>> In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
>> I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
>> I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)
>> 
>> I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).
>> 
>> My question is: how can I set, change or force this value from ActiveMQ side ?
>> 
>> I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
>> That's why I would like to reduce this value.
>> 
>> Any hints on this ?
>> Thanks! :)
>> 
>> Nicolas
>> 
>> 
>> C2 - Usage restreint
> 
> I belive you can set the default on your transportConnector, see https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Factivemq.apache.org%2Fmqtt.html%23message-prefetch&amp;data=04%7C01%7Cnicolas.casaux%40soprasteria.com%7C77cf5db0d1c54de074c108d9ead1dc0b%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C637799009329154441%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=TALREp7ajSSJ9qyY0JHJRCccYuHLo20%2FIdvQcOWFB5A%3D&amp;reserved=0
> 
> BR,
> - Simon

Re: Limit prefetchSize from ActiveMQ side

Posted by JB Onofré <jb...@nanthrax.net>.
Hi

You can set the prefetch size on the destination policy entry in the ActiveMQ.xml. 

Regards 
JB

> Le 8 févr. 2022 à 07:53, Simon Lundström <si...@su.se> a écrit :
> 
> On Mon, 2022-02-07 at 10:37:52 +0100, CASAUX Nicolas wrote:
>> Hello,
>> 
>> I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.
>> 
>> In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
>> I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
>> I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)
>> 
>> I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).
>> 
>> My question is: how can I set, change or force this value from ActiveMQ side ?
>> 
>> I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
>> That's why I would like to reduce this value.
>> 
>> Any hints on this ?
>> Thanks! :)
>> 
>> Nicolas
>> 
>> 
>> C2 - Usage restreint
> 
> I belive you can set the default on your transportConnector, see https://activemq.apache.org/mqtt.html#message-prefetch
> 
> BR,
> - Simon


Re: Limit prefetchSize from ActiveMQ side

Posted by Simon Lundström <si...@su.se>.
You learn something new, every day = ) (well, atleast on a good day ; )

JB: OK! What's the difference between transport.prefetch and
consumer.prefetchSize?

BR,
- Simon

On Tue, 2022-02-08 at 09:50:17 +0100, CASAUX Nicolas wrote:
> Hello Simon,
> 
> I tested this and it does NOT work.
> As per my understanding, this setting is for the connection string of the consumer.
> 
> The solution provided by JB works however (using per destination policy).
> 
> Nicolas
> 
> 
> C2 - Usage restreint 
> 
> -----Message d'origine-----
> De : Simon Lundström <si...@su.se> 
> Envoyé : mardi 8 février 2022 07:54
> À : users@activemq.apache.org
> Objet : Re: Limit prefetchSize from ActiveMQ side
> 
> [Vous ne recevez pas souvent de courriers de la part de simlu@su.se. D?couvrez pourquoi cela peut ?tre important ? l'adresse http://aka.ms/LearnAboutSenderIdentification.]
> 
> On Mon, 2022-02-07 at 10:37:52 +0100, CASAUX Nicolas wrote:
> > Hello,
> >
> > I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.
> >
> > In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
> > I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
> > I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)
> >
> > I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).
> >
> > My question is: how can I set, change or force this value from ActiveMQ side ?
> >
> > I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
> > That's why I would like to reduce this value.
> >
> > Any hints on this ?
> > Thanks! :)
> >
> > Nicolas
> >
> >
> > C2 - Usage restreint
> 
> I belive you can set the default on your transportConnector, see https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Factivemq.apache.org%2Fmqtt.html%23message-prefetch&amp;data=04%7C01%7Cnicolas.casaux%40soprasteria.com%7C6a9b7645675546c7873908d9eacfc143%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C637799000872157995%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=SLM%2Bu3422R1zFeYx7Y285z8DxXR6ZJyXhx6sQ4q09VQ%3D&amp;reserved=0
> 
> BR,
> - Simon

RE: Limit prefetchSize from ActiveMQ side

Posted by CASAUX Nicolas <ni...@soprasteria.com>.
Hello Simon,

I tested this and it does NOT work.
As per my understanding, this setting is for the connection string of the consumer.

The solution provided by JB works however (using per destination policy).

Nicolas


C2 - Usage restreint 

-----Message d'origine-----
De : Simon Lundström <si...@su.se> 
Envoyé : mardi 8 février 2022 07:54
À : users@activemq.apache.org
Objet : Re: Limit prefetchSize from ActiveMQ side

[Vous ne recevez pas souvent de courriers de la part de simlu@su.se. D?couvrez pourquoi cela peut ?tre important ? l'adresse http://aka.ms/LearnAboutSenderIdentification.]

On Mon, 2022-02-07 at 10:37:52 +0100, CASAUX Nicolas wrote:
> Hello,
>
> I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.
>
> In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
> I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
> I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)
>
> I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).
>
> My question is: how can I set, change or force this value from ActiveMQ side ?
>
> I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
> That's why I would like to reduce this value.
>
> Any hints on this ?
> Thanks! :)
>
> Nicolas
>
>
> C2 - Usage restreint

I belive you can set the default on your transportConnector, see https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Factivemq.apache.org%2Fmqtt.html%23message-prefetch&amp;data=04%7C01%7Cnicolas.casaux%40soprasteria.com%7C6a9b7645675546c7873908d9eacfc143%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C637799000872157995%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=SLM%2Bu3422R1zFeYx7Y285z8DxXR6ZJyXhx6sQ4q09VQ%3D&amp;reserved=0

BR,
- Simon

Re: Limit prefetchSize from ActiveMQ side

Posted by Simon Lundström <si...@su.se>.
On Mon, 2022-02-07 at 10:37:52 +0100, CASAUX Nicolas wrote:
> Hello,
> 
> I'm using ActiveMQ < classic > 5.16.0 and I have a question related to slow consumers.
> 
> In my use case, I only use topics with non-durable messages. As per the doc, the prefetchSize is 32767.
> I have a constantPendingMessageLimitStrategy on this topic with a limit of 1000 messages.
> I can observe both values on the webconsole accordingly when they reach the limit (I see 32767 messages in the dispatch queue size and 1000 messages in the pending queue size)
> 
> I have a bunch of slow consumers, which do not set any prefetchSize (hence they have the default 32767 value).
> 
> My question is: how can I set, change or force this value from ActiveMQ side ?
> 
> I don't want those consumers to connect without a prefetchSize value, and I consider the default value too high for my usecase.
> That's why I would like to reduce this value.
> 
> Any hints on this ?
> Thanks! :)
> 
> Nicolas
> 
> 
> C2 - Usage restreint

I belive you can set the default on your transportConnector, see https://activemq.apache.org/mqtt.html#message-prefetch

BR,
- Simon