ps: Site Performance Stress testing is an essential part of the performance tuning process. It is only when the server is under high pressure that it can truly reflect the problems exposed by the various settings. Apache has a self-contained program called AB that can be used for Web site stress testing on Apache or other types of servers.
apachebench Command principle:
The AB command creates many concurrent access threads, simulating multiple visitors accessing a URL address at the same time. Its test target is URL-based, so it can be used to test the load pressure of Apache, as well as other Web servers such as Nginx, Lighthttp, Tomcat, and IIS. The AB command is very low on the computer that emits the load, does not occupy a high CPU, and does not consume a lot of memory, but it can cause a huge load on the target server, which is similar to the CC attack. The use of their own testing should also be noted, or too much load at a time, may cause the target server due to resource consumption, serious even caused the crash.
Format: # AB [Options] [http://]hostname[:p ort]/path parameter Description:-N requests number of requests to perform// The number of requests executed in the test session (the total number of times the page was visited for this test). By default, only one request is executed. -c concurrency number of multiple requests to make//one generation of requests (concurrency), is equivalent to the simultaneous processing of this multiple concurrency, processing is a transaction. The default is one at a time.
Apachebench usage Detailed: In Linux system, generally installed Apache can be directly executed;
# ab-n 1000-c http://10.1.1.128/test.php//n A total of 1000 requests, followed by 100 for 100 concurrent (simulated 100 people simultaneous access), followed by the URL represents the target URL of the test.
650) this.width=650; "class=" AlignCenter size-full wp-image-253 "src=" http://www.forgecode.cn/wp-content/uploads/ 2017/05/apachebench1.png "alt=" website performance AB Command stress test "width=" 614 "height=" 492 "style=" Border:0px;font-family:inherit; font-style:inherit;margin:0px auto 10px;padding:0px;vertical-align:middle;height:auto; "/>
Results Analysis:
Document Path:/test.php
#测试的页面
Document Length: bytes
#页面大小
Concurrency level:100
#测试的并发数, also-c option
Time taken for tests:0.575 seconds
#整个测试持续的时间
Complete requests:1000
#完成的请求数量
Failed requests:0
#失败的请求数量
Write errors:0
Total transferred:171171 bytes
#整个过程中的网络传输量
HTML transferred:15015 bytes
#整个过程中的HTML内容传输量
requests per second:1739.26 [#/sec] (mean)
#最重要的指标之一, which is equivalent to the number of transactions per second in LR, the mean in the parentheses below indicates that this is an average
Time per request:57.496 [MS] (mean)
#最重要的指标之二, which is equivalent to the average transaction response time in LR, mean in parentheses indicates that this is an average----calculation formula: Transaction volume =N/C, transaction average response time = Total time spent/transaction volume
Time per request:0.575 [MS] (mean, across all concurrent requests)
#每个连接请求实际运行时间的平均值
Transfer rate:290.73 [kbytes/sec] received
#平均每秒网络上的流量 to help troubleshoot problems with extended response times due to excessive network traffic
connection times (MS) min mean[+/-sd] median maxConnect: 0 6 8.5 1 28Processing: 1 49 18.4 51 113Waiting: 0 46 17.2 49 91 Total: 11 55 19.5 54 140
650) this.width=650; "class=" AlignCenter size-full wp-image-254 "src=" http://www.forgecode.cn/wp-content/uploads/ 2017/05/apachebench2.png "alt=" website performance AB Command stress test "width=" 496 "height=" 164 "style=" Border:0px;font-family:inherit; font-style:inherit;margin:0px auto 10px;padding:0px;vertical-align:middle;height:auto; "/>
#整个场景中所有请求的响应情况. Each request in the scene has a response time, where 50% of the user's response time is less than 54 milliseconds, 66% of the user response time is less than 58 milliseconds, and the maximum response time is less than 140 milliseconds. In the case of concurrent requests, the CPU is not actually processed at the same time, but is rotated on a per-request basis, so basically the first time of the request is approximately equal to the second time per requests multiplied by the number of concurrent requests.
Summary: In the remote Web server stress testing, often the effect is not ideal (because the network delay too large), it is recommended to use the intranet of another or more servers through the intranet to test, so that the data obtained, the accuracy will be much higher. If you only have a single server, you can test it directly locally, which is more accurate than the remote test effect.
This article from the personal blog: http://www.forgecode.cn/250.html
This article is from the "Peter's Blog" blog, be sure to keep this source http://peterb.blog.51cto.com/8998797/1935087
Website Performance AB Command stress test