6 Replies Latest reply on Apr 1, 2010 1:56 PM by Tim Fox

    Cluster policy

    anil halil Novice

      Hi all, is there any way to change cluster policy? I mean documentation says that messages will be distributed in round robin fashion to other nodes in a cluster. But i want to change this policy like if there is a consumer on local queue i want to deliver 80% of the messages to local consumer. Is there any interface to imlement for server side cluster policy as client side org.hornetq.api.core.client.loadbalance.ConnectionLoadBalancingPolicy ?

        • 1. Re: Cluster policy
          Luke McLean Newbie

          The RoundRobin policy is indeed the default (according to the documentation http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html_single/index.html#clusters.client.loadbalancing).  You have obvioulsy found the documentation which explains how to change that policy for the client.

           

          Your proposed use case sounds strange to me as it doesn't appear to make a lot of sense. Could you explain why you would want that to happen? Why 80%? are you not better off load balancing over all consumers?

          • 2. Re: Cluster policy
            anil halil Novice

            Actually 80% percent thing is just an example. The thing we want to do is if there is a consumer on a queue on local machine then this message should be consumed by that consumer. We want to minimize network latency because it is realy important for us. We deploy local hornetq instances on every machine and all consumers and producers will use "vm" transport. We want our messages distrubute to other machines just in case of heavy load like 800 message per second(messages are financial messages so 800 message per second is a rare case but can be happen once a day). Let me give u an example to illustrate issue.

             

            Suppose we have a node named X which have service A and service B on it. Service A is behaves like both consumer and producer. The message flow like: a message consumed by service A and then outcome of service A consumed by service B. Now if a message consumed by service A on node X then we wants outcome produced by XA(service A on node X) to be processed by XB even if there is a service B on node Y. If u want i can draw a diagram to represent flow. Also services really can go and come because our program is based on osgi. Ability to change behaviour of cluster policy is really important for since it will also change our architecture.

            • 3. Re: Cluster policy
              anil halil Novice

              For example activemq has a support to affect cluster policy which is called consumer priorities. Local consumers always have higher priority compared with consumers in another broker instance to decrease network hop count. Any help?

              • 4. Re: Cluster policy
                Tim Fox Master

                anil halil wrote:

                 

                Hi all, is there any way to change cluster policy? I mean documentation says that messages will be distributed in round robin fashion to other nodes in a cluster. But i want to change this policy like if there is a consumer on local queue i want to deliver 80% of the messages to local consumer. Is there any interface to imlement for server side cluster policy as client side org.hornetq.api.core.client.loadbalance.ConnectionLoadBalancingPolicy ?

                This is quite funny actually.

                 

                The policy you describe is exactly the policy we used to have in JBoss Messaging (favour local consumer), however we dropped it in favour of straight forward round robin, because users were just finding it too confusing.

                 

                The normal complaint was, "I have 4 nodes in my cluster, why are all my messages being processed by one node?", I would then have to explain that's because the locall consumer is fast enough to do that, so there's no need to redistribute. This would normally confuse the hell out of people, and it resulted in many support cases.

                 

                It just goes to show, you can't please all of the people all of the time.

                • 5. Re: Cluster policy
                  anil halil Novice

                  Thanks tim. Is this behaviour default/fixed(i mean could not be change by some parameter or something)?  Also can i change this behaviour etditing and or rewriting the code?

                  • 6. Re: Cluster policy
                    Tim Fox Master

                    The behaviour is currently fixed, there is no way to configure it to use a different policy.

                     

                    You could,of course, amend the code to make it do what you want. If you do, feel free to submit a patch