Nagle's Algorithm

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Nagle's Algorithm

Billnbell
How do I set TCP_NODELAY on the http sockets for Jetty in SOLR 4?

Is there an option in jetty.xml ?

/* Create new stream socket */

sock = *socket*( AF_INET, SOCK_STREAM, 0 );



/* Disable the Nagle (TCP No Delay) algorithm */

flag = 1;

ret = *setsockopt*( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
sizeof(flag) );




--
Bill Bell
[hidden email]
cell 720-256-8076
Reply | Threaded
Open this post in threaded view
|

Re: Nagle's Algorithm

Dan Davis-2
I don't keep up with this list well enough to know whether anyone else
answered.  I don't know how to do it in jetty.xml, but you can certainly
tweak the code.   java.net.Socket has a method setTcpNoDelay() that
corresponds with the standard Unix system calls.

Long-time past, my suggestion of this made Apache Axis 2.0 250ms faster per
call (1).   Now I want to know whether Apache Solr sets it.

One common way to test the overhead portion of latency is to project the
latency for a zero size request based on larger requests.   What you do is
to "warm" requests (all in memory) for progressively fewer and fewer
rows.   You can make requests for 100, 90, 80, 70 ... 10 rows each more
than once so that all is warmed.   If you plot this, it should look like a
linear function latency(rows) = m(rows) + b since all is cached in
memory.   You have to control what else is going on on the server to get
the linear plot of course - it can be quite hard to get this to work right
on modern Linux.   But once you have it, you can simply calculate f(0) and
you have the latency for a theoretical 0 sized request.

This is a tangential answer at best - I wish I just knew a setting to give
you.

(1) Latency Performance of SOAP
Implementations<http://citeseer.ist.psu.edu/viewdoc/similar?doi=10.1.1.21.8556&type=ab>


On Sun, Sep 29, 2013 at 9:22 PM, William Bell <[hidden email]> wrote:

> How do I set TCP_NODELAY on the http sockets for Jetty in SOLR 4?
>
> Is there an option in jetty.xml ?
>
> /* Create new stream socket */
>
> sock = *socket*( AF_INET, SOCK_STREAM, 0 );
>
>
>
> /* Disable the Nagle (TCP No Delay) algorithm */
>
> flag = 1;
>
> ret = *setsockopt*( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
> sizeof(flag) );
>
>
>
>
> --
> Bill Bell
> [hidden email]
> cell 720-256-8076
>
Reply | Threaded
Open this post in threaded view
|

Re: Nagle's Algorithm

Michael Sokolov-3
In reply to this post by Billnbell
I dunno, but this makes it look as if this may already be taken care of:

http://jira.codehaus.org/browse/JETTY-1196

On 9/29/2013 9:22 PM, William Bell wrote:

> How do I set TCP_NODELAY on the http sockets for Jetty in SOLR 4?
>
> Is there an option in jetty.xml ?
>
> /* Create new stream socket */
>
> sock = *socket*( AF_INET, SOCK_STREAM, 0 );
>
>
>
> /* Disable the Nagle (TCP No Delay) algorithm */
>
> flag = 1;
>
> ret = *setsockopt*( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
> sizeof(flag) );
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Nagle's Algorithm

Shawn Heisey-4
In reply to this post by Billnbell
On 9/29/2013 7:22 PM, William Bell wrote:
> How do I set TCP_NODELAY on the http sockets for Jetty in SOLR 4?

The client usually makes that decision, not the server.  This parameter
is turned on by default for recent HttpClient versions, the library used
by SolrJ.  Even the JETTY issue uncovered by Michael Sokolov refers to a
client connection.

Thanks,
Shawn