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, &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, &one, sizeof(one));</span><br>
</div><br>Yes, that's it. Runs really fast now. 1.4294 milliseconds per round trip. It seems like it would be<br>faster than that, but it's way better than 400ms and is sufficient for our purposes. I suppose it'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'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"><<a href="mailto:tonyg@lshift.net">tonyg@lshift.net</a>></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'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, &one, sizeof(one));<br>
<br>
Cheers,<br>
Tony<br>
<div class="im"><br>
<br>
Jim Irrer wrote:<br>
> Hi All -<br>
><br>
> I'm working on two functions that act as a client-server pair. They<br>
> use two amq.direct queues to communicate. When ever either of<br>
> them calls the amqp_simple_wait_frame function, it does not return<br>
> for 436618 microseconds.<br>
><br>
> Some other background info that might be relevant:<br>
><br>
> If I only send messages in one direction it's really fast.<br>
><br>
> Both processes are using separate connectors and different sockets.<br>
><br>
> I used the amqp_consumer.c amqp_producer.c code in<br>
> the examples directory as a reference.<br>
><br>
> Is there a way to avoid this delay?<br>
><br>
> Also ...<br>
><br>
> Could I use the same socket in each program as long as it was only<br>
> used by one thread at a time?<br>
><br>
> Could I use the same connection in each program if it was only<br>
> used by one thread at a time?<br>
><br>
> Thanks for any insights,<br>
><br>
> - Jim<br>
><br>
</div>> Jim Irrer <a href="mailto:irrer@umich.edu">irrer@umich.edu</a> <mailto:<a href="mailto:irrer@umich.edu">irrer@umich.edu</a>> (734) 647-4409<br>
<div class="im">> University of Michigan Hospital Radiation Oncology<br>
> 519 W. William St. Ann Arbor, MI 48103<br>
><br>
><br>
</div>> ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">><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>
</div></div></blockquote></div><br>