Sunteți pe pagina 1din 2

Introduction to Apache Bench

Apache Bench is initially developed as a benchmarking tool for apache HTTP server. But it can be used
for generic HTTP load testing.

Install Apache Bench


Just Install the apache2-utils package. Oh, Why am I install apache-utils? Installing this
package will bring Apache Bench with other few add-ons.
Install on Ubuntu

sudo apt-get install apache2-utils

Use Apache Bench


Using man ab command you can get an idea about how to use it. Basically, you have to follow below
structure when defining a load test.

ab [ -A auth-username:password ] [ -b windowsize ] [ -B local-address ] [


-c concurrency ] [ -C cookie-name=value ] [ -d ] [ -e csv-file ] [ -f protocol ] [
-g gnuplot-file ] [ -h ] [ -H custom-header ] [ -i ] [ -k ] [ -l ] [ -m HTTP-method ] [
-n requests ] [ -p POST-file ] [ -P proxy-auth-username:password ] [ -q ] [ -r ] [
-s timeout ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -u PUT-file ] [ -v verbosity] [ -V ]
[ -w ] [ -x -attributes ] [ -X proxy[:port] ] [ -y -attributes ] [ -z <td>-attributes ] [
-Z ciphersuite ] [http[s]://]hostname[:port]/path

Most of the cases below format will be enough

ab -n <num_requests> -c <concurrency> <addr>:<port><path>

Example:
ab -n 100 -c 10 http://www.yahoo.com/
Result:
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.yahoo.com (be patient).....done
Server Software:
ATS

Server Hostname:
www.yahoo.com
Server Port:
80
Document Path:
Document Length:

/mail
308 bytes

Concurrency Level:
10
Time taken for tests: 3.917 seconds
Complete requests:
100
Failed requests:
0
Non-2xx responses:
100
Total transferred:
60765 bytes
HTML transferred:
30800 bytes
Requests per second: 25.53 [#/sec] (mean)
Time per request:
391.717 [ms] (mean)
Time per request:
39.172 [ms] (mean, across all concurrent requests)
Transfer rate:
15.15 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect:
172 177 4.1 176
191
Processing: 176 194 63.9 181
671
Waiting:
176 194 64.0 181
671
Total:
349 371 64.3 358
846
Percentage of the requests served within a certain time (ms)
50%

358

66%

360

75%

364

80%

365

90%

369

95%

389

98%

645

99%

846

S-ar putea să vă placă și