If you are running PHP 5.3 on a production Magento site (Enterprise or Community), you are likely asking yourself whether it is time to upgrade. It’s a difficult question. Upgrading can cause a lot of pain and annoyance. It takes time, possibly introduces bugs, and can delay new and important features.

When you want to weigh the benefits and risks, you need data. You don’t need just any data, either. You need good data.
PHP 5.4 has been out for a while now and there have been many claims made about its speed, resource utilization, and overall importance. There are a lot of blog posts out there where people have run informal tests comparing 5.4 against 5.3 (speed increases and decreased memory footprints), but the results seem to conflict a great deal.

Copious realized that if we were going to get the good data to decide whether to upgrade, we would have to collect it ourselves. That means that the data would need to test PHP under an environment that makes sense to our customers.

PHP and Magento

We use Magento a lot, building and maintaining high volume ecommerce sites for our customers. The issue of performance and efficiency in a newer version of PHP is not only relevant to us, but it’s important to our clients. We thought it was about time to conduct some formal benchmarking tests on PHP 5.3 and 5.4 with a simulated real-world Magento installation. If 5.4 shows much of an improvement over its predecessor, then it makes sense to upgrade.
That’s not the only reason, though. PHP 5.3 is entering its end-of-life cycle this summer, which means there won’t be regular updates and only critical fixes will receive patches. This might be a pain because there are still a few bugs in 5.3 that haven’t been fixed.

Running the Benchmarks

Running the benchmarks was a fun challenge. After setting up a web and database server, I put together a vanilla Magento Enterprise installation and connected it to a MariaDB server loaded with a catalog of 2 million products. I wrote custom shell scripts that emulate the browsing patterns of the average ecommerce customer, and then I got ready to hammer the stuffing out of my carefully crafted setup.

The Results

Each benchmarking test took hours to run, but they produced good, usable results. PHP 5.4 showed a 27% increase in requests per minute over PHP 5.3 with 12% less RAM utilization. In addition, 5.4 utilized far more available resources: 25% more disk I/O and network throughput.
You can read all about the very detailed breakdown of the tests and what we discovered in our white paper on the topic.