[rabbitmq-discuss] Best Practices using Connection and Channels

Matthew Sackman matthew at rabbitmq.com
Fri May 13 12:40:13 BST 2011


On Fri, May 06, 2011 at 11:40:48AM -0300, Marcus Vinitius Baffa wrote:
> *         1 Connection per application or 1 Connection per Client;

For the numbers you're talking about, 1 connection per application is
not going to be an issue. The IPC et al to do 1 connection per client is
likely going to be quite painful to do, so I'd not recommend that.

> *         1 Channel per Exchange/Queue and/or Thread. If the application
> has more than one thread each one must create a new channel using the
> same application/client connection. 

1 Channel per Thread is definitely best practise. Certainly in the Java
client it's unwise to share channels between threads, and I suspect the
same is true of the .net client.

> *         Some people advise to create a Channel Pools, is it a good
> practice. 

Generally no, because channels are stateful, and thus it's difficult to
ensure that a random channel grabbed from a pool is indeed in the
expected state. This is especially true of things like publisher
confirms, transactions etc.

Matthew


More information about the rabbitmq-discuss mailing list