Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize stress Test in CentOS7 Server

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to achieve stress testing in the CentOS7 server, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Stress testing can be done using apache httd's ab tool. The total number of requests for-n 2000,-c 200 is the number of concurrency, and the maximum number of concurrency is 20000.

Ab-n 2000-c 200 http://localhost/ high concurrency setting

If there are a large number of requests and concurrency to access the server (for example, the number of requests exceeds 200000), the system will assume that it has been attacked by SYN flood and take protective measures. When testing with high concurrency, the following error occurs:

Apr_socket_recv: Connection reset by peer

You can set kernel parameters and turn off protection

Vim / etc/sysctl.conf

Add a little configuration:

Net.ipv4.tcp_syncookies = 0

Let the configuration take effect

Sysctl-p attempts high concurrency

Nginx is worthy of a performance expert. Set up worker_processes and worker_connections, turn off net.ipv4.tcp_syncookies in the kernel, and static files can easily reach 20000 concurrency.

Ab-n 200000-c 20000 http://localhost/

Tomcat when apr is turned on, the static file processing capacity is about 1 to 10 of nginx. There's still a big gap.

High concurrency bandwidth

Many customers will require high concurrency, but there are many restrictions to support high concurrency, such as bandwidth.

If the concurrency of 10000 is accessed once per second, and the file size of each request is 10KB, then the amount of data is 100m, which requires about 1000Mbps bandwidth. It is good for general servers to have 10Mbps. Usually one cabinet (about 20 servers) shares 100Mbps bandwidth.

10000 personal use does not mean 10000 concurrency. If you stagger 10 seconds before and after, it is equivalent to 1000 concurrency. If 10000 people click every 2 minutes on average, the average number of concurrency is 100. Of course, there may be more than one request per click, and a page may contain many images, js, css and other files.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report