Tuning of Linux system parameters during stress testing

Source: Internet
Author: User
Tags dmesg

There is a site, I use AB to do the pressure test, the result ab always return error, I did some of the following tuning, and finally normal.

Configuration of Nginx

. conf:
Worker_processes 32;
Worker_connections 65536;

Too much time_wait.

In the stress, many time_wait connection descriptors are found through Netstat:

netstat-n | awk '/^tcp/{++state[$NF]} end  {for  (key  in  state) print key ,  "\ t" , State[key ]}  ' ss-ant | awk '  Nr>1  {++s[$1 ]}  END  {for  (k in  s) Print K,s[k]} "   

After a network connection is disconnected, there is a 30-second time_wait time, which causes the connection to run out if the assembly is in parallel.
By looking at the/proc/sys/net/ipv4/ip_local_port_range you can know the port range of the configured Linux kernel auto-assigned port:
Shell> Cat/proc/sys/net/ipv4/ip_local_port_range
1025 65535
Solve:
/etc/sysctl.conf
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
The/sbin/sysctl-p is then executed to let the parameters take effect, allowing the connection to be reused and recycled.

DMESG Error

AB return apr_socket_recv:connection timed out (110)
Cause: DMESG View System error message displays a large number of nf_conntrack:table full, dropping packet, so you need to modify the parameters of this module.
Solve:
Vi/etc/sysctl.conf
Net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_tcp_timeout_established = 1200
Sysctl-p/etc/sysctl.conf

Tuning of Linux system parameters during stress testing

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.