Linux TCPIP Kernel Parameter Optimization

Source: Internet
Author: User

Linux TCPIP Kernel Parameter Optimization/proc/sys/net directory all TCP/IP parameters are located in the/proc/sys/net directory (please note that, modifications to the content in the/proc/sys/net directory are temporary and any modifications will be lost after the system is restarted. For example, the following important parameters: parameters (path + file) description default optimization value:/proc/sys/net/core/rmem_default default TCP Data Receiving Window size (in bytes ). 229376 256960/proc/sys/net/core/rmem_max maximum TCP Data Receiving Window (in bytes ). 131071 513920/proc/sys/net/core/wmem_default default TCP data sending window size (in bytes ). 229376 256960/proc/sys/net/core/wmem_max maximum TCP data transmission window (in bytes ). 131071 513920/proc/sys/net/core/netdev_max_backlog maximum number of packets that can be sent to the queue when each network interface receives packets at a rate faster than the rate at which the kernel processes these packets. 1000 2000/proc/sys/net/core/somaxconn defines the maximum length of the listening queue for each port in the system. This is a global parameter. 128 2048/proc/sys/net/core/optmem_max indicates the maximum buffer size allowed by each socket. 20480 81920/proc/sys/net/ipv4/tcp_mem determine how the TCP stack reflects memory usage. The unit of each value is a memory page (usually 4 kb ). The first value is the lower limit of memory usage, the second value is the upper limit of the application pressure on the buffer zone starting from the memory pressure mode, and the third value is the upper limit of memory usage. At this level, messages can be discarded to reduce memory usage. For larger BDP values, you can increase these values (note that the unit is the Memory Page rather than the byte ). 94011 125351 188022 131072 262144 524288/proc/sys/net/ipv4/tcp_rmem defines the memory used by the socket for automatic tuning. The first value is the minimum number of bytes allocated to the socket receiving buffer; the second value is the default value (this value will be overwritten by rmem_default ), the buffer can be increased to this value when the system load is not heavy. The third value is the maximum number of bytes of the received buffer space (this value will be overwritten by rmem_max ). 4096 87380 4011232 8760 256960 4088000/proc/sys/net/ipv4/tcp_wmem defines the memory used by the socket for automatic optimization. The first value is the minimum number of bytes allocated for the socket sending buffer; the second value is the default value (this value will be overwritten by wmem_default ), the buffer can be increased to this value when the system load is not heavy. The third value is the maximum number of bytes in the sending buffer space (this value will be overwritten by wmem_max ). 4096 16384 4011232 8760 256960 4088000/proc/sys/net/ipv4/tcp_keepalive_time the interval between TCP and keepalive detection messages (in seconds), used to confirm whether the TCP connection is valid. 7200 1800/proc/sys/net/ipv4/tcp_keepalive_intvl interval (in seconds) when the message is not received ). 75 30/proc/sys/net/ipv4/tcp_keepalive_probes: the maximum number of keepalive detection messages that can be sent before the TCP connection is determined to be invalid. 9 3/proc/sys/net/ipv4/tcp_sack enable selective response (1 indicates enabled), and improve performance by selectively responding to messages received in disordered order, allow the sender to send only the lost packet segment (for Wan communication). This option should be enabled, but will increase the CPU usage. 1 1/proc/sys/net/ipv4/tcp_fack enable forwarding response. You can select a response (SACK) to reduce congestion. This option should also be enabled. 1 1/proc/sys/net/ipv4/tcp_timestamps TCP timestamp (12 bytes will be added to the TCP Header ), this option is used to enable RTT Computing Based on a method that is more accurate than the specific proportion timeout (refer to RFC 1323). This option should be enabled for better performance. 1 1/proc/sys/net/ipv4/tcp_window_scaling enable the window scaling defined in RFC 1323. To support TCP windows larger than 64 KB, This value must be enabled (1 indicates enabling ), the maximum TCP window size is 1 GB. It takes effect only when both TCP connections are enabled. 1 1/proc/sys/net/ipv4/tcp_syncookies indicates whether the TCP synchronization tag (syncookie) is enabled. The CONFIG_SYN_COOKIES must be enabled in the kernel for compilation, synchronization tags prevent a socket from overload when too many attempts are made to connect. 1 1/proc/sys/net/ipv4/tcp_tw_reuse indicates whether to allow the TIME-WAIT socket (port of TIME-WAIT) to be used for the new TCP connection. 0 1/proc/sys/net/ipv4/tcp_tw_recycle can reclaim TIME-WAIT sockets more quickly. 0 1/proc/sys/net/ipv4/tcp_fin_timeout for local socket connection, TCP is kept in the FIN-WAIT-2 State (in seconds ). The other party may disconnect or never end the connection or unexpected process will die. 60 30/proc/sys/net/ipv4/ip_local_port_range indicates the local port number 32768 61000 1024 65000/proc/sys/net/ipv4/tcp_max_syn_backlog allowed by the TCP/UDP protocol connection Request confirmed, the maximum number of queues that can be saved. If the server is overloaded frequently, add this number. 2048 2048/proc/sys/net/ipv4/tcp_low_latency allows the TCP/IP stack to adapt to low latency in high throughput. This option should be disabled. 0/proc/sys/net/ipv4/tcp_westwood enable the sender congestion control algorithm, which can maintain the throughput evaluation and try to optimize the overall bandwidth utilization, this option should be enabled for WAN communication. 0/proc/sys/net/ipv4/tcp_bic enable Binary Increase Congestion for a fast long-distance network, so that you can better use the link for operations at the GB speed. This option should be enabled for WAN communication. 1/etc/sysctl. conf file/etc/sysctl. conf is an interface that allows you to change the running Linux system. It includes some advanced options for TCP/IP stack and virtual memory system, which can be used to control Linux network configuration. Due to the temporary content of the/proc/sys/net directory, we recommend that you add the TCPIP parameter to/etc/sysctl. conf file, save the file, and use the command "/sbin/sysctl-p" to make it take effect immediately. For details about the modification scheme, refer to the preceding section: net. core. rmem_default = 256960. net. core. rmem_max = 513920. net. core. wmem_default = 256960. net. core. wmem_max = 513920. net. core. netdev_max_backlog = 2000. net. core. somaxconn = 2048 net. core. optmem_max = 81920. net. ipv4.tcp _ mem = 131072 262144 524288 net. ipv4.tcp _ rmem = 8760 256960 4088000 net. ipv4.tcp _ wmem = 8760 256960 4088000 net. ipv4.tcp _ keepalive_time = 1800. net. ipv4.tcp _ keepalive_intvl = 30 net. ipv4.tcp _ keepalive_probes = 3 net. ipv4.tcp _ sack = 1 net. ipv4.tcp _ fack = 1 net. ipv4.tcp _ timestamps = 1 net. ipv4.tcp _ window_scaling = 1 net. ipv4.tcp _ syncookies = 1 net. ipv4.tcp _ tw_reuse = 1 net. ipv4.tcp _ tw_recycle = 1 net. ipv4.tcp _ fin_timeout = 30 net. ipv4.ip _ local_port_range = 1024 65000 net. ipv4.tcp _ max_syn_backlog = 2048

Related Article

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: 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.