<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div>Gautam, </div><div><br></div><div>Of course, as Matthias pointed out, everything eventually goes down a</div><div>connection. If this is shared between the channels then SENDing</div><div>messages from the client will clearly serialise at the connection level.</div><div>This is what I'm seeing here, too.</div><div><br></div><div>Individual messages are not split into chunks (as they would have to be</div><div>to multi-plex them with others on the network connection), so each</div><div>message will block out all other activity on the connection until it</div><div>is completed. Larger messages will block for longer.</div><div><br></div><div>The reason why you might want multiple channels on one connection is if</div><div>you want to multi-thread work at the client end -- for example Consumer</div><div>callback work. Each connection has a thread-pool of executors to run</div><div>consumer callbacks (deliveries and so on) so that multiple channels can</div><div>run their callbacks simultaneously. Frames received from the server</div><div>still come in serially over the connection, but the callbacks they</div><div>trigger can run in independent threads if they are for distinct</div><div>channels. You appear not to be doing any consuming, so this is not</div><div>your problem.</div><div><br></div><div>AFAIK there isn't a standard for multi-plexing channels/connections at</div><div>the client end, but I suggest that you simply increase the number of</div><div>underlying connections to relieve the bottleneck you are seeing. If, for</div><div>instance, you introduce, 5 connections with 10 channels each you could</div><div>see if this helps things.</div><div><br></div><div>Varying the number of channels per connection will allow you to tune the</div><div>potential contention for each connection. Only you can tell what </div></div><div>the likely contention is to be. The selector process for channels might</div><div>want to favour channels which are for connections with fewer used</div><div>channels already.</div><div><br></div><div>Let us know how you fare.</div><div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-style: normal; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="font-family: Georgia; font-size: medium; font-weight: normal; font-style: normal; "><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Steve Powell </span><span class="Apple-style-span" style="font-size: 11px; ">(<i>a happy bunny</i>)</span></font></div></div><div><font class="Apple-style-span"><div style="font-weight: normal; font-style: normal; font-family: Helvetica; font-size: 12px; "><i><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; ">----------some more definitions from the SPD----------</span></font></i></div></font></div></div></div><span class="Apple-style-span" style="font-style: normal; font-weight: normal; font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2" style="font-style: normal; "><span class="Apple-style-span" style="font-size: 10px; "><b>chinchilla</b> (</span></font><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><i>n.</i>) Cooling device for the lower jaw.</span></font></span><div style="font-style: normal; font-family: Georgia; font-size: medium; font-weight: normal; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; "><b>socialcast</b></span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; "> (</span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-size: 10px; "><i>n.</i>)</span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; "> Someone to whom everyone is speaking but nobody likes.</span></span></div><div style="font-family: Georgia; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="font-family: Georgia; font-style: normal; font-size: 10px; "><b>literacy</b></span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; "><span class="Apple-converted-space"> </span>(</span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-size: 10px; "><i>n.</i></span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; ">) A textually transmitted disease usually contracted in childhood.</span></span></div></div></span></div>
</div>
<br><div><div>On 4 May 2012, at 15:43, Gautam Bakshi wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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'd rather not waste anyone's time if there'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"><<a href="mailto:matthias@rabbitmq.com" target="_blank">matthias@rabbitmq.com</a>></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'm getting alot of blocking between<br>
my channels. Is there a preferred way to setup pools?<br>
<br>
I'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>
_______________________________________________<br>rabbitmq-discuss mailing list<br><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></blockquote></div><br></div></div></body></html>