Thanks Matthias and Steve.�<div><br></div><div>Is there a better(or more common/supported) way to pool channels(so I reduce blocking on threaded message passing)? �I&#39;d rather not waste anyone&#39;s time if there&#39;s already a tried and test solution out there for pooling.</div>
<div><br></div><div>Enjoy the holidays!<br><br><div class="gmail_quote">On Fri, May 4, 2012 at 7:24 AM, Matthias Radestock <span dir="ltr">&lt;<a href="mailto:matthias@rabbitmq.com" target="_blank">matthias@rabbitmq.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 03/05/12 04:34, Gautam Bakshi wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a multi-threaded application that I was considering using<br>
rabbitmq to manage the queue but I&#39;m getting alot of blocking between<br>
my channels. �Is there a preferred way to setup pools?<br>
<br>
I&#39;m a bit new to Java so I used to the pools from apache commons but<br>
�when I profile the channels are all blocking each other. �To test if<br>
�dedicated connections per thread worked better I made an example of<br>
it as well and it does not block when the same program has a single<br>
channel per connection.<br>
<br>
So my question, do channels block each other or am I doing something<br>
�wrong(using java api wrong or misunderstanding<br>
connection/channels)?<br>
</blockquote>
<br></div>
Channels are multiplexed on the underlying connection. So when an app<br>
is, say, publishing messages on multiple channels, these activities will<br>
be serialised at the point the client interacts with the network socket.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
there a more preferred way? Unrelated to the question, but I was also<br>
�wondering is there any difference between channels and connections<br>
in terms of throughput(i.e. would there be any benefit of using<br>
dedicated connections ignoring the overhead in<br>
establishing/maintaining the connection)?<br>
</blockquote>
<br></div>
You can get exploit more parallelism in both the client and server when<br>
using multiple connections compared to multiple channels. But it is<br>
ultimately more costly in CPU and memory. Plus of course network<br>
capacity is bounded, so if you are saturating that with a single<br>
connection then using more than one will not gain anything.<br>
<br>
So the answer on whether multiple channels or multiple connections are<br>
better very much depends on the application, the hardware environment<br>
at the client and broker end, and the network. Hence your best bet is to conduct some tests, which you are already doing :)<br>
<br>
Regards,<br>
<br>
Matthias.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br><br>Gautam Bakshi<br>
</div>