print_linux_tcp_settings.sh
#!/bin/bash
echo "# Receive Queue Size per CPU Core, number of packets"
echo "/proc/sys/net/core/netdev_max_backlog = "`cat /proc/sys/net/core/netdev_max_backlog`
echo ""
echo "# Accept Queue Limit, maximum number of established"
echo "# connections waiting for accept() per listener."
echo "/proc/sys/net/core/somaxconn = "`cat /proc/sys/net/core/somaxconn`
echo ""
echo "# The maximum number of connections in the SYN_RECV queue"
echo "/proc/sys/net/ipv4/tcp_max_syn_backlog = "`cat /proc/sys/net/ipv4/tcp_max_syn_backlog`
echo ""
echo "# the retry times for SYN"
echo "/proc/sys/net/ipv4/tcp_syn_retries = "`cat /proc/sys/net/ipv4/tcp_syn_retries`
echo "# the retry times for synack"
echo "/proc/sys/net/ipv4/tcp_synack_retries = "`cat /proc/sys/net/ipv4/tcp_synack_retries`
echo ""
echo "# Timeout in seconds to close client connections in"
echo "# TIME_WAIT after receiving FIN packet."
echo "/proc/sys/net/ipv4/tcp_fin_timeout = "`cat /proc/sys/net/ipv4/tcp_fin_timeout`
echo ""
echo "/proc/sys/net/ipv4/tcp_syncookies = "`cat /proc/sys/net/ipv4/tcp_syncookies`
echo ""
echo "limitation settings:"
ulimit
样例结果如下
# Receive Queue Size per CPU Core, number of packets
/proc/sys/net/core/netdev_max_backlog = 1000
# Accept Queue Limit, maximum number of established
# connections waiting for accept() per listener.
/proc/sys/net/core/somaxconn = 4096
# The maximum number of connections in the SYN_RECV queue
/proc/sys/net/ipv4/tcp_max_syn_backlog = 2048
# the retry times for SYN
/proc/sys/net/ipv4/tcp_syn_retries = 6
# the retry times for synack
/proc/sys/net/ipv4/tcp_synack_retries = 1
# Timeout in seconds to close client connections in
# TIME_WAIT after receiving FIN packet.
/proc/sys/net/ipv4/tcp_fin_timeout = 60
/proc/sys/net/ipv4/tcp_syncookies = 1
limitation settings:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 515002
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 515002
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
参考
High Volume Incoming ConnectionsLinux kernel settings for the workload generator systems