RabbitMQ - Channel Pooling - Number of Channels per connection

988 views
Skip to first unread message

getaju69

unread,
Aug 19, 2020, 5:00:22 AM8/19/20
to rabbitmq-users
In the RabbitMQ documentation, I see:

Given both of these factors, limiting the number of channels used per connection is highly recommended. As a rule of thumb, most applications can use a single digit number of channels per connection. Those with particularly high concurrency rates (usually such applications are consumers) can start with one channel per thread/process/coroutine and switch to channel pooling when metrics suggest that the original model is no longer sustainable, e.g. because it consumes too much memory. 

We were using one channel for multiple threads. We have changed our architecture now to use a channel pool. and each thread would get its own channel (from the pool)

But we do see that our current setting ( max size of 5 for the pool)  is not enough and we would like to increase it further. But we are wary of doing this, since the documentation shows it should be a single digit number.

Is that statement in the documentation still relevant and should we go for a different approach?

Luke Bakken

unread,
Aug 19, 2020, 9:04:08 AM8/19/20
to rabbitmq-users
Hello,

Please provide information about which client library you are using and its version. It would be great to know which RabbitMQ version you are using too.

Thanks,
Luke

getaju69

unread,
Aug 19, 2020, 9:36:48 AM8/19/20
to rabbitmq-users
amqp client version: 5.9.0  
rabbitmq server 3.8.0 Erlang 22.1.5  

getaju69

unread,
Aug 19, 2020, 11:16:33 AM8/19/20
to rabbitmq-users


Also note that this particular problem\question is related to publishing of messages using the channel to the exchange.

Luke Bakken

unread,
Aug 19, 2020, 12:29:59 PM8/19/20
to rabbitmq-users
Hello,

My suggestion is to make your changes and run benchmarks. I'll make sure the Java client maintainer sees your question as well

Thanks,
Luke

Arnaud Cogoluègnes

unread,
Aug 20, 2020, 2:49:27 PM8/20/20
to rabbitmq-users
A few dozens channels is reasonable (the default maximum is 1023 or 2047 IIRC), the documentation covers the most common cases we see in the wild. There's some synchronization going on at the socket level to avoid frame interleaving, but that should not affect throughput much in this range (I'm speaking about the Java client here). As Luke suggested, you should experiment with your target workload and see what comes out of it. Again, you're still in the reasonable range of channels per connection so far.
Reply all
Reply to author
Forward
0 new messages