I'm currently working on a php project. Starting it up I was curious for creating it the most performance optimized way I(!) can do.

That's what lead me to measure debugging staticstics in a very early stage of the project. Counting the page size and calculating the rendering time was information I was displaying.

Today I wake up, thinking about those statistics and what they tell me about the performance of my application, wondering if they can tell me more about the rendering speed of php in different versions, with different setups.

I rendered a 15.01kB page built together from various php files 10 times after warming up the server (10-15 page refreshes after a server-restart/config change) and took the average of the best 3 results.

So I started a performance test with the various options my hoster provides:

FPM-Apache

8.0 - 0.18ms
7.4 - 0.22ms
7.3 - 0.34ms

Dedicated FPM Apache

8.0 - 0.15ms
7.4 - 0.19ms
7.3 - 0.19ms

FPM nginx

8.0 - 0.18ms
7.4 - 0.24ms
7.3 - 0.20ms

Dedicated FPM nginx

8.0 - 0.15ms
7.4 - 0.18ms
7.3 - 0.19ms

Of course, first I ran it on my local docker container that I use for developing.

Docker Desktop Win10 php:8.1-apache

8.1 - 5.75ms

I do not know how and with what the application pool of php is shared by my hoster but the page rendering using dedicated settings are a lot faster but, of course, consume more memory. Running a page of this size I think I can live with that.

What surprised me was the fact that docker desktop rendered the page by factor 38 slower than a non docker environment. OK, to be fair I'm not running docker on a server CPU nor having storage access times that the server propably has, the server is not as bloated and abstracted as the docker engine is and of course I will continue using docker for developing the application because it comes with a lot of behavioural sugar (is that a word?).

With this insight I decided to change the way my hoster handles this blogging engine and, for obvious reasons, I added the metric to this blog. See below this or any other page. Please keep in mind that this page's rendering speed it not only dependend on PHP rendering but is also communicating with a database.