This article will go through how to install Apache Benchmark tool in Linux. ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. Its goal is to provide you with an impression of the functionality of your present Apache installation. You can specifically see how many requests per second your Apache installation can handle.
How to Install Apache Benchmark tool in Linux
- In the example below I will use Debian-based distribution. Update your system packages.
sudo apt update
- Then install the Apache2 utils package using the following command.
sudo apt install apache2-utils
Sample output
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: libapr1 libaprutil1 The following NEW packages will be installed: apache2-utils libapr1 libaprutil1 0 upgraded, 3 newly installed, 0 to remove and 183 not upgraded. Need to get 288 kB of archives. After this operation, 992 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ke.archive.ubuntu.com/ubuntu jammy/main amd64 libapr1 amd64 1.7.0-8build1 [107 kB] Get:2 http://ke.archive.ubuntu.com/ubuntu jammy/main amd64 libaprutil1 amd64 1.6.1-5ubuntu4 [92.4 kB] Get:3 http://ke.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-utils amd64 2.4.52-1ubuntu4.1 [89.1 kB] Fetched 288 kB in 7s (41.1 kB/s) Selecting previously unselected package libapr1:amd64. (Reading database ... 195523 files and directories currently installed.) Preparing to unpack .../libapr1_1.7.0-8build1_amd64.deb ... Unpacking libapr1:amd64 (1.7.0-8build1) ... Selecting previously unselected package libaprutil1:amd64. Preparing to unpack .../libaprutil1_1.6.1-5ubuntu4_amd64.deb ... Unpacking libaprutil1:amd64 (1.6.1-5ubuntu4) ... Selecting previously unselected package apache2-utils. Preparing to unpack .../apache2-utils_2.4.52-1ubuntu4.1_amd64.deb ... Unpacking apache2-utils (2.4.52-1ubuntu4.1) ... Setting up libapr1:amd64 (1.7.0-8build1) ... Setting up libaprutil1:amd64 (1.6.1-5ubuntu4) ... Setting up apache2-utils (2.4.52-1ubuntu4.1) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
- Check the Apache Benchmark tool installed version using the following command.
ab -V
Sample output
This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
- After the installation, let us test the Apache Benchmark tool using
www.apache.org
ab -n 100 -c 10 https://www.apache.org/
Sample output
This is ApacheBench, Version 2.3 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 Server Hostname: www.apache.org Server Port: 443 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 Server Temp Key: X25519 253 bits TLS Server Name: www.apache.org Document Path: / Document Length: 73851 bytes Concurrency Level: 10 Time taken for tests: 25.812 seconds Complete requests: 100 Failed requests: 0 Total transferred: 7435150 bytes HTML transferred: 7385100 bytes Requests per second: 3.87 [#/sec] (mean) Time per request: 2581.191 [ms] (mean) Time per request: 258.119 [ms] (mean, across all concurrent requests) Transfer rate: 281.30 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 360 869 418.2 780 2622 Processing: 484 1475 1317.9 1179 10315 Waiting: 100 250 138.7 214 881 Total: 909 2344 1524.6 2013 11463 Percentage of the requests served within a certain time (ms) 50% 2013 66% 2317 75% 2486 80% 2698 90% 3571 95% 4937 98% 9321 99% 11463 100% 11463 (longest request)
- You have made it to the end of our tutorial on how to install Apache Benchmark tool in Linux.
Read more about Apache Benchmark tool
Other Tutorials
Install Apache Tomcat on Fedora 36