ApacheBench is a simple benchmarking tool that comes bundled with most Apache HTTP Server distributions, so if you already have this web server installed, it’s safe to say that you also have ApacheBench. The command that you should look for is called ab
.
We will not go over many details about it, but here’s a simple example of how to use this tool to benchmark a specific web page:
$ ab –n 100 –c 10 http://pessoal.org/blog/index.php
If you need to provide authentication credentials to connect to this web page, you may pass them along with ab
:
$ ab –n 100 –c 10 –A username:password http://pessoal.org/blog/index.php
There are several different options that you can use with this tool, so run it with the –h
argument to see an overview of them. Here’s a sample output (given that you provide the proper URL to it):
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking pessoal.org (be patient).....done
Server Software: Apache/2.0.46
Server Hostname: pessoal.org
Server Port: 80
Document Path: /blog/index.php
Document Length: 19194 bytes
Concurrency Level: 10
Time taken for tests: 8.263694 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 1947100 bytes
HTML transferred: 1919400 bytes
Requests per second: 12.10 [#/sec] (mean)
Time per request: 826.369 [ms] (mean)
Time per request: 82.637 [ms] (mean, across all concurrent requests)
Transfer rate: 230.04 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 51 56 9.3 52 87
Processing: 359 752 259.8 711 1526
Waiting: 173 474 214.0 443 1195
Total: 419 808 258.6 767 1577
Percentage of the requests served within a certain time (ms)
50% 767
66% 833
75% 905
80% 1037
90% 1198
95% 1328
98% 1535
99% 1577
100% 1577 (longest request)
From the output above, we can gather that the web page averaged 12 requests per second, with an average of 82.63 milliseconds taken per request.
3.137.164.241