activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <>
Subject Re: detaching message group affinity
Date Mon, 19 Jun 2006 15:35:38 GMT
On 6/19/06, Sanjiv Jivan <> wrote:
> On 6/19/06, James Strachan <> wrote:
> >
> > On 6/17/06, Sanjiv Jivan <> wrote:
> > > The Message Group functionality of Active MQ 4.0 is really neat. I have
> > a
> > > couple of questions regarding this
> > >
> > > 1. Is this feature fully supported/tested with the P2P discovery style
> > > broker topology? Are they any test cases or samples I can try. I looked
> > for
> > > them in the source but wasn't able to locate them. And when I tried
> > running
> > > such a scenario, I did not see a proper load balancing (even round robin
> > > style) of message groups across available brokers. When messages
> > belonging
> > > to different message groups are sent, oftentimes only one or a small
> > > percentage of running brokers are chosen as recipients. As a result I
> > end up
> > > with some brokers that are overloaded while others are sitting idle.
> >
> > Generally Message Groups only apply to the broker which you are using;
> > there is no global cross-broker load balancing. So its intended when
> > using a traditional client-broker topology rather than a peer based
> > network.
> >
> > Though I'm surprised that you are finding on a single broker it is not
> > load balancing requests across multiple brokers. Are you sure there
> > are suitable consumers on those brokers?
> Consider a scenario where there are two servers, each of which have an
> embedded broker. What I'm seeing is that when clients send messages using
> Message Groups "MG1", "MG2", "MG3" and "MG4" etc,  the messages with these
> different message groups aren't load balanced as expected. For example, MG1
> and MG2 (and sometimes even MG3) might be received by SERVER1. I was
> expected MG1 to go to SERVER1, MG2 to SERVER2, MG3 to SERVER1, MG4 to
> SERVER2 and so on.. The sample app that I uploaded with issue AMQ-760
> demonstrates this. Is this the expected behaviour? What is the message group
> based load balancing algorithm used?

This is a bit complex.  So the first message in a group chooses who
the owner for the group is and that algorithm is the same that we use
in normal queue message dispatching.  So, it's round robin until a
consumer's pre-fetch is full, and then he gets skipped.  The complex
bit is that we don't keep a separate round robin list for message
groups, we are using the same round robin list that's used during
normal message dispatching.  And ownership of messages is tied to
order of dispatching.

So you can a a situations where  if I have 3 consumers and  then have
the following order of sends:
1) send message 1, group 1 -> dispatch to consumer 1 first, it obtains
ownership of message and group
2) send message 2, group 1 -> dispatch to consumer 2 first, but
consumer retains ownership since it's in a group that it owns.
3) send message 3, without a group -> dispatch to consumer 3 first,
and that consumer gets ownership of the message
4) send message 1, group2 -> dispatch to consumer 1 first, it obtains
ownership of message and group.

So.. I guess you can see now who message groups could protentialy get
unbalanced if the right sequence of messages come in.

> > 2. Is there a way to detach a message group affinity to a particular
> broker.
> >Just set JMSXGroupSeq to zero on the last message which 'closes' the
> >message group so if another message is sent in the future with the
> >same group ID it will be reassigned to a new consumer.
> >message.setIntProperty("JMSXGroupSeq", 0);
> This would reset all the affinity of all the message groups, right? This
> does not help with my use case where a message group represents a
> conversation and there can be several "conversations" taking place at the
> same time. I would like the ability to end conversations on a per message
> group basis and not globally. For example messages from MG1 might be
> directed to SERVER1 and MG2 to SERVER2. After a sequence of operations, I
> would like to end the conversation for MG1 but do not want to end the
> conversation for MG2 and this might result in some MG2 messages going to
> SERVER1 which has no knowledge of MG2's prior conversation.
> Thanks,
> Sanjiv



View raw message