Linux Web Performance optimization

Source: Internet
Author: User

1,

Number of time_wait after parameter adjustment


Modify the Linux kernel parameters to reduce time_wait in TCP connections
The impact of kernel parameter tuning on Web performance in Web system is huge, and the related perception needs to be experienced!!
In the case of limited resources (cpu/memory), the use of tuning kernel-related parameters can greatly improve the performance of the web system, optimize the access experience-browser Web site response-visual perception ...
Responsibility and performance issues that cannot be resolved by modifying the relevant kernel parameters need to be upgraded by upgrading resources

Linux system, after the TCP/IP connection is disconnected, the TIME_WAIT state will be retained for a certain amount of time (why? Many-tcp_tw_reuse ...)
Assuming a large amount of concurrent web Concurrency, this will result in a large number of time_wait state connections, and the inability to disconnect these connections in a timely manner consumes a lot of server resources (if time_wait closed;process exit and resource Release
In this case, you can consider optimizing the TCP/IP kernel parameters to clean up the ports of the TIME_WAIT state in time

Linux system view current TCP/IP connection status and corresponding number
#netstat-na | awk '/^tcp/{++s[$NF]} END {for (a in s) print A,s[a]} '

/etc/sysctl.conf
net.ipv4.tcp_syncookies = 1 #表示开启SYN cookies, when there is a SYN wait queue overflow, cookies are enabled to protect against a small number of SYN attacks, the default is 0, which means close

Net.ipv4.tcp_tw_reuse = 1
Represents turn on reuse, allowing time_wait sockets to be reused for new TCP connections, which defaults to 0
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 5

Linux Web Performance optimization

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