You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Pavan Sheel <pa...@yahoo.com> on 2006/11/09 02:42:23 UTC

Load balancing message groups

I'm having a problem getting the message groups feature to work.
Essentially , I am unable to get ActiveMQ to load-balance message groups
across multiple queue consumers.

I ran a set of tests...below is the observed behaviour.

Two consumers on separate VMs , connected to a single AMQ broker via tcp
transport.
Consumers pull messages (not JCA consumers).
200 messages pushed onto queue.
JMSXGroupID  increases from 0 - 19 , in groupsize of 10 (therefore there are
20 groups)


I expected delivery of these 20 groups to be load-balanced between the two
consumers.
However , this is what I see :

·       All messages are delivered to one consumer.
.       Explicitly setting consumer.exclusive=false does not cause group
balancing (to ensure that the previous result was not because of a default
true value).
·	Slowing down consumers does not cause group balancing.
·	Differentiating groupID values substantially (to ensure different
hashcodes) does not cause group balancing.
·	Stopping active consumer midway does make broker switch to the other
consumer.
·	Eliminating JMSXGroupID header causes message balancing (ie messages are
evenly delivered to one or the other consumer).
·	Eliminating JMSXGroupID header & setting consumer.exclusive=true does
cause broker to choose one or the other consumer for delivery of all
messages.
·	Setting mutually exclusive selectors on each consumer does force delivery
of some groups to one consumer and some to the other,  according to the
selectors (to ensure that the broker is not 'pinning' all groups to one
consumer)

SUMMARY :
When JMSXGroupID is not set , broker does message-level load balancing  (as
expected).
However - when JMSXGroupID is set , broker seems to choose one consumer
(constrained by selector , if any) , and delivers all messages to it (as if
consumer.exclusive=true).
While this delivery behaviour is semantically safe , it is preventing me
from getting groups to load-balance across consumers.

How can I get message group delivery to load-balance across multiple
consumers ?
What am I doing wrong ?

All suggestions much appreciated -
Pavan Bhatnagar


-- 
View this message in context: http://www.nabble.com/Load-balancing-message-groups-tf2599197.html#a7251011
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Load balancing message groups

Posted by Pavan Sheel <pa...@yahoo.com>.

Thank you James.

Ran some more tests...this is what I found:
- Setting broker dispatch policy to roundRobinDispatchPolicy was
ineffective.
- Reducing consumer.prefetchSize on ActiveMQQueue works.

Obviously , I would have liked dispatch policy to work , since the prefetch
approach does affect efficiency , and the exact settings to get even message
distribution depends on actual rates of message production & consumption.

So now I have two questions :
1) Why is setting dispatch policy not working ? (I'm using
activemq-core-4.0.1.jar)
2) How come if I do *not* set JMSXGroupID header , then the broker *is*
doing even message distribution across multiple consumers (regardless of
dispatch policy OR prefetchSize)


tx
Pavan



James.Strachan wrote:
> 
> I suspect its because you are using such a small number of messages.
> 
> http://incubator.apache.org/activemq/i-do-not-receive-messages-in-my-second-consumer.html
> 
> try setting the prefetch to 10 or something - or sending way more messages
> 
> On 11/9/06, Pavan Sheel <pa...@yahoo.com> wrote:
>>
>> I'm having a problem getting the message groups feature to work.
>> Essentially , I am unable to get ActiveMQ to load-balance message groups
>> across multiple queue consumers.
>>
>> I ran a set of tests...below is the observed behaviour.
>>
>> Two consumers on separate VMs , connected to a single AMQ broker via tcp
>> transport.
>> Consumers pull messages (not JCA consumers).
>> 200 messages pushed onto queue.
>> JMSXGroupID  increases from 0 - 19 , in groupsize of 10 (therefore there
>> are
>> 20 groups)
>>
>>
>> I expected delivery of these 20 groups to be load-balanced between the
>> two
>> consumers.
>> However , this is what I see :
>>
>> ·       All messages are delivered to one consumer.
>> .       Explicitly setting consumer.exclusive=false does not cause group
>> balancing (to ensure that the previous result was not because of a
>> default
>> true value).
>> ·       Slowing down consumers does not cause group balancing.
>> ·       Differentiating groupID values substantially (to ensure different
>> hashcodes) does not cause group balancing.
>> ·       Stopping active consumer midway does make broker switch to the
>> other
>> consumer.
>> ·       Eliminating JMSXGroupID header causes message balancing (ie
>> messages are
>> evenly delivered to one or the other consumer).
>> ·       Eliminating JMSXGroupID header & setting consumer.exclusive=true
>> does
>> cause broker to choose one or the other consumer for delivery of all
>> messages.
>> ·       Setting mutually exclusive selectors on each consumer does force
>> delivery
>> of some groups to one consumer and some to the other,  according to the
>> selectors (to ensure that the broker is not 'pinning' all groups to one
>> consumer)
>>
>> SUMMARY :
>> When JMSXGroupID is not set , broker does message-level load balancing 
>> (as
>> expected).
>> However - when JMSXGroupID is set , broker seems to choose one consumer
>> (constrained by selector , if any) , and delivers all messages to it (as
>> if
>> consumer.exclusive=true).
>> While this delivery behaviour is semantically safe , it is preventing me
>> from getting groups to load-balance across consumers.
>>
>> How can I get message group delivery to load-balance across multiple
>> consumers ?
>> What am I doing wrong ?
>>
>> All suggestions much appreciated -
>> Pavan Bhatnagar
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Load-balancing-message-groups-tf2599197.html#a7251011
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Load-balancing-message-groups-tf2599197.html#a7284415
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Load balancing message groups

