Apache Bench (ab) is a command-line tool for load testing and benchmarking HTTP web servers. It is part of the Apache HTTP Server Project and allows you to quickly check your web server’s performance in a simple, straightforward way.
Apache Bench comes preinstalled with most Linux and Mac systems.
If you don’t already have it installed, you can install the apache2 utils package:
apt-get install apache2-utils
If you’re on Windows, you can download the Apache Binaries .zip file, extract it, and find the ab.exe file there.
ab [OPTIONS ...] URL
Commonly used options include:
For a complete list of available options, you can check out the official docs.
Let’s run a simple load test on
ab -n 100 -c 10 https://www.google.com/
The above command stimulates 100 connections (
-n flag) over 10 concurrent threads (
This is ApacheBench, Version 2.3 <$Revision: 1807734 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.apache.org (be patient).....done Server Software: Apache/2.4.18 Server Hostname: www.apache.org Server Port: 443 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256 TLS Server Name: www.apache.org Document Path: / Document Length: 83764 bytes Concurrency Level: 10 Time taken for tests: 25.444 seconds Complete requests: 100 Failed requests: 0 Total transferred: 8410800 bytes HTML transferred: 8376400 bytes Requests per second: 3.93 [#/sec] (mean) Time per request: 2544.434 [ms] (mean) Time per request: 254.443 [ms] (mean, across all concurrent requests) Transfer rate: 322.81 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 560 716 338.5 593 2069 Processing: 1111 1459 399.7 1343 3121 Waiting: 185 228 139.6 196 1000 Total: 1693 2174 545.3 1945 4045 Percentage of the requests served within a certain time (ms) 50% 1945 66% 2198 75% 2472 80% 2686 90% 3020 95% 3297 98% 3860 99% 4045 100% 4045 (longest request)
Note: Apache Bench only uses one OS thread irrespective of the concurrency level (specified by the -c flag). Therefore, when benchmarking high-capacity servers, a single instance of Apache Bench can be a bottleneck. To completely saturate the target URL, use additional instances of Apache Bench in parallel (if your server has multiple processor cores).
View all Courses