Project

General

Profile

Actions

Feature #1239

closed

Set TCP_NODELAY option on socket

Added by Anonymous over 17 years ago. Updated over 8 years ago.

Status:
Obsolete
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

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

Actions #1

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.

Actions #2

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.

Actions #3

Updated by gstrauss over 8 years ago

  • Status changed from New to Obsolete
Actions

Also available in: Atom