The server load is too large to affect program efficiency is very common, the Apache server with a tool called AB (Apachebench) in the bin directory. AB is dedicated to HTTP server benchmark testing, which can simulate multiple concurrent requests at the same time, using this lightweight tool we can load test the server.
Today in the company also use it to do some testing, now sorted out some of its things to share under.
First we want to get Apache server directory under the bin path, my Computer path is D:\wamp\bin\apache\Apache2.2.21\bin, open cmd, go to this directory, in which enter: Ab-n 10-c http:// www.jb51.net/This instruction, this instruction means: Ab-n All request number-c concurrency number test URL. It is worth noting that if your test URL is a Web site, please remember to add/, otherwise it will not work.
The following are the results of my operation:
Copy Code code as follows:
D:\wamp\bin\apache\apache2.2.21\bin>ab-n 10-c http://www.jb51.net/
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 www.jb51.net (Be patient) ... done
Server software:microsoft-iis/6.0 //microsoft-iis servers version 6.0
Server Hostname:www.jb51.net //Servers host name
Server port:80 //Servers port
document Path:/// Test page Documentation
Document length:32639 bytes //doc Size
concurrency level:10 //Concurrent number
Time taken for tests:13.548 seconds //duration of the entire test
number of Complete REQUESTS:10//Completed requests
number of Failed requests:0//Failed requests
Write errors:0
Total transferred:331070 bytes //network traffic in the entire scene
HTML transferred:326390 bytes //HTML content transfer in the entire scene
Requests per second:0.74 [#/sec] (mean) //Sec transaction, followed by mean in parentheses indicates that this is an average
Times per request:13547.775 [MS] (mean) //Average transaction response time, followed by mean in parentheses indicates that this is an average
Time to request:1354.777 [MS] (mean, across all concurrent requests) //average of actual running times per request
Transfer rate:23.86 [kbytes/sec] received /per-second traffic on the network can help eliminate the problem of excessive network traffic leading to longer response times
Connection Times (ms) //The decomposition of the time consumed on the network
Min MEAN[+/-SD] Median max
Connect:1 2 0.8 2 3
processing:2163 3981 3420.2 2957 13540
waiting:1305 3204 3595.3 2096 13169
total:2164 3983 3420.0 2959 13541
Here is the response to all requests in the entire scenario. There is a response time for each request in the scene, where 50% of the user response time is less than 2959 milliseconds, 66% of the user response time is less than 3074 milliseconds, and the maximum response time is less than 13541 milliseconds. Because the CPU is not actually processed at the same time for concurrent requests, it is rotated on a per-request basis, so it is basically the first time to request times equal to the second time of the request times multiplied by the number of concurrent requests.
Percentage of the requests served within a certain time (MS)
50% 2959
66% 3074
75% 3974
80% 4008
90% 13541
95% 13541
98% 13541
99% 13541
100% 13541 (Longest request)
The following is an introduction to the parameters in the AB instruction:
Copy Code code as follows:
-N Requests the total number of requests
-C Concurrency concurrency number
-T TimeLimit most pass wait response time
-P postfile Post data file
-T Content-type POST Content-type
-V verbosity how much troubleshooting info to print
-W Print out results in HTML tables
-I use head instead of
-X attributes String to insert as table attributes
-Y attributes String to insert as TR attributes
-Z attributes String to insert as TD or TH attributes
-C attribute to add cookies, eg. ' Apache=1234. (repeatable)
-H attribute joins HTTP header, eg. ' Accept-encoding:gzip '
Inserted after the all normal header lines. (repeatable)
-A attribute HTTP authentication, separate pass user name and password
-P attribute Add Basic Proxy authentication, the attributes
are a colon separated username and password.
-X Proxy:port Proxy Server
Copy Code code as follows:
-V View AB version
-K Use HTTP KeepAlive feature
-D don't show percentiles served table.
-S don't show confidence estimators and warnings.
-G filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-H Display Usage information (this message)