OK, this is a bit of a far-reaching title, but I think in this case, it’s fully warranted. We’ve recently released Zend Server 9.1, which brings the wonders of PHP 7 (and more specifically, 7.1) to the IBM i platform. This is huge news for the IBM i crowd, which is typically very interested in performance, as it’s one of the few cases where you can radically improve both speed and density simply by upgrading 3rd party software.
The PHP 7 project started back in 2014 after realizing that our efforts to bring performance boosts in new versions of PHP weren’t quite working, and the speed-up between versions plateaued:
In this chart you can see that while the boost from 5.0 to 5.1 was dramatic, and while we’ve managed to consistently improve performance going into 5.2, 5.3 and 5.4 – the gains realized in 5.5 and 5.6 weren’t nearly as substantial. As a matter of fact, what you’re seeing in this chart are results for a synthetic benchmark, a CPU-intensive workload that isn’t representative of real world apps. Typically, a ~5% gain in a synthetic benchmark (like in 5.5 and 5.6) would barely be a rounding error in a real-world workload. In other words, the reality of the situation was even worse than this chart implies.
We decided to go back to the drawing board, and consider a more revolutionary approach, rather than evolutionary as the 5.x series was. After years of research, grandiose POCs (including one for introducing a JIT engine for PHP), we ended up refactoring large parts of the Zend Engine codebase, drastically compacting data structures, to both reduce memory consumption, and to lighten the overhead of managing and moving data around. This latter element is an important one – as today, CPUs are extremely fast, a lot faster than the system memory they work with. The more data they need to move to or from the main memory, the slower their performance would be – and on the flipside – reduce the amount of data they need to move to or from the main memory, and you’ll realize substantial gains.
The zVal – or Zend Engine Value – a data structure that represents any type of value that can exist in PHP – went on a diet and shed 33 percent of its volume going down from 24 to 16 bytes, the Bucket data structure – used to encapsulate elements within PHP arrays (as well as other types of elements) went on an even more aggressive diet, shedding more than half of its volume and going down from 72 bytes to just 32 bytes. HashTables, used to encapsulate PHP arrays was also compacted.
One company that upgraded their production servers from PHP 5 to 7, Badoo, saw memory consumption per request drop from approximately 37MB/req to just 5MB/req – allowing them to run a lot more concurrent requests on the same hardware compared to before. They also measured a roughly 2x reduction in CPU load, running the exact same workload compared to before:
Badoo’s experience was in no way exceptional, with many other companies reporting similar gains simply from moving PHP 5 to PHP 7.
PHP 7 on IBM i
With Zend Server 9.1 now available on IBM i, all the benefits of PHP 7 are now at your disposal. Before you ask, yes, the performance gains on IBM i are as dramatic as they are on other platforms. We’ve measured substantial gains, typically 50-150 percent better performance, compared to the exact same workloads running on PHP 5.6:
To make migration easier and safer, we’ve decided to make Zend Server 9.1 installable side-by-side with Zend Server 8.5, allowing you to take the time you need to migrate your applications from PHP 5.6 to 7.1. You can run both, in parallel, for as long as you need – and both can serve production users at the same time.
That said, we don’t expect you’d have to wait too long before moving completely to PHP 7. In our experience, that migration is usually straightforward, and predominantly involves ensuring your PHP 5 code doesn’t use elements that have been deprecated in the 5.x series – as those have been completely removed in PHP 7. In other words, if your code doesn’t emit E_DEPRECATED errors when this error level is enabled, chances are it’ll just work on PHP 7. Of course, our engineers would be happy to provide help and guidance for interested companies, as we’ve gained quite a bit of experience helping countless successful migrations.
PHP 7 is a remarkably exciting technology, that doesn’t only look good on paper – but actually helps companies improve performance, increase customer and user satisfaction – and even save money in the process. It’s even more exciting now that it’s available for the IBM i platform. If you haven’t yet looked into it, it’s time to check it out!