Apache Benchmarking (ab) on CentOS
The Apache httpd web server comes with a benchmarking tool to simulate a high load and to gather data for analysis.
The Apache Benchmark location on CentOS servers is :
You can symlink the location of ab to be easy to remember:
# ln –s /usr/local/apache/bin/ab /bin/ab or cp -avix /usr/local/apache/bin/ab /bin/
Apache Benchmark can be a helpful tool to determine response times based on various traffic patterns. It lets you determine how many requests per second your server should be able to handle, and how long each visitor will have to wait to receive a response.
The syntax is pretty straight forward:
ab -c 10 -n 1000 http://raafat.innovationsol.com/blog/
- -n 1000: ab will send 1000 number of requests to server raafat.innovationsol.com in order to perform for the benchmarking session
- -c 5 : 10 is concurrency number i.e. ab will send 10 number of multiple requests to perform at a time to server raafat.innovationsol.com
This will create output similar to :
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 raafat.innovationsol.com (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Innovationsol.com Server Hostname: raafat.innovationsol.com Server Port: 80 Document Path: /blog/ Document Length: 54339 bytes Concurrency Level: 10 Time taken for tests: 58.098 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 54542000 bytes HTML transferred: 54339000 bytes Requests per second: 17.21 [#/sec] (mean) Time per request: 580.982 [ms] (mean) Time per request: 58.098 [ms] (mean, across all concurrent requests) Transfer rate: 916.79 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 2 Processing: 209 579 908.4 467 18835 Waiting: 208 579 908.4 466 18834 Total: 209 579 908.5 467 18835 Percentage of the requests served within a certain time (ms) 50% 467 66% 545 75% 589 80% 621 90% 690 95% 944 98% 2107 99% 3244 100% 18835 (longest request)
From this we can see that the server tested was able to hand approximately 17 requests per second and was able to process 1000 requests in just under 58 seconds. Whether or not these are acceptable values completely depends on the requirements of your project and application.
–This article will be followed.