Add new comment

Benchmarking Drupal 8 on PHP 7-dev

Difficulty: 
Piece of Cake

It's been a while since I quick benchmarked Drupal 7 on PHP7. But at the time of that writing it was still not possible to benchmark D8 in PHP7, there were too many compatibility issues that simply would not let D8 boot on PHP7.

There is D8 on PHP7 initiative in this queue issue at Drupal.org that has helped get D8 working on PHP7.

Today I was finally able to get D8 up and running on PHP7 and the results were astonishing. We only found 1 PHP bug that was reported (and solved in a matter of hours by the PHP team), indication that PHP7 is still under heavy development and that any test ride should expect issues.

It is not only the switch to PHP7 what makes a difference, but the fact that D8 is faster than D7 out of the box (in the sense that it leverages caching by default and in a more sofisticated way). 

I am though not very happy that the D8 performance efforts are so focused on caching. Relying on caching as the main performance driver is not good for a CMS that aims at being a CMF (sort of a development framework). Caching adds complexity to applications and makes development and troubleshooting slower and more time consuming, and in it's heart it is very dangerous because it helps cover serious performance flaws in the overal system's design. It's sort of a rat's trap because it helps you hide bad implementations or designs in the sort term, but it simply bursts once your application has grown leaving you with no other alternative than starting from scratch because - um - you have been hiding you trash under the carpet for a very long time and there is nothing to be saved. Premature optimization is after all not the root of all evil - it just makes sense to design you system from the ground to be fast and scalable. Designing at your will thinking that later you will make it scalable and fast by caching is a double edged sword.

Premature Optimization can be defined as optimizing before we know that we need to.

Now the results. I had to shift from concurrent throughput testing to sequential single requests because D8 on PHP7 D8 was hiting hardware limits leaving us with numbers such as 1200 Requests Per Second with 8 concurrent requests. Anyways, sequential non concurrent requests give us a better idea of the real performance difference.

This is a very simple 1,000 sequential requests Apache Benchmark test against the default Home Page with Page caching turned off and opcache enabled.

With PHP 7.0.0-dev (Build date: Mar 25 2015 22:22:57):  210 requests per second

With PHP 5.6.6: 22 requests per second.

[UPDATE] Take a look at the comments to see what these numbers are really supposed to be. These results seem to be all screwed up.

We are not comparing D7 to D8, but PHP 5.6 to PHP 7 on the same exact setup. Our D7 comparison threw a +16% for cached pages and +58% for uncached, but this time we are seeing a x10 fold in performance and turnning page caching on and off made no difference to the results (possible indication that we are either setting up something wrong or there's something broken in D8 page caching).