#!/bin/bash
# decrease release timeout
sudo echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
sudo sysctl -w net.ipv4.tcp_fin_timeout=30

# enable release timewait for new connection
sudo echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
sudo sysctl -w net.ipv4.tcp_tw_reuse=1

# recycle socket resource fastly
sudo echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
sudo sysctl -w net.ipv4.tcp_tw_recycle=1
