TCP Network parameter optimization

Source: Internet
Author: User

1.

echo "65535" >/proc/sys/net/ipv4/ip_local_port_range set up an out-of-band available port range indicates that the port can be used 65535-1024 (0~1024 is protected)

echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse set time_wait connection reuse default 0

echo 1 >/proc/sys/net/ipv4/tcp_tw_recycle Set Quick recycle time_wait connection default 0

echo 180000 >/proc/sys/net/ipv4/tcp_max_tw_buckets Set maximum time_wait connection length default 262144

echo 1 >/proc/sys/net/ipv4/tcp_timestamps Set whether to enable a more accurate method than time-out to enable calculation of RTT by default 0

echo 1 >/proc/sys/net/ipv4/tcp_window_scaling Sets whether the sliding window size of a TCP/IP session is variable by default 1

echo 20000 >/proc/sys/net/ipv4/tcp_max_syn_backlog Set the maximum number of connections that are waiting for the client to not answer default 2048

echo >/proc/sys/net/ipv4/tcp_fin_timeout set fin-wait Status Wait collection time default 60

echo "4096 87380 16777216" >/proc/sys/net/ipv4/tcp_rmem set maximum TCP data send buffer size, respectively minimum, default, and maximum default 4096 87380 4194304

echo "4096 65536 16777216" >/proc/sys/net/ipv4/tcp_wmem set maximum TCP data accept buffer size, minimum, default, and maximum default 4096 87380 4194304

  

echo 10000 >/proc/sys/net/core/somaxconn Sets the length of the listening queue for each port in the listening state by default 128

echo 10000 >/proc/sys/net/core/netdev_max_backlog Set the maximum number of packets waiting for CPU to be processed by default 1000

echo 16777216 >/proc/sys/net/core/rmem_max Set Maximum system socket data Accept buffer size default 124928

echo 262144 >/proc/sys/net/core/rmem_default Set default system socket data Accept buffer size default 124928

echo 16777216 >/proc/sys/net/core/wmem_max Set maximum system socket data send buffer size default 124928

echo 262144 >/proc/sys/net/core/wmem_default Set default system socket data send buffer size default 124928

  

echo 2000000 >/proc/sys/fs/file-max Set the maximum number of open files by default 385583

  

Optimized network with AB command to test machine

After setting up remember to save

  

TCP Network parameter optimization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.