You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Olivier OTTAVI <ol...@gmail.com> on 2007/09/05 15:23:49 UTC

PooledConnectionFactory - Spring - Loadbalancing in a network

Dear all,

 I am trying to use the PooledConnectionFactory with Spring on a producer
connected to a network of brokers (B1 and B2).

 The scenario is the following : I start B1 and B2 and send 100 messages to
the network with the brokerURL : failover:(tcp://myip:61616,
tcp://myip:62626) .

 Then I stop one of the broker, and start three receivers on the same
destination queue.

 In the case I did not use the PooledConnectionFactory, the receivers get
only the messages that went to the broker still alive in the network,

 but when I use PooledConnectionFactory, depending on the broker I stopped,
I get all the messages or none of them, so I think in this case, load
balancing, is not properly processing when the message are dispatched.

Any advice on the configuration of a dispatcher with spring.

Re: PooledConnectionFactory - Spring - Loadbalancing in a network

Posted by James Strachan <ja...@gmail.com>.
On 9/6/07, Olivier OTTAVI <ol...@gmail.com> wrote:
> That will result in easier connection managment between the nodes of the
> network and even load of each brokers. I would like to be able to scale the
> network of brokers without scaling automatically the producers. Like 2
> producers and 3 brokers etc. Is Iona recommand architecture where load
> balancing is done by assigning producers with specific broker ? Beside
> thanks for the information on the average load that a broker can assume.
>

The worry of using a store and forward network of brokers as a way to
load balance load (when usually the broker isn't the node with the
load issue), is that if you're not careful the load actually increases
on the brokers as brokers have to forward messages to other brokers;
so reducing the actual load they can handle to real consumers.
(ActiveMQ does give priority to local consumers to try avoid this
though).

FWIW a simpler approach to do what you want -to load messaging traffic
dynamically across brokers - has been described on and off as the
"jedi" transport...

http://www.nabble.com/Load-Balancing-with-Single-Consumer-tf2252613s2354.html#a6260227
http://issues.apache.org/activemq/browse/AMQ-816

Its basically an extension of the FanOut transport where each JMS
client connects to multiple brokers and subscribing directly to each
broker and sending messages to either one broker chosen possibly
randomly for queue operations, or to all brokers for topic style
operations.

This will scale much better as it avoids the problems of store/forward
(namely having to forward messages from broker to broker); the only
real cost of this approach is the increase in the number of
connections to each broker. But these days, if you enable enough file
descriptors; brokers can handle many thousands of concurrent
connections with ease. (If you've an insanely big network and load you
might wanna use store and forward between JEDI domains).

If you fancy taking a stab at implementing the JEDI transport, by
deriving (or just copy/pasting) from the FanOut transport am sure it
wouldn't be too hard to do & folks on the dev list would definitely
help you out - many of us have wanted the JEDI transport for a while.

The only really complicated bits are making sure that

(i) transactions work (so all message exchanges with transactions go
to a single broker only) - though you might wish to have N
transactions on each of your N broker connections and

(ii) queue messages only go to one broker

(iii) topic messages go to all messages.

(iv) MessageAck only go to the broker which delivered the Message.

So the only real difference between FanOut transport is choosing the
broker(s) that an outbound Command object goes to. Fancy taking a stab
at it? :)

-- 
James
-------
http://macstrac.blogspot.com/

Re: PooledConnectionFactory - Spring - Loadbalancing in a network

Posted by Olivier OTTAVI <ol...@gmail.com>.
That will result in easier connection managment between the nodes of the
network and even load of each brokers. I would like to be able to scale the
network of brokers without scaling automatically the producers. Like 2
producers and 3 brokers etc. Is Iona recommand architecture where load
balancing is done by assigning producers with specific broker ? Beside
thanks for the information on the average load that a broker can assume.

On 9/6/07, James Strachan <ja...@gmail.com> wrote:
>
> On 9/6/07, Olivier OTTAVI <ol...@gmail.com> wrote:
> > It seems from my perspective that the PooledConnectionFactory is caching
> > only one connection to the network. Since load balancing between nodes
> is
> > done at connection time, using PooledConnectionFactory will not work
> with
> > load balancing. Will this be a problem to have a real pool of jms
> > connections ? to preserve load balancing, and use pooling which reduce
> the
> > process of producing messages by a factor 10.
>
> Just out of interest; why are you trying to load balance JMS requests
> across JMS brokers for a single JVM? (which generally breaks ordering
> of queues)?. Why not have each JVM connect to one broker?  Test load
> balancing with multiple client JVMs?
>
> FWIW a single broker can usually handle a few thousand client JVMs; so
> the idea of one JVM talking to multiple brokers does seen a tad odd?
> Are you sure you're not confusing load balancing of consumers with
> that of having mutliple brokers?
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>

Re: PooledConnectionFactory - Spring - Loadbalancing in a network

Posted by James Strachan <ja...@gmail.com>.
On 9/6/07, Olivier OTTAVI <ol...@gmail.com> wrote:
> It seems from my perspective that the PooledConnectionFactory is caching
> only one connection to the network. Since load balancing between nodes is
> done at connection time, using PooledConnectionFactory will not work with
> load balancing. Will this be a problem to have a real pool of jms
> connections ? to preserve load balancing, and use pooling which reduce the
> process of producing messages by a factor 10.

Just out of interest; why are you trying to load balance JMS requests
across JMS brokers for a single JVM? (which generally breaks ordering
of queues)?. Why not have each JVM connect to one broker?  Test load
balancing with multiple client JVMs?

FWIW a single broker can usually handle a few thousand client JVMs; so
the idea of one JVM talking to multiple brokers does seen a tad odd?
Are you sure you're not confusing load balancing of consumers with
that of having mutliple brokers?

-- 
James
-------
http://macstrac.blogspot.com/

Re: PooledConnectionFactory - Spring - Loadbalancing in a network

Posted by Olivier OTTAVI <ol...@gmail.com>.
It seems from my perspective that the PooledConnectionFactory is caching
only one connection to the network. Since load balancing between nodes is
done at connection time, using PooledConnectionFactory will not work with
load balancing. Will this be a problem to have a real pool of jms
connections ? to preserve load balancing, and use pooling which reduce the
process of producing messages by a factor 10.



On 9/5/07, Olivier OTTAVI <ol...@gmail.com> wrote:
>
> Dear all,
>
>  I am trying to use the PooledConnectionFactory with Spring on a producer
> connected to a network of brokers (B1 and B2).
>
>  The scenario is the following : I start B1 and B2 and send 100 messages
> to the network with the brokerURL : failover:(tcp://myip:61616,
> tcp://myip:62626) .
>
>  Then I stop one of the broker, and start three receivers on the same
> destination queue.
>
>  In the case I did not use the PooledConnectionFactory, the receivers get
> only the messages that went to the broker still alive in the network,
>
>  but when I use PooledConnectionFactory, depending on the broker I
> stopped, I get all the messages or none of them, so I think in this case,
> load balancing, is not properly processing when the message are dispatched.
>
> Any advice on the configuration of a dispatcher with spring.
>
>
>