|
ab command principle Apache's ab command simulates multi-threaded concurrent requests to test server load pressure, as well as other web servers such as nginx, lighthttp, and IIS. Apache附带的ab工具(使用的PHP环境是WAMP集成环境,ab工具位于D:wampinapacheApache2.2.21in)非常容易使用。 The ab command has very low requirements for the computer that issues the load, and it will not take up a lot of CPU or too much memory, but it will cause a huge load on the target server, so it is a necessary medicine for some DDOS attacks, suitable for all ages. You must also be cautious when using it yourself. Otherwise, too much load at one time will cause the target server to die directly due to memory exhaustion and have to be hard restarted, which is not worth the loss. In the case of insufficient bandwidth, it is best to test locally, and it is recommended to use another or multiple servers on the intranet to test through the intranet, so that the data obtained will be much more accurate. Stress testing web servers remotely often results ineffective (due to excessive network latency or insufficient bandwidth) Download and Install:
http://mirror.bit.edu.cn/apache//httpd/binaries/win32/?C=M;O=A Find httpd-2.2.21-win32-x86-no_ssl.msi Parameter Documentation:
http://httpd.apache.org/docs/2.2/programs/ab.html
Operation: On Windows, open the cmd command line window and locate it to the bin directory of the apache installation directory cd C:Program Files (x86)Apache Software FoundationApache2.2in Type the command: ab -n 800 -c 800 http://192.168.0.10/ (-n makes 800 requests, -c simulates 800 concurrency, equivalent to 800 people visiting at the same time, followed by the test url) ab -t 60 -c 100 http://192.168.0.10/ Send requests within 60 seconds, 100 requests at a time.
//如果需要在url中带参数,这样做 ab -t 60 -c 100 -T "text/plain" -p p.txt http://192.168.0.10/hello.html p.txt is and ab.exe in a directory p.txt, you can write parameters such as p=wdp&fq=78
Explanation of the resulting parameters: This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.10 (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Finished 800 requests
Server Software: Microsoft-HTTPAPI/2.0 indicates the name of the web server software being tested Server Hostname: 192.168.0.10 Indicates the hostname of the URL of the request Server Port: 80 indicates the listening port of the web server software being tested
Document Path: / represents the root absolute path in the URL of the request, and we can generally understand the type of request by the suffix name of the file Document Length: 315 bytes represents the body length of the HTTP response data Concurrency Level: 800 represents the number of concurrent users, which is one of the parameters we set Time taken for tests: 0.914 seconds The time it takes for all of these requests to complete processing Complete requests: 800 completed requests Failed requests: 0 The number of failed requests Write errors: 0 Non-2xx responses: 800 Total transferred: 393600 bytes Total network transfer HTML transferred: 252000 bytes HTML content transferred Requests per second: 875.22 [#/sec] (mean) Throughput - Requests per second Time per request: 914.052 [ms] (mean) The time it takes for the server to respond to the request and respond to the page Time per request: 1.143 [ms] (mean, across all concurrent requests) The average time consumed per concurrent request Transfer rate: 420.52 [Kbytes/sec] received average traffic per second on the network, which can help rule out the problem of excessive network traffic causing long response times Breakdown of time consumed on the network: Connection Times (ms) min mean[+/-sd] median max
Connect: 0 1 0.5 1 3
Processing: 245 534 125.2 570 682
Waiting: 11 386 189.1 409 669
Total: 246 535 125.0 571 684
The response of all requests throughout the scenario. In a scenario, each request has a response time 50% of these users have a response time of less than 571 milliseconds 80% of users have a response time of less than 652 ms The maximum response time is less than 684 ms Percentage of the requests served within a certain time (ms) 50% 571 66% 627 75% 646 80% 652 90% 666 95% 677 98% 681 99% 682 100% 684 (longest request) This part of the data is used to describe the distribution of each request processing time, for example, in the above test, 80% of the request processing time does not exceed 6ms, this processing time refers to the previous Time per request, that is, for a single user, the average processing time per request.
|