Skip to content

olegbilovus/docker-webserver-benchmark

Repository files navigation

Benchmark

This folder contains the settings to benchmark Apache, Lighttpd and Nginx as web servers for static and dynamic content. A docker-compose file is available for each server which will run the server and set the content.

The static content is made of two files of random ASCII characters. The first one is 20KB in size at /static-20k.html and the other one is 2MB at /static-2m.html.

The dynamic content is generated by PHP. For Apache, the official php:apache image is used while the other two use php:fpm. There are two endpoints: /time.php returns a constant string and the current server's time, /info.php return the phpinfo(); output.

This is an example of how to run the Apache server

docker-compose -f docker-compose-apache.yml up

Apache will start on port 8090, Nginx on 8091 and Lighttpd on 8092. This behaviour can be easily changed in the docker-compose files.

Apache Benchmark

There is a Python script abToCSV.py which can be used to parse ab's output to a CSV file. The script can be used with a pipe from ab to read the data and convert it to CSV when ab finishes.

Example:

ab -n 50000 -c 200 http://127.0.0.1:8090/static-20k.html | python abToCSV.py --stdin --out out.csv -a

The generated CSV can be used to visualize data with tools like Orange.

Nginx localhost issues

When using Nginx and ab, make sure to not use localhost as the host in the URL in ab but 127.0.0.1 or you can use any other device on the LAN/WLAN. It was observed that when localhost is used, the server would return 404 to any request because it was looking in the wrong root directory.

About

Benchmark web servers on Docker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages