PHP Update and CDN Implementation Stats for a Typical CMS-Run Web Site
I recently noticed that it had been a while since I updated the version of PHP running on a web site I’m hosting. I’d also not yet implemented a CDN on that site. Both of those items (moving from PHP 5.x to PHP 7.x and using a CDN) are known to be good for site speed. So, I thought I’d do both of these things and measure the difference. Here are the steps I took and the site speed / page load results of this fairly easy task:
Initial Existence on PHP 5.6.30, No CDN:
Load time: 5.33 seconds
Page size: 3.1 Mb
After Migrating to PHP 7, No CDN:
Load time: 3.88 seconds
Page size: 3.2 Mb
After PHP7 *and* Using a CDN:
Load time: 2.06 seconds
Page size: 2.2 Mb
Summary, Notes, and Clarifications:
As you can see, that’s quite an astonishing speed improvement there for fairly low effort. This is definitely a major SEO opportunity for any sites that are still running older PHP versions and/or also that do not utilize CDNs. (Of course, those are just two of many examples of initiatives that can be undertaken to improve site speed in general, but they’re also very much in the “low hanging fruit” category.)
As far as the PHP goes: It’s not always just a couple of clicks to get this working. If you’re running older PHP versions (likely if you had your site built a few years ago) and want to update to 7.x, you may well have some older code on your site that is incompatible with PHP 7.x. This was the case for me. So, I had to review my CMS extensions and update a few items that would not run on PHP 7.x. It wasn’t too difficult to isolate the problems. But, for anyone unfamiliar with diagnosing PHP errors, I could see that step taking a fairly good bit of time! I found it interesting, though, that the page size actually increased a bit at first (likely because the updated software wound up changing the HTML source a little), yet there was a ~1.5 second improvement simply from this step alone.
As far as the CDN goes: First, using Joomla! (the CMS installed on this particular site), it seems the best practice for CDNs is to use a Joomla! extension called CDN for Joomla! by RegularLabs (formerly NoNumber). This extension basically handles changing the URLs for things from your site to the CDN. It’s a free extension for most sites, although plenty of sites may well require the Pro version (e.g., for SSL sites). There are CDNs out there that claim no code changes are needed to run a CDN. But, most CDNs do seem to require some changes such as those provided by the CDN for Joomla! extension.
It should also be noted that the CDN takes a second to pull in your files at first. It needs a chance to build out the cache from which it then serves these files. So, before testing the time on the CDN, I clicked refresh a few times waited a minute.
In all, we went from 5.33 seconds to just 2.06 seconds. I conducted the test from an IP in the middle of the U.S.
Finally: The standard “your mileage may vary” applies here. The data I posted is real, but sites can vary widely on many fronts that would affect the outcome of a similar effort.