In Apache, there is a program called AB (apache), which is specially used for stress testing. apache (AB) is used to test Apache execution efficiency and can be used to test website stress tools.
AB Parameters
AB parameters:
Usage:/usr/sbin/AB [Options] [http [s]: //] hostname [: Port]/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
§-P postfile file containg data to post
§-T Content-Type Header for posting
§-V verbosity how much troubleshooting info to print
§-W print out results in HTML tables
§-I use head instead of get
§-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 = 100' (repeatable)
§-H attribute add arbitrary header line, eg. 'Accept-encoding: zop'
§ Inserted after 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 do not show percentiles served table.
§-S do not show confidence estimators and warnings.
§-G filename output collected data to gnuplot format file.
§-E filename output CSV file with percentages served
§-S use HTTPS instead of HTTP (SSL)
§-H display usage information (this message)
Use AB
Example of AB:
To execute the connection for 1000 times and concurrent for 20 times (in parallel ):
Syntax: AB-N 1000-C 20 http: // localhost/
Note the following:
§ Time taken for tests: total execution time (over 1000 times)
§ Requests per second: the average number of connections that can be processed per second.
The following is a test on the Windows azure virtual machine. The performance of the virtual machine is not good (compared with ASP. NET web API vs node. js benchmark, take 2 ).
Microsoft Windows [version 6.2.9200]
(C) 2012 Microsoft Corporation. All rights reserved.
D: \ runnable \ test> AB-N 100000-C 80-P test. dat-T 'application/json' http: // Loc
Alhost/
This is apachetings, 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 localhost (Be patient)
Completed10000 requests
Completed20000 requests
Completed30000 requests
Completed40000 requests
Completed50000 requests
Completed60000 requests
Completed70000 requests
Completed80000 requests
Completed90000 requests
Completed100000 requests
Finished 100000 requests
Server Software: Microsoft-Microsoft IIS/8.0
Server Hostname: localhost
Server port: 80
Document path :/
Document length: 5269 bytes
Concurrency level: 80
Time taken for tests: 112.004 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Non-2xx responses: 100000
Total transferred: 553000000 bytes
Total posted: 62200000
HTML transferred: 526900000 bytes
Requests per secondd: 892.83 [#/sec] (mean)
Time per request: 89.603 [MS] (mean)
Time per request: 1.120 [MS] (mean, internal SS all concurrent requests)
Transfer Rate: 4821.62 [Kbytes/sec] canceled ed
542.32 kb/s sent
5363.94 kb/s total
Connection times (MS)
Min mean [+/-SD] median Max
Connect: 0 0 1.3 0 16
Processing: 0 89 65.5 63 532
Waiting: 0 89 65.5 63 532
Total: 0 89 65.5 63 532
Percentage of the requests served within a certain time (MS)
50% 63
66% 78
75% 94
80% 94
90% 141
95% 235
98% 344
99% 407
100% 532 (longest request)
Related Articles:
Apache stress testing tool-AB initial experience
ASP. NET web API vs node. js benchmark, take 2