Multiple connections performance

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple connections performance

rabbit15
Hi, could you tell me why many connections are faster than one connection ?
I read that better is to use many channels, but only one connection.
Best Regards,
Artur
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

Tim Watson-6
Hi Artur

On 5 Mar 2013, at 12:43, rabbit15 wrote:
> Hi, could you tell me why many connections are faster than one connection ?

If your server is processing multiple connections concurrently then it is possible that you will be able to take advantage of parallelism and gain a performance boost. This may *not* happen of course, if for example the connections are writing to the same queue (in which case input has to be serialised), so it depends on how your application(s) will be structured and the topology your using and so on.

> I read that better is to use many channels, but only one connection.

Connections are much more resource intensive that channels, both on the client and the server. Connection use constrained resources (i.e., file descriptors) which channels do not. Multiplexing channels over a single connections is pretty much transparent to the application. Connections which are publishing can become blocked when the server is overloaded (i.e., hits the memory high watermark) however, so if you're publishing and consuming in the same client application then using separate connections might be advantageous (so that flow control doesn't block the consumer).

Cheers,
Tim
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

Tim Watson-6
On 5 Mar 2013, at 14:41, Tim Watson wrote:
> so it depends on how your application(s) will be structured and the topology your using and so on.

I'm having a bad spelling day today: s/your/you're/
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

rabbit15
Thank you !
Artur
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

rabbit15
Hi, I have question about channels and connections.
Why flow control doesn't block channel instead of connection ? My application performs the best when I'm using one connection per one channel. Why flow control of one channel degraded speed of other channels in the connection ? What is the idea of using channels if I have to use connection per channel for optimal performance?
Artur
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

Tim Watson-6
Hi Artur,

On 6 Mar 2013, at 08:30, rabbit15 wrote:
> Hi, I have question about channels and connections.
> Why flow control doesn't block channel instead of connection ?

Due to the limitations of the AMQP protocol, it can't be done on per-channel basis.

> My
> application performs the best when I'm using one connection per one channel.
> Why flow control of one channel degraded speed of other channels in the
> connection ?

Rabbit's flow control mechanism applies TCP back-pressure to producers to give the broker (and/or consumers) time to catch up. Doing it that way on a per-channel basis wouldn't work, because all the channels are multiplexed over a single TCP connection.

> What is the idea of using channels if I have to use connection
> per channel for optimal performance?

As the documentation points out...

<quote>
.. it is undesirable to keep many TCP connections open at the same time because doing so consumes system resources and makes it more difficult to configure firewalls..
</quote>

Cheers,
Tim

> Artur
>
>
>
> --
> View this message in context: http://rabbitmq.1065348.n5.nabble.com/Multiple-connections-performance-tp25275p25296.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> [hidden email]
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

rabbit15
Thanks a lot!
Cheers,
Artur
Reply | Threaded
Open this post in threaded view
|

Re: Multiple connections performance

francois
In reply to this post by rabbit15

Le 2013-03-06 à 03:30, rabbit15 a écrit :

> Hi, I have question about channels and connections.
> Why flow control doesn't block channel instead of connection ? My
> application performs the best when I'm using one connection per one channel.
> Why flow control of one channel degraded speed of other channels in the
> connection ? What is the idea of using channels if I have to use connection
> per channel for optimal performance?

I keep two connections open per process: one for producing and another for consuming. I essentially use one-way connections. Works great for us, and prevents consumers from being blocked because of flow control.

Bye!
François


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

smime.p7s (5K) Download Attachment