Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e6378a1d79
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 44 lines (28 sloc) 1.703 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#!/bin/bash
# Copyright (c) 2009-2011 VMware, Inc.

echo ""
echo '-----------------------'
echo 'TCP Stack tuning params'
echo '-----------------------'
echo ""

if [ "$(id -u)" != "0" ]; then
echo '** Setup must be run as root **'
    exit 1
fi

#TCP_FIN_TIMEOUT
#This setting determines the time that must elapse before TCP/IP can release a closed connection and reuse its resources. During this TIME_WAIT state, reopening the connection to the client costs less than establishing a new connection. By reducing the value of this entry, TCP/IP can release closed connections faster, making more resources available for new connections. Addjust this in the presense of many connections sitting in the TIME_WAIT state:

echo 5 > /proc/sys/net/ipv4/tcp_fin_timeout

#TCP_KEEPALIVE_INTERVAL
#This determines the wait time between isAlive interval probes. To set:

echo 110 > /proc/sys/net/ipv4/tcp_keepalive_intvl


#TCP_KEEPALIVE_PROBES
#This determines the number of probes before timing out. To set:

echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes

#TCP_TW_RECYCLE
#It enables fast recycling of TIME_WAIT sockets. The default value is 0 (disabled). The sysctl documentation incorrectly states the default as enabled. It can be changed to 1 (enabled) in many cases. Known to cause some issues with hoststated (load balancing and fail over) if enabled, should be used with caution.

echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

#TCP_TW_REUSE
#This allows reusing sockets in TIME_WAIT state for new connections when it is safe from protocol viewpoint. Default value is 0 (disabled). It is generally a safer alternative to tcp_tw_recycle

echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse

echo "Done"
echo ""

Something went wrong with that request. Please try again.