Ab Benchmark utility to perform Load Testing
Date Posted:09-03-2017
There are multiple ways to perform load testing of webserver and websites. Most commonly used load testing are jmeter and ab benchmarking testing. We are going to explain on how to perform ab benchmarking load testing on a website.
Assumption:
- We will perform ab benchmark testing on Ubuntu host. We can perform the same testing on Mac or any linux flavour as well. We need to install the ab utility on machine
- Domain name or IP address which we want to perform Load test.
Performance Testing:
Lets start with ab utility installation. Since, this post deals with Ubuntu host, use apt-get to install ab utility.
apt-get -y install apache2-utils
The above command will install ab utility on the host.
Now, execute the ab benchmark command to get the stats.
ab -n 100 -c 10 http://domain.tld
where,
n – Number of requests to perform for the benchmarking session. The default is to just perform a single request which usually leads to non-representative benchmarking results.
c- Number of multiple requests to perform at a time. To load a single webpage, normally browser sends multiple request to serve a single page. In our example, we assumed that 10 request is being send to load the page.
The sample output
Server Software: Apache
Server Hostname: domain.tld
Server Port: 80Document Path: /
Document Length: 51753 bytesConcurrency Level: 10
Time taken for tests: 26.274 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 5197900 bytes
HTML transferred: 5175300 bytes
Requests per second: 3.81 [#/sec] (mean)
Time per request: 2627.362 [ms] (mean)
Time per request: 262.736 [ms] (mean, across all concurrent requests)
Transfer rate: 193.20 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 271 305 35.7 293 482
Processing: 1760 2177 430.1 2063 5716
Waiting: 561 828 78.1 821 1242
Total: 2061 2482 429.0 2370 6016Percentage of the requests served within a certain time (ms)
50% 2370
66% 2458
75% 2542
80% 2584
90% 2780
95% 3021
98% 3605
99% 6016
100% 6016
From the above example, we can look Concurrency Level is 10 that means at a time, we are sending 10 concurrent connection.
The time taken for tests gives the output on how long does the benchmark utility takes to complete the test.