[rabbitmq-discuss] please help understanding why my pool of channels are blocking.

Gautam Bakshi gautam.bakshi at gmail.com
Fri May 4 15:43:49 BST 2012


Thanks Matthias and Steve.

Is there a better(or more common/supported) way to pool channels(so I
reduce blocking on threaded message passing)?  I'd rather not waste
anyone's time if there's already a tried and test solution out there for
pooling.

Enjoy the holidays!

On Fri, May 4, 2012 at 7:24 AM, Matthias Radestock <matthias at rabbitmq.com>wrote:

> On 03/05/12 04:34, Gautam Bakshi wrote:
>
>> I have a multi-threaded application that I was considering using
>> rabbitmq to manage the queue but I'm getting alot of blocking between
>> my channels.  Is there a preferred way to setup pools?
>>
>> I'm a bit new to Java so I used to the pools from apache commons but
>>  when I profile the channels are all blocking each other.  To test if
>>  dedicated connections per thread worked better I made an example of
>> it as well and it does not block when the same program has a single
>> channel per connection.
>>
>> So my question, do channels block each other or am I doing something
>>  wrong(using java api wrong or misunderstanding
>> connection/channels)?
>>
>
> Channels are multiplexed on the underlying connection. So when an app
> is, say, publishing messages on multiple channels, these activities will
> be serialised at the point the client interacts with the network socket.
>
>
>  there a more preferred way? Unrelated to the question, but I was also
>>  wondering is there any difference between channels and connections
>> in terms of throughput(i.e. would there be any benefit of using
>> dedicated connections ignoring the overhead in
>> establishing/maintaining the connection)?
>>
>
> You can get exploit more parallelism in both the client and server when
> using multiple connections compared to multiple channels. But it is
> ultimately more costly in CPU and memory. Plus of course network
> capacity is bounded, so if you are saturating that with a single
> connection then using more than one will not gain anything.
>
> So the answer on whether multiple channels or multiple connections are
> better very much depends on the application, the hardware environment
> at the client and broker end, and the network. Hence your best bet is to
> conduct some tests, which you are already doing :)
>
> Regards,
>
> Matthias.
>



-- 
Regards,

Gautam Bakshi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120504/304d299a/attachment.htm>


More information about the rabbitmq-discuss mailing list