<div>Hi Aisha,</div>
<div>�</div>
<div>Hope you don&#39;t mind me butting in here.<br><br>2009/9/7 Aisha Fenton <span dir="ltr">&lt;<a href="mailto:aisha.fenton@gmail.com">aisha.fenton@gmail.com</a>&gt;</span><br></div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div style="WORD-WRAP: break-word">
<div>Hi Chunk.</div>
<div>I don&#39;t know Suhail. And his problem may be different from mine.</div>
<div><br></div>
<div>
<div>To isolate the problem, I&#39;ve reduce what I&#39;m doing down to the attached code files. One pushes messages, the other pops them.</div>
<div><br></div>
<div>I see the problem even when only test_push.rb is running (as long as the queue is sufficiently pre-populated). Nothing else is using rabbitmq when I&#39;m doing the test.</div>
<div><br></div>
<div>I&#39;m getting the same problem on several different machines here -- my local MacOSX box and a server class Debian box.�</div>
<div><br></div>
<div><br></div></div>
<div>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>exchange - durable or not?</div></div></blockquote>
<div>not durable</div>
<div class="im"><br>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>exchange - type? (Looks like &quot;fanout&quot; from the original post)</div></div></blockquote></div>
<div>fanout</div>
<div class="im"><br>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>number of bindings per exchange</div></div></blockquote></div>
<div>1</div><br>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>queue �- durable?</div></div></blockquote>
<div>not durable</div>
<div class="im"><br>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>publishing settings - require ack? persistent? immediate?</div></div></blockquote></div>
<div>no ack, non persistent, and non immediate.</div>
<div class="im"><br>
<blockquote type="cite">
<div style="WORD-WRAP: break-word">
<div>message size? 1K according to the original post</div></div></blockquote></div>
<div>&lt; 1K</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div><b>test_push.rb�</b></div>
<div><b>---</b></div>
<div><br></div>
<div>
<div><i>require &quot;rubygems&quot;</i></div>
<div><i>require &quot;bunny&quot;</i></div>
<div><i><br></i></div>
<div><i>EXCHANGE = &quot;raw_telemetry&quot;</i></div>
<div><i>QUEUE = &quot;process_telemetry&quot;</i></div>
<div class="im">
<div><i><br></i></div>
<div><i>count ||= 0</i></div>
<div><i>prev_time ||= Time.now</i></div></div>
<div class="im">
<div><i>msg_server = Bunny.new(:spec =&gt; &#39;08&#39;)</i></div>
<div><i>msg_server.start</i></div>
<div><i><br></i></div></div>
<div><i>msg_server.exchange(EXCHANGE, :type �=&gt; :fanout)</i></div>
<div><i>msg_server.queue(QUEUE).bind(EXCHANGE)</i></div>
<div><i><br></i></div>
<div><i>loop do</i></div>
<div><i><br></i></div>
<div><i>��msg_server.exchange(EXCHANGE).publish(&quot;This is my msg&quot;)</i></div>
<div class="im">
<div><i>��</i></div>
<div><i>��count += 1</i></div>
<div><i>��if count &gt; 100</i></div>
<div><i>�� �t = Time.now</i></div></div>
<div><i>�� �puts(&quot;msgs pushes per sec: #{count / (t - prev_time)}&quot;)</i></div>
<div class="im">
<div><i>�� �prev_time = t</i></div>
<div><i>�� �count = 0</i></div>
<div><i>��end</i></div>
<div><i>�� �</i></div>
<div><i>end</i></div>
<div><i><br></i></div></div>
<div><i><span style="FONT-STYLE: normal">
<div><b>test_pop.rb�</b></div>
<div><b>---</b></div>
<div><i><span style="FONT-STYLE: normal"><br></span></i></div></span></i></div>
<div><i>
<div class="im">
<div>require &quot;rubygems&quot;</div>
<div>require &quot;bunny&quot;</div>
<div><br></div>
<div>@msg_server = Bunny.new(:spec =&gt; &#39;08&#39;)</div>
<div>@msg_server.start</div>
<div><br></div>
<div>def start</div>
<div>��count ||= 0</div>
<div>��prev_time ||= Time.now</div>
<div>��queue = @msg_server.queue(&quot;process_telemetry&quot;)</div>
<div><br></div></div>
<div class="im">
<div>��loop do</div>
<div>�� �result = queue.pop</div>
<div>�� �next if result == :queue_empty</div>
<div>��</div>
<div>�� �count += 1</div>
<div>�� �if count &gt; 100</div>
<div>�� � �t = Time.now</div>
<div>�� � �puts(&quot;msgs pops per sec: #{count / (t - prev_time)}&quot;)</div>
<div>�� � �prev_time = t</div>
<div>�� � �count = 0</div>
<div>�� �end � �</div>
<div>��end</div>
<div><br></div>
<div>end</div>
<div><br></div>
<div>begin</div>
<div>��start()</div>
<div>ensure</div>
<div>��puts &quot;stopping&quot;</div>
<div>��@msg_server.stop</div>
<div>end</div>
<div></div></div></i>�</div></div></div></div></blockquote></div>
<div></div>
<div>�</div>
<div>I have some observations -</div>
<div>�</div>
<div>1. In your test_push.rb you have the line -</div>
<div>�</div>
<div><em>msg_server.exchange(EXCHANGE).publish(&quot;This is my msg&quot;)</em></div>
<div><em></em>�</div>
<div>The exchange method declares an exchange, so you are doing this every time you publish a message which will slow things down. Declare the exchange using a variable outside the loop like this -</div>
<div>�</div>
<div><em>my_exchange = msg_server.exchange(EXCHANGE, :type �=&gt; :fanout)</em></div>
<div><em></em>�</div>
<div>Then use the variable inside the loop -</div>
<div><em></em>�</div>
<div><em>my_exchange.publish(&quot;This is my msg&quot;)</em></div>
<div><em></em>�</div>
<div>I think Paolo has highlighted the same thing.</div>
<div>�</div>
<div>2. In your test_pop.rb you don&#39;t need to specify <em>:spec =&gt; &#39;08&#39;.</em> Bunny.new defaults to the AMQP 0-8 spec version.</div>
<div>�</div>
<div>Also, do you mean to have -</div>
<div>�</div>
<div><em>next if result == :queue_empty</em></div>
<div><em></em>�</div>
<div>How are you breaking out of the loop? Might you want to use &#39;break&#39; instead of &#39;next&#39;?</div>
<div>�</div>
<div>3. A Bunny instance�only ever uses 2 channels unless you explicitly create more. Since you don&#39;t seem to be creating more channels I don&#39;t think that&#39;s where your issue lies.�</div>
<div><br>-- <br>Regards<br><br>Chris<br></div>