Skip to the content.

HTTP Connection Management

HTTP = HyperText Transfer Protocol

TCP

# sysctl.conf

# reduce TCP connect time (handshaking time)
net.ipv4.tcp_syn_retries           = 2  # reduce it (`socket.TCP_SYNCNT`)
net.ipv4.tcp_synack_retries        = 2  # reduce it

# TCP Keep-Alive
net.ipv4.tcp_keepalive_time        = 1800  # default 7200 (since Linux 2.2)
net.ipv4.tcp_keepalive_probes      = 9  # default 9 (since Linux 2.2)
net.ipv4.tcp_keepalive_intvl       = 15

# enable TCP RFC-1337
net.ipv4.tcp_rfc1337               = 1

Keep-Alive

When a client wants to close the connection, send:

Connection: keep-alive
Proxy-Connection: keep-alive

Connection: close

More

References