Feature #1239
closedSet TCP_NODELAY option on socket
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
Updated by Anonymous over 17 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.
Updated by gstrauss over 8 years ago
- Description updated (diff)
- Assignee deleted (
jan) - Missing in 1.5.x set to Yes
FYI: implemented on accepted TCP socket connections in lighttpd 1.4.40.
Also available in: Atom