Posted by sumitkishore <su...@gmail.com>.
Same issue, except I'm using ActiveMQ 5.5. And even with
consumer.prefetchSize=1, I still have messages for all group IDs being sent
to consumers on only one of the JVMs. 

Even more intriguing, if I let the whole thing run for a longish period, I
*do* see some or all of the message groups switching over to a different
JVM, but this is not very repeatable, and I can't discern a pattern to it.

I've tried everything in this chain. What else can I try?

--
View this message in context: http://activemq.2283324.n4.nabble.com/Load-balancing-message-groups-tp2349471p3465452.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Load balancing message groups

Posted by James Strachan <ja...@gmail.com>.
I suspect its because you are using such a small number of messages.

http://incubator.apache.org/activemq/i-do-not-receive-messages-in-my-second-consumer.html

try setting the prefetch to 10 or something - or sending way more messages

On 11/9/06, Pavan Sheel <pa...@yahoo.com> wrote:
>
> I'm having a problem getting the message groups feature to work.
> Essentially , I am unable to get ActiveMQ to load-balance message groups
> across multiple queue consumers.
>
> I ran a set of tests...below is the observed behaviour.
>
> Two consumers on separate VMs , connected to a single AMQ broker via tcp
> transport.
> Consumers pull messages (not JCA consumers).
> 200 messages pushed onto queue.
> JMSXGroupID  increases from 0 - 19 , in groupsize of 10 (therefore there are
> 20 groups)
>
>
> I expected delivery of these 20 groups to be load-balanced between the two
> consumers.
> However , this is what I see :
>
> ·       All messages are delivered to one consumer.
> .       Explicitly setting consumer.exclusive=false does not cause group
> balancing (to ensure that the previous result was not because of a default
> true value).
> ·       Slowing down consumers does not cause group balancing.
> ·       Differentiating groupID values substantially (to ensure different
> hashcodes) does not cause group balancing.
> ·       Stopping active consumer midway does make broker switch to the other
> consumer.
> ·       Eliminating JMSXGroupID header causes message balancing (ie messages are
> evenly delivered to one or the other consumer).
> ·       Eliminating JMSXGroupID header & setting consumer.exclusive=true does
> cause broker to choose one or the other consumer for delivery of all
> messages.
> ·       Setting mutually exclusive selectors on each consumer does force delivery
> of some groups to one consumer and some to the other,  according to the
> selectors (to ensure that the broker is not 'pinning' all groups to one
> consumer)
>
> SUMMARY :
> When JMSXGroupID is not set , broker does message-level load balancing  (as
> expected).
> However - when JMSXGroupID is set , broker seems to choose one consumer
> (constrained by selector , if any) , and delivers all messages to it (as if
> consumer.exclusive=true).
> While this delivery behaviour is semantically safe , it is preventing me
> from getting groups to load-balance across consumers.
>
> How can I get message group delivery to load-balance across multiple
> consumers ?
> What am I doing wrong ?
>
> All suggestions much appreciated -
> Pavan Bhatnagar
>
>
> --
> View this message in context: http://www.nabble.com/Load-balancing-message-groups-tf2599197.html#a7251011
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/