Feature #1239

Set TCP_NODELAY option on socket

Added by Anonymous about 7 years ago. Updated about 7 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:jan% Done:

0%

Category:core
Target version:1.5.0
Missing in 1.5.x:

Description

Almost any type of network server sets the TCP_NODELAY option on the socket to disable Nagle's algorithm.

Here is the patch to network.c to do this :
181a182,185

if (setsockopt(srv_socket->fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) < 0) {
log_error_write(srv, FILE_, LINE_, "ss", "socketsockopt failed:", strerror(errno));
return -1;
}

-- shanti

History

#1 Updated by Anonymous about 7 years ago

This is an important performance issue that affects Solaris but not Linux for small sub-MSS sized requests. Linux disables Nagle by default, but in Solaris applications must either explicitly disable it by setting TCP_NODELAY via setsockopt (as is done in Apache) or in the shell that Lighty is invoked in set tcp_naglim_def to 1 with "ndd". Without doing one of these two things, Lighty will run literally orders of magnitude slower than Apache for small transfers. Changing this in the Lighty source code is the preferable solution because there are applications such as telnet that do benefit from the Nagle algorithm and therefore it's best not to disable Nagle more widely than necessary. It's not necessary to "#ifdef \_\_sun" the setsockopt call because it will have no effect on systems that already disable it by default.

Also available in: Atom