Linux TCP/IP protocol stack Optimization

Source: Internet
Author: User

The following parameters are frequently mentioned in optimizing the network tuning of Linux.

Setup in/etc/sysctl. conf


# Network tunning
Net. ipv4.tcp _ fin_timeout = 35
Net. ipv4.tcp _ keepalive_time = 1800
Net. ipv4.tcp _ keepalive_intvl = 35
Net. ipv4.tcp _ tw_recycle = 1

Net. ipv4.tcp _ tw_reuse = 1



A better explanation:

/Proc/sys/NET/IPv4/tcp_fin_timeout
Time to hold socket in State fin-wait-2, if it was closed by our side. peer can be broken and never close its side, or even died unexpectedly. default value is 60sec. usual value used in 2.2 was 180 seconds, you may restore it, but remember that if your machine
Is even underloaded web server, you risk to overflow memory with kilotons of dead sockets, fin-wait-2 sockets are less dangerous than fin-wait-1, because they eat maximum 1.5 K of memory, but they tend to live longer. cf. tcp_max_orphans.

/Proc/sys/NET/IPv4/tcp_keepalive_time
How often TCP sends out keepalive messages when keepalive is enabled. Default: 2hours.

/Proc/sys/NET/IPv4/tcp_keepalive_intvl
How frequent probes are retransmitted, when a probe isn't acknowledged. Default: 75 seconds.

/Proc/sys/NET/IPv4/tcp_tw_recycle
Enable fast reconfiguring time-Wait sockets. default value is 1. It shoshould not be changed without advice/request of technical experts.

/Proc/sys/NET/IPv4/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

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.