activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjiv Jivan" <sanjiv.ji...@gmail.com>
Subject Re: detaching message group affinity
Date Mon, 19 Jun 2006 20:11:07 GMT
Hi,
I setup a network of three multicast based brokers on my machine. The server
app embeds each of these brokers. The client issues a command with a message
group as an argument. I made requests to 11 message groups ("A", "B", ....
"K") and as you can see from the screenshot below, message group "E" when to
broker1, message group "K" when to broker2, while all the other 9 message
groups when to broker3. (I even sent like 30 messages and the distribution
was broker1 = 2 messages, broker2=3 messages, broker3=25 messages)

http://www.jroller.com/resources/s/sjivan/lingo-mg.jpg

As suggested, I tried setting the consumer's destination queue prefetch to 1
(using url the option "?consumer.prefetch=1"), but the result was the same.
Consumer queu priority (using ?consumer.prority=10) also did not seem to
affect the load distribution across message groups.

My test client allows you to send requests specifying the message group from
a DOS shell. I do see the correct sticky and failover behaviour when I send
another message to message group "A" thorugh "K".

If you're interested in taking a look at this yourself, I have the source as
a maven project with the required statup bat files so it should be easy to
replicate the issue.

Thanks,
Sanjiv

On 6/19/06, Hiram Chirino <hiram@hiramchirino.com> wrote:
>
> On 6/19/06, Sanjiv Jivan <sanjiv.jivan@gmail.com> wrote:
> > On 6/19/06, James Strachan <james.strachan@gmail.com> wrote:
> > >
> > > On 6/17/06, Sanjiv Jivan <sanjiv.jivan@gmail.com> 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
> >
> >
>
>
> --
> Regards,
> Hiram
>
> Blog: http://hiramchirino.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message