AB is a very useful test tool for Apache, and when you're done with Apache, you can find AB below the bin.
1 We can simulate 100 concurrent users, send 1000 requests to a page
./ab-n1000-c100 http://vm1.jianfeng.com/a.html
Where-n represents the number of requests,-C represents the number of concurrent
return Result:
# #首先是apache的版本信息
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 vm1.jianfeng.com (Be patient)
Server software:apache/2.2.19 # #apache版本
Server Hostname:vm1.jianfeng.com # #请求的机子
Server port:80 # #请求端口
Document Path:/a.html
Document length:25 Bytes # #页面长度
Concurrency level:100 # #并发数
Time taken for tests:0.273 seconds # #共使用了多少时间
Complete requests:1000 # #请求数
Failed requests:0 # #失败请求
Write errors:0
Total transferred:275000 bytes # #总共传输字节数, contains HTTP header information, etc.
HTML transferred:25000 Bytes # #html字节数, the actual number of pages passed bytes
Requests per second:3661.60 [#/sec] (mean) # #每秒多少请求, this is a very important parameter value, the throughput of the server
Time per request:27.310 [MS] (mean) # #用户平均请求等待时间
Time/request:0.273 [MS] (mean, across all concurrent requests) # #服务器平均处理时间, the countdown to server throughput
Transfer rate:983.34 [Kbytes/sec] Received # #每秒获取的数据长度
Connection times (ms)
min MEAN[+/-SD] median Max
connect: 0 1 2.3 0
Processing: 6 25 3.2 25
waiting: 5 24 3.2 25
total: 6 25 4.0 25 )
Percentage of the requests served within a certain time (MS)
50% 25 # # 50% requests to return within 25MS
66% 26 # # 60% requests to return within 26MS
75% 26
80% 26
90% 27
95% 31
98% 38
99% 43
100% (Longest request)
2 AB can also run in Windows, if you install Apache under Windows, you can find ab.exe under bin
Can be used directly, without relying on other DLLs
Here is the result of my use of Ab.exe Test Sina page:
c:usersnickyjfdesktopuseful>ab-n1000-c100 http://sports.sina.com.cn/k/2011-05-24/12095590365.shtml
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 sports.sina.com.cn (Be patient)
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed 900 Requests
Completed 1000 Requests
Finished 1000 requests
Server software:apache/2.0.63
Server Hostname:sports.sina.com.cn
Server port:80
Document path: /k/2011-05-24/12095590365.shtml
Document length: 86680 bytes
Concurrency level:
Time taken for tests: 66.453 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total Transferred: 87135790 bytes
HTML transferred: 86680000 Bytes
Requests per second: 15.05 [#/sec] (mean)
time per request: 6645.294 [MS] (mean)
Time/request: 66.453 [MS] (mean, across all Concurrent requests)
Transfer rate: 1280.51 [kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:1 56 398.3 2 3003
processing:89 6331 2603.7 6293 14626
Waiting:2 1748 1485.9 1590 6284
total:90 6388 2615.0 6302 14627
Percentage of the requests served within a certain time (MS)
50% 6302
66% 7121
75% 8435
80% 9193
90% 9231
95% 9385
98% 11549
99% 12459
100% 14627 (Longest request)
3 Apache AB tools are also considered a DDoS attack tool.
Test
Server software:apache/2.0.54
Web server Platform
Server hostname:127.0.0.1
Server Host Name
Server port:80
Server port
Document Path:/index.html.zh-cn.gb2312
The page document for the test
Document length:1018 bytes
Document size
Concurrency level:1000
Concurrent number
Time taken for tests:8.188731 seconds
Duration of the entire test
Complete requests:1000
Number of requests completed
Failed requests:0
Number of failed requests
Write errors:0
Total transferred:1361581 bytes
The amount of network traffic in the whole scene
HTML transferred:1055666 bytes
The amount of HTML content transferred throughout the scene
Requests per second:122.12 [#/sec] (mean)
One of the most concerned indicators, equivalent to the number of transactions per second in LR, followed by the mean in parentheses indicates that this is an average
Time per request:8188.731 [MS] (mean)
The two most concerned indicators, equivalent to the average transaction response time in LR, followed by the mean in parentheses indicate that this is an average
Time/request:8.189 [MS] (mean, across all concurrent requests)
Average of actual elapsed time per request
Transfer rate:162.30 [Kbytes/sec] Received
The average traffic on the network per second can help eliminate the problem of excessive network traffic leading to longer response times
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:4 646 1078.7 89 3291
processing:165 992 493.1 938 4712
waiting:118 934 480.6 882 4554
total:813 1638 1338.9 1093 7785
The decomposition of the time consumed on the network, the specific algorithm of each data is not very clear
Percentage of the requests served within a certain time (MS)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (Longest request)
The response of all requests in the entire scenario. Each request has a response time in the scenario where 50% of the user response time is less than 1093 milliseconds, 60% of the user response time is less than 1247 milliseconds, and the maximum response time is less than 7785 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.
Usage:ab [Options] [http[s]://]hostname[:p Ort]/path
Options are:
-N requests number of requests to perform
-c concurrency number of multiple requests to make
-T TimeLimit Seconds to Max. Wait for responses
-B windowsize Size of TCP send/receive buffer, in bytes
-P postfile File containing data to POST. Remember also to Set-t
-U putfile File containing data to put. Remember also to Set-t
-T Content-type content-type header for POSTing, eg.
' Application/x-www-form-urlencoded '
Default is ' Text/plain '
-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 Add cookie, eg. ' Apache=1234. (repeatable)
-H attribute Add arbitrary header line, eg. ' Accept-encoding:gzip '
Inserted after the all normal header lines. (repeatable)
-A attribute Add Basic WWW authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy authentication, the attributes
are a colon separated username and password.
-X Proxy:port ProxyServer and port number to use
-V Print version number and exit
-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
-R Don ' t exit on socket receive errors.
-H Display Usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (in the OpenSSL ciphers)
-F Protocol Specify SSL/TLS protocol
(SSL2, SSL3, TLS1 or All)
-A Auth-username:password supports Basic authentication certificates, using a "colon" between username and password, and AB is transmitted in clear text. Whether the server needs it or not, your server needs to support 401 authentication.
-C concurrency The number of requests sent to the server at the same time, the default state is to execute only one HTTP request at a time.
-C Cookie-name=value Add a cookie:line to the request. The argument is typically in the form of a name=value pair. This field is repeatable.
-D do not display the "percentage served within XX [MS] table". (Legacy support).
-e csv-file Write a Comma separated value (CSV) file which contains for each percentage (from 1% to 100%) the time (in Mil Li seconds) It took to serve that percentage of the requests. This is usually more useful than the ' gnuplot ' file; As the results are already ' binned '.
-G gnuplot-file Write all measured values out as a ' gnuplot ' or TSV (Tab separate values) file. This file can easily is imported into packages like Gnuplot, IDL, Mathematica, Igor or even Excell. The labels are on the ' the ' file.
-H Display Usage instructions
-H Custom-header appends additional title strings to the request package. This parameter should be a valid header row (header line), usually using a colon ":" to separate valid pairs (valid pair) such as ' Accept-encoding:zip/zop; 8 bit ';
-I replaces the Get method with an HTTP header (head). Cannot be added to the POST method
-K allows HTTP KeepAlive, i.e. executing multiple requests in an HTTP session, the default is no KeepAlive;
-N Requests the number of requests that are issued when a test session is performed, by default, by executing a single request of course, there's no point in this test result.
The-P post-file test program, AB, sends a request with an HTTP POST to Apache server.
-P Proxy-auth-username:password When you need to test an HTTP server through an agent and your proxy needs user name password authentication, you can use this option, the same username and password using a colon ":" separated, AB will be in the clear way Send out, of course, if your agent is in the 407 authentication state
Q-processing more than requests, AB outputs a progress count on stderr every 10% or-requests or so. THE-Q flag would suppress these messages.
-S when compiled in (Ab-h'll show you) use the SSL protected HTTPS rather than the HTTP protocol. This feature is experimental and very rudimentary. You are probably do not want to use it.
-S do not display the median and standard deviation values, nor display the Warning/error messages when the average and me Dian are more than one or two times the standard deviation. and default to the Min/avg/max values. (Legacy support).
-T TimeLimit the length of time to set the test, using this option AB will automatically set the number of test request sessions to 50000 and then set the time as a fixed period. There is no time limit in the default state, which is until the number of requests you have set is completed.
-T Content-type the content type header, used at the time of post data.
-V verbosity Sets the redundancy level, level 4 prints out the details of each request header, level 3 prints out the response code (for example, 404,200), and level 2 prints out warning messages and instructions
-V Display version number and exit
-W Prints the output to an HTML table. The default table is a two-column n-row white-bottom black box
-X <table>-attributes uses strings to describe the properties of a table that should be inserted into <table >
-X proxy[:p ORT] Use a proxy server for the requests.
-Y <tr>-attributes Property name (<tr>) used to generate each row of the HTML table
-Z <td>-attributes Property name (<td>) used to generate each column in an HTML table