Optimizing the TCP parameters of the nginx server kernel
Source: Internet
Author: User
Optimize the TCP parameter vi/etc/sysctl of the nginx server kernel. add the following content at the end of conf: www.2cto. comnet. ipv4.tcp _ timeout... optimize the TCP parameter vi/etc/sysctl of the nginx server kernel. add the following content at the end of conf: www.2cto.com. ipv4.tcp _ max_tw_buckets = 6000. net. ipv4.ip _ local_port_range = 2048 65000 net. ipv4.tcp _ tw_recycle = 1 net. ipv4.tcp _ tw_reuse = 1net. ipv4.tcp _ syncookies = 1net. core. somaxconn = 262144net. core. netdev_max_backlog = 262144net. ipv4.tcp _ max_orphans = 252144net. ipv4.tcp _ max_syn_backlog = 252144net. ipv4.tcp _ timestamps = 0net. ipv4.tcp _ synack_retries = 1net. ipv4.tcp _ syn_retries = 1net. ipv4.tcp _ fin_timeout = 1net. ipv4.tcp _ keepalive_time = 30 save and enter sysctl-p to make the settings take effect. Explanation: net. ipv4.tcp _ max_tw_buckets: sets the value of timewait. net. ipv4.ip _ local_poet_range specifies the port range that can be opened by the system. net. ipv4.tcp _ tw_recycle: set whether to enable timewait to quickly recycle net. ipv4.tcp _ tw_reuse: Specifies whether to enable reuse. This allows TIME-WAIT sockets to be re-applied to the new TCP link. net. ipv4.tcp _ syncookies whether to enable SYN cookies. if this function is enabled, when SYN wait queue overflow occurs, use cookies to process net. core. the backlog of the listen function in the somaxconnweb application defaults to net. core. somaxconn is limited to 128, while nginx defines NGX_LISTEN_BACKLOG as 511 by default, so you must adjust net. core. netdev_max_backlog this parameter is used to set the maximum number of packets sent to the queue. net. ipv4.tcp _ max_orphans this parameter is used to set the size of the number of sockets that linux can process without any process. net. ipv4.tcp _ max_syn_backlog this parameter is used to record the maximum value of net. ipv4.tcp _ timestamps this parameter is used to set the timestamp as the serial number. if this function is enabled in a high-concurrency environment, an exception occurs. Therefore, you must disable www.2cto.com. ipv4.tcp _ synack_retries this parameter is used to set the number of SYN retries. net. ipv4.tcp _ syn_retries this parameter is used to set the number of SYN packets sent before the kernel starts to establish a link. net. ipv4.tcp _ fin_timeout indicates that if the local end of the socket needs to be closed, this parameter determines the time it remains in the FIN-WAIT-2 state. net. ipv4.tcp _ keepalive_time when keepalive is enabled, this parameter is used to set the frequency of keepalive messages sent by TCP.
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.