<font color="#333333"><font face="tahoma,sans-serif">Thanks for clearing that up!<br></font></font><br><div class="gmail_quote">On Mon, Oct 22, 2012 at 3:46 PM, Michael Klishin <span dir="ltr"><<a href="mailto:michael.s.klishin@gmail.com" target="_blank">michael.s.klishin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><div class="im">2012/10/22 Laurent Vauthrin <span dir="ltr"><<a href="mailto:lvauthrin@gmail.com" target="_blank">lvauthrin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font color="#333333" face="tahoma, sans-serif">My questions are:</font></div><div><font color="#333333" face="tahoma, sans-serif">1. Should we be using a channel per thread considering that we're synchronizing the basicPublish call anyway?</font></div>
</blockquote><div><br></div></div><div>Yes. Channels are just integer on the wire and a little bit of memory allocated on the JVM heap. They are very cheap</div><div>for all intents and purposes and you are much more likely to max out your OS and hardware resources (assuming 1 channel per JVM thread) before</div>
<div>you run into issues with channel objects.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font color="#333333" face="tahoma, sans-serif">2. Can we just share one channel across all threads and not synchronize the call to basicPublish?</font></div></blockquote></div></div><br><br clear="all"><div>No. The real issue with shared channels is that large messages will result in multiple protocol frames being sent</div>
<div>for a single basicPublish operation. When publishing on the same channel from multiple threads, this may result</div><div>in frames being delivered out of order:</div><div><br></div><div>T1 => basicPublish => [Frame11] [Frame12] [Frame13]</div>
<div>T2 => basicPublish => [Frame21] [Frame22] [Frame23]</div><div><br></div><div>may result in the following delivery order, all on the same channel:</div><div><br></div><div>[Frame11][Frame21][Frame12][Frame13][Frame22][Frame23]</div>
<div><br></div><div>and because all frames are on the same channel, RabbitMQ won't be able to tell how to reconstruct your messages.</div><span class="HOEnZb"><font color="#888888">-- <br>MK<br><br><a href="http://github.com/michaelklishin" target="_blank">http://github.com/michaelklishin</a><br>
<a href="http://twitter.com/michaelklishin" target="_blank">http://twitter.com/michaelklishin</a><br><br>
</font></span><br>_______________________________________________<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" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br>