Benchmarking PHP Webservers

This post completes the benchmarks for webservers. The last post compared the performance of various reverse proxies, this article benchmarks the execution of php scripts.

The setup is a simple php script which calls phpinfo(). PHP is executed through php-fpm and it communicates with the webserver through a unix socket.

The index.php script:

<?php
phpinfo();

I compared the performance of Caddy, NGINX, Apache and Lighttpd. Concerning the rest of the configuration, the same is used as in the post before.

wrk generated requests for 10 seconds:

wrk -t2 -c100 -d10s http://localhost:8080

Here is the throughput:

Table of throughput using http

Diagram of throughput using http

And the latency, so how long the browser has to wait until it receives the requested site:

Table of latency using http

Diagram of latency using http

The same benchmarks were also run with https instead of http. HAProxy was used as a reverse proxy, so this should show similar results as before, just a bit slower.

Throughput:

Table of throughput using https

Diagram of throughput using https

Latency:

Table of latency using https

Diagram of latency using https