A version of the Apache Benchmarking tool modified to randomly generate User-Agent headers. For more information on the original project including building this version see the Apache HTTP server benchmarking tool documentation.
The tool is used to stress device detection solutions by providing unique unlikely User-Agents during benchmarking. The original implementation was poorly suited to device detection testing as it repeated a single set of HTTP headers for every test.
The ab executable is dependent on the Apache Portable Runtime (APR).
The simplest method to install APR on Ubuntu is by using the following command.
sudo apt-get install apache2-dev libapr1-dev libaprutil1-dev
For building the executable, CMake and a suitable C compiler are required. On Ubuntu, these can be installed by using the following command.
sudo apt-get install cmake gcc make
For Windows, cmake can be obtained from: CMake.org. The appropriate libraries and sources are downloaded automatically at build time from ApacheLounge.
To install using CMake do:
mkdir build
cd build
cmake ..
cmake --build .
Installation has been tested on Ubuntu 20.04 using MakesFiles generated by CMake, and on Windows using VisualStudio 2019. Other generated builds may be supported, but have not been tested.
For a list of compilers supported by CMake, see CMake Generators.
This version can be provided with a text file containing User-Agents where each User-Agent is a single line in the file. Each request will select a User-Agent at random and further modify up to 10 random characters.
Use the U argument to specify a source of User-Agents. The following example uses the 51Degrees User Agents CSV file which can be found here.
./ab -c 10 -n 10000 -U "../data/20000 User Agents.csv" http://127.0.0.1:8081/
Scripts are provided for both Powershell and Bash as part of the build. These are designed to start a web service, run ApacheBench on a calibration endpoint, then a processing endpoint, close the service, then output the overhead for processing. An example of how these are used is:
./bin/runPerf.sh -h http://127.0.0.1:3000 -n 2000 -s "php -S 127.0.0.1:3000 -t /var/www/performance-tests/" -c calibrate.php -p process.php
bin\runPerf.ps1 -h http://127.0.0.1:3000 -n 2000 -s "php -S 127.0.0.1:3000 -t C:\inetpub\wwwroot" -c calibrate.php -p process.php