<div dir="ltr">By default, the RabbitTemplate.*sendAndReceive() operations create a temporary reply queue for each request. This is not particularly efficient for high volume situations.<div><br></div><div>Consider using a fixed reply queue in these situations.</div>
<div><br></div><div><a href="http://docs.spring.io/spring-amqp/reference/html/amqp.html#request-reply">http://docs.spring.io/spring-amqp/reference/html/amqp.html#request-reply</a><br></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Sun, Sep 29, 2013 at 4:24 PM, tgv amni <span dir="ltr"><<a href="mailto:tgvt53@gmail.com" target="_blank">tgvt53@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">We are new to rabbitMQ. We use rabbitmq 3.1.5 in our test environment. This is installed on a red hat linux server (6.4), the same server where our application is also running. The database (postgresql) is on a separate server. </font></font></p>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">We are using rabbitMQ default configuration. </font></font></div>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">I ran a test where concurrent users post to a rest service (say R). This service basically expects <span> </span>two UUIDs (UUID_A and UUID_B), that identify two database entities <span> </span>A and B. Once the service is called with these two values, it publishes to the default exchange. </font></font></div>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">There are two durable queues bound to this exchange. QueueA and QueueB. Two services,<span> </span>Service A and Service B, each listen on QueueA and QueueB respectively.<span> </span>There are no other consumers to these queues. Service A picks up the message and validates<span> </span>UUID_A exists in the database. Service B validates UUID_B exists. If they are both valid, an entry is made to the db, mapping these two values. So each valid post results in an entry in a table in the db.</font></font></div>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">I find as the test progresses, response <span> </span>time of this post increases.<span> </span>A lot of the time is being spent in<span> </span>Unsafe.park (boolean,long)<span> </span>in sun.misc package. </font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">Here is the call stack that shows classes where this Unsafe.park() is being involved from. It appears to be called from spring framework’s RabbitTemplate class.</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">Unsafe.park</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>LockSupportparkNanos(Object,Long)</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> <strong> </strong></span><strong>AbstractQueuedSynchronizer$ConditionObject.awaitNanos(long)</strong></font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>ArrayBlockingQueue.poll(long, TimeUnit)</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>RabbitTemplate$3.doInRabbit(Channel)</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>RabbitTemplate$3.doInRabbit(Channel)</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><font size="3"><font face="Calibri">RabbitTemplate.execute(ChannelCallback)</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><font size="3"><font face="Calibri"><span> <strong> </strong></span><strong>RabbitTemplate.doSendAndReceiveWithTemporary(String,String,Message)</strong></font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><font size="3"><font face="Calibri"><span> </span>RabbitTemplate.doSendAndReceive(String,String,Message)</font></font></p>
<p style="MARGIN:0in 0in 10pt 0.5in"><font size="3"><font face="Calibri"><span> </span>RabbitTemplate.convertSendAndReceive(String,String,Object, MessagePostProcessor)</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>RabbitTemplate.convertSendAndReceive(String,Object)</font></font></p>
<p style="TEXT-INDENT:0.25in;MARGIN:0in 0in 10pt 0.75in" class="MsoNormal"><font size="3"><font face="Calibri">…</font></font></p>
<p style="TEXT-INDENT:0.5in;MARGIN:0in 0in 10pt 0.25in" class="MsoNormal"><font size="3"><font face="Calibri"><span> </span>…</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><span></span></p>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">As the test progresses where the load increases from 50 users to 200 users over a period of 20 mins, this response time increases from 50 ms to almost 2 seconds. 99% of the response time is spent in Unsafe.park (waiting). At the end of 20 mins, roughly 100,000 entries are made into the db.That is roughly 83 Posts (i.e messages) per second. Each message contains a couple of UUIDs and a couple of dates. There is no other activity on this server.</font></font></div>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri"></font></font><font size="3"><font face="Calibri">Why is there so mcuh time being spent in Unsafe.park() ? It looks like there is a wait for some resource lock. How can we reduce this wait ? Overall CPU is about 40-45% on this box (a 12 core server). 2/3rds of this time is being spent in the rabbitMQ server.</font></font></div>
<div style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">Is there a plug-in to monitor cpu usage on the server? How can we determine where time is being spent within the broker ?</font></font></div>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">Thanks,</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3"><font face="Calibri">tgv</font></font></p>
<p style="MARGIN:0in 0in 10pt" class="MsoNormal"><font size="3" face="Calibri"> </font></p>
<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></div>