[rabbitmq-discuss] Question about Connections and Channels

Thadeu Russo thadeurc at gmail.com
Thu Dec 23 13:51:29 GMT 2010


Hi Emilie,

thanks a lot for your comments.

One thing you pointed out called my attention:

"I would expect it to be more convenient for you to have an AMQP client in
each JVM and therefore use a connection per JVM. AMQP connections are cheap
resources and you need not try to conserve them. Brokers with tens of
thousands of connections are not unheard of."

This is the way I started implementing, and in each JVM I can have multiple
consumers and producer, so I was thinking about have 1 connection per JVM
with one channel per producer/consumer. I like the idea of separate
producers and consumers.

As the project goes, I will update the list with question/comments.

Best Regards,

On Wed, Dec 22, 2010 at 3:41 PM, Emile Joubert <emile at rabbitmq.com> wrote:

>
> Hi Thadeu,
>
> Your project sounds interesting. If I understand your question correctly
> you want to know if you should be using one connection with many channels,
> or many connections each with a single channel.
>
> A possibly relevant consideration is that if the broker needs to apply
> backpressure because of an overactive producer then all the channels sharing
> a connection with that producer will be blocked. Channels that can't
> tolerate this risk should have a connection to themselves. For the same
> reason you may want to separate producers and consumers to use different
> connections.
>
> I would expect it to be more convenient for you to have an AMQP client in
> each JVM and therefore use a connection per JVM. AMQP connections are cheap
> resources and you need not try to conserve them. Brokers with tens of
> thousands of connections are not unheard of.
>
>
> On 19/12/10 13:20, Thadeu Russo wrote:
>
>> Hi,
>>
>> I need to architect a Java application using rabbitmq as its message
>> broker. It is a distributed application and the message broker will play
>> the role of connect the JVMs. Basically, each JVM has sets of objects
>> (currently they are grouped by host:port) that can change messages to
>> other objects in other groups in other virtual machines (there is a 1:1
>> bi-directional relationship between groups of objects in different JVMs).
>> The idea of use the broker is to avoid the number of tcp ports I have to
>> open and also to take advantage of the message delivery guaranties.
>>
>> The design is simple: each group of objects will have an exchange and 2
>> queues (incoming and outcoming) to change messages.
>>
>> I would like to know if you guys advise the following configuration
>> regarding rabbitmq:
>>
>> 1- Have 1 connection per JVM
>> 2- Have multiple channels to that connection. Each channel will be
>> associated with those 2 queues
>>
>> What is concerning me is: the number of sends/receives per channel is
>> high (about 5k/second). Should I have multiple connections (like a
>> pool), or it is ok to use just 1 connection? If I have a pool of
>> connections, I understand they will share the same tcp port, and I could
>> not see any difference in using a single Connection.
>>
>
> The broker port will be same for each of multiple connections, but the peer
> port will typically be random. The difference is that connections with a
> single channel can fail and block without affecting other connections.
>
> Regards
>
> Emile
>



-- 
Thadeu de Russo e Carmo
http://www.thadeu.com.br/
http://www.caelum.com.br/
http://www.caelumobjects.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101223/78c8d840/attachment.htm>


More information about the rabbitmq-discuss mailing list