I had tried setting TCP_NODELAY before but did it this way:<br><br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">setsockopt(socketFD, <span style="background-color: rgb(255, 255, 153);">SOL_SOCKET</span>, TCP_NODELAY, &amp;one, sizeof(one));</span><br>
</div><br>and instead it needed to be done like this:<br><br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">setsockopt(socketFD, <span style="background-color: rgb(255, 255, 153);">IPPROTO_TCP</span>, TCP_NODELAY, &amp;one, sizeof(one));</span><br>
</div><br>Yes, that&#39;s it.� Runs really fast now.� 1.4294 milliseconds per round trip.� It seems like it would be<br>faster than that, but it&#39;s way better than 400ms and is sufficient for our purposes.� I suppose it&#39;s<br>
doing program context switches� If I bump into<br>any<br clear="all"><br>Thanks for not reading the part of my post that said that I had already tried this, and then posting the<br>correct version of the call.� :)��� And as a bonus you don&#39;t have to be root do to make the call, which<br>
was also suspicious because you can do it in Java without being root.<br><br>- Jim<br><br>Jim Irrer � � <a href="mailto:irrer@umich.edu">irrer@umich.edu</a> � � � (734) 647-4409<br>University of Michigan Hospital Radiation Oncology<br>
519 W. William St. � � � � � � Ann Arbor, MI 48103<br>
<br><br><div class="gmail_quote">On Wed, Jun 30, 2010 at 9:53 PM, Tony Garnock-Jones <span dir="ltr">&lt;<a href="mailto:tonyg@lshift.net">tonyg@lshift.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Jim,<br>
<br>
I think it&#39;s possible that Brett is on the right track with his suggestion of<br>
the Nagle algorithm being responsible for the delays. You could try the following:<br>
<br>
 �int one = 1;<br>
 �setsockopt(amqp_get_sockfd(conn),<br>
 � � � � � � IPPROTO_TCP, TCP_NODELAY, &amp;one, sizeof(one));<br>
<br>
Cheers,<br>
 �Tony<br>
<div class="im"><br>
<br>
Jim Irrer wrote:<br>
&gt; Hi All -<br>
&gt;<br>
&gt; I&#39;m working on two functions that act as a client-server pair. �They<br>
&gt; use two amq.direct queues to communicate. �When ever either of<br>
&gt; them calls the amqp_simple_wait_frame function, it does not return<br>
&gt; for 436618 microseconds.<br>
&gt;<br>
&gt; Some other background info that might be relevant:<br>
&gt;<br>
&gt; If I only send messages in one direction it&#39;s really fast.<br>
&gt;<br>
&gt; Both processes are using separate connectors and different sockets.<br>
&gt;<br>
&gt; I used the amqp_consumer.c amqp_producer.c code in<br>
&gt; the examples directory as a reference.<br>
&gt;<br>
&gt; Is there a way to avoid this delay?<br>
&gt;<br>
&gt; Also ...<br>
&gt;<br>
&gt; Could I use the same socket in each program as long as it was only<br>
&gt; used by one thread at a time?<br>
&gt;<br>
&gt; Could I use the same connection in each program if it was only<br>
&gt; used by one thread at a time?<br>
&gt;<br>
&gt; Thanks for any insights,<br>
&gt;<br>
&gt; - Jim<br>
&gt;<br>
</div>&gt; Jim Irrer � � <a href="mailto:irrer@umich.edu">irrer@umich.edu</a> &lt;mailto:<a href="mailto:irrer@umich.edu">irrer@umich.edu</a>&gt; � � � (734) 647-4409<br>
<div class="im">&gt; University of Michigan Hospital Radiation Oncology<br>
&gt; 519 W. William St. � � � � � � Ann Arbor, MI 48103<br>
&gt;<br>
&gt;<br>
</div>&gt; ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">&gt;<br>
&gt; _______________________________________________<br>
&gt; rabbitmq-discuss mailing list<br>
&gt; <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
&gt; <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>
</div></div></blockquote></div><br>