Project

General

Profile

Actions

Feature #2116

closed

add server.listen-backlog option instead of hard-coded value (128 * 8) for listen()

Added by eyecue over 15 years ago. Updated almost 9 years ago.

Status:
Fixed
Priority:
Low
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

Lighttpd currently sets it's queue length to a hard coded value of 1024 (128 * 8) when calling listen(). This is non-optimal in circumstances where both the operating system 'and' lighttpd.conf have been configured for maxconn values > 1024.

It can result in listen queue overflows in cases where burst of new connections > 1024 but < server.max-connections are observed, causing connection resets.

On FreeBSD, netstat -Lan can display per-listening-socket queue lengths, but I don't think there's an equivalent command on Linux.

Current Behaviour:

lighttpd.conf: server.max-connections: NOT SET (defaults to 1024)

Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen         Local Address
tcp4  0/0/1024       *.80

lighttpd.conf: server.max-connections: 2048

Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen         Local Address
tcp4  0/0/1024       *.80

lighttpd.conf: server.max-connections: 512

Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen         Local Address
tcp4  0/0/1024       *.80

Relevant code section in question:

http://redmine.lighttpd.net/projects/lighttpd/repository/entry/branches/lighttpd-1.4.x/src/network.c

if (-1 == listen(srv_socket->fd, 128 * 8)) {

Expected Behaviour:

server.max-connections value should be used for listen()

Slightly off-topic, HAProxy exhibits the correct behaviour of reflecting it's per frontend maxconn values in the listen queue lengths. I mention this purely for a representative and example case of expected behaviour.

Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen         Local Address
tcp4  0/0/2048       *.443
tcp4  0/0/4096       *.80
tcp4  0/0/2000       *.1357

Related issues 1 (0 open1 closed)

Related to Bug #1825: Don't disable backend when overloadedInvalid2008-11-18Actions
#1

Updated by stbuehler over 15 years ago

  • Priority changed from High to Low
  • Target version changed from 1.4.26 to 1.4.x
#3

Updated by stbuehler over 15 years ago

  • Tracker changed from Bug to Feature
#4

Updated by stbuehler over 15 years ago

  • Subject changed from listen() call should use server.max-connections instead of hard-coded value (128 * 8) to add server.listen-backlog option instead of hard-coded value (128 * 8) for listen()
#10

Updated by gstrauss about 9 years ago

  • Related to Bug #1825: Don't disable backend when overloaded added
#11

Updated by gstrauss about 9 years ago

  • Related to Bug #1825: Don't disable backend when overloaded added
#12

Updated by gstrauss about 9 years ago

  • Related to deleted (Bug #1825: Don't disable backend when overloaded)
#14

Updated by gstrauss about 9 years ago

  • Target version changed from 1.4.x to 1.4.40
#15

Updated by gstrauss about 9 years ago

  • Status changed from New to Patch Pending
#16

Updated by gstrauss almost 9 years ago

  • Status changed from Patch Pending to Fixed
Actions

Also available in: Atom