Increase your Drupal 7 site speed with PHP 7 | Acro Media
Shawn McCabe

Author

Shawn McCabe

, CTO

Posted in Drupal, Software & Development

July 7, 2016

Increase your Drupal 7 site speed with PHP 7

PHP has spent many years in the 5.x era, moving through point releases and incremental functionality changes. There was an attempt at a large Unicode rewrite for PHP 6 that never got too far off the ground and we’ve just kept trucking along on PHP 5.

We’ve now skipped right past PHP 6 and on to PHP 7, which has focused almost exclusively on performance, with some very dramatic improvements. Many benchmarks have been touting a 2x speed increase, and some initial benchmarks on Drupal 8 and other PHP platforms have shown that to be true.

What about Drupal 7 though? A Drupal 8 upgrade is a long way off for many people. PHP 7 is largely backwards compatible with PHP 5, so making Drupal 7 work on it is not out of the question. Just recently Drupal 7 achieved 100% passing test coverage on PHP 7 and I figured we should run it through some benchmarks to test performance.

Not technical? Click here to learn how faster websites make more money.

PHP 5 vs PHP 7 loadtime

As you can see in the chart above, the improvements are even greater than expected, with average response times 2.5x quicker on a standard Drupal install and 3x quicker on a standard Drupal Commerce Kickstart install.

For the above benchmarks, I ran the following setup:

  • Stock Ubuntu 14.04 Nginx setup on an AWS t2.small instance
  • Both setups are identical except for the PHP version.
  • I used Apache Bench for the tests, running 1000 requests at 10 concurrency

Command:

I ran the tests multiple times to ensure consistent results and also ran them with different concurrency settings, which produced different times but the same ratio between PHP5 and PHP7.

Download Our PHP 7 Upgrade SheetSome cursory results also show it using about half the amount of memory, but I’d like to profile that a bit more accurately before I feel totally confident in those results.

Drupal 7 and Drupal Commerce 1.x are quite new to running on PHP7, so use them with caution, but it seems very easily worth the risk with such drastic speed improvements.

Are interested in upgrading your site to PHP 7?

If you are interested in upgrading your Drupal 7 and/or Drupal Commerce 1.x site to PHP 7, contact Acro Media for assistance or download our PHP 7 Upgrade Information Sheet.