sysctl.si › Parameters › net.ipv4.tcp_tw_reuse

net.ipv4.tcp_tw_reuse

Reuse sockets in TIME_WAIT for new outgoing connections.

Default
0 or 2
Typical value
1 on proxies and clients

When to change it

Helps busy proxies and clients that open many outgoing connections. It does not affect incoming connections.

Check the current value

sysctl net.ipv4.tcp_tw_reuse

Change it until the next reboot

sudo sysctl -w net.ipv4.tcp_tw_reuse=1

Make it permanent

echo "net.ipv4.tcp_tw_reuse = 1" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Related parameters

net.core.somaxconn · net.ipv4.tcp_max_syn_backlog · net.core.netdev_max_backlog · net.core.rmem_max · net.core.wmem_max · net.ipv4.tcp_congestion_control · net.core.default_qdisc · net.ipv4.tcp_fin_timeout

Generate a full sysctl config for your server

Values are starting points. Test on a staging machine and measure before and after.