Speedy PHP 7 Now Available for IBM i
April 5, 2017 Alex Woodie
The fast new PHP language and runtime that Zend Technologies has been working on for two years is now available for IBM i. With the delivery of PHP 7.1 and Zend Server for i 9.1 yesterday, the company says IBM i shops can expect to see their PHP applications run anywhere from 50 to 200 percent faster than before. IBM i shops will also benefit from MariaDB support and a new clustering capability.
The introduction of PHP 7 last fall marked a major overhaul of the popular scripting language that runs on all major platforms. As the first major release of PHP since version 5.6 (the company skipped version 6), Zend put PHP on a diet to restrict how much memory it consumed, which Zend co-founder and CTO Zeev Suraski recounted in great detail for IT Jungle last May.
With a slimmer overall data structure – including smaller hash tables and littler buckets – the Rogue Wave subsidiary was able to achieve a fairly dramatic reduction in the memory overhead of PHP 7. This approach showed great returns in early testing on Intel platforms, where some apps achieved a 7x speed-up directly as a result of the more efficient use of memory.
But IBM‘s Power architecture is a different kettle of fish entirely. It sports higher memory bandwidth to start with, even before you throw IBM i into the mix. Whether PHP 7 would return the same performance gains on IBM i on Power as it did on Wintel/Lintel architectures was not a guarantee.
“We really didn’t know whether the same kind of optimizations, and the fact that we’ve reduced memory management so substantially, was going to affect IBM i at the same level that it affected Intel-based systems,” Suraski said yesterday. “We were worried that because IBM i’s memory management is better, the fact that we reduced the overhead maybe is not going to show the same kinds of improvement.”
After all, if IBM i’s novel single-level storage architecture already reduced memory as a bottleneck in IBM i-based PHP apps, then further optimizing the memory footprint in PHP 7 wouldn’t make much of an impact further down the stack at the application level.
After beta testing, it was clear those fears were largely misplaced. “The actual results look good,” Suraski said. “Long story short, we’re seeing 2x to 2.5x performance gains in real workloads [such as WordPress, Magento or Zend Frameworks apps on IBM i]. The worst benchmark we did shows a 50 percent gain. That’s pretty good, too.”
The bulk of the work, Suraski said, involved porting the DB2 for i extensions into the Zend Server for IBM i 7.1 “You could say in the move from PHP 5 to PHP 7, the language engine has done pretty much what you would call brain surgery,” he said.
Making sure that DB2 for i worked seamlessly with PHP 7.1 and Zend Server for IBM i 9.1 involved working closely with IBM Rochester engineers. After making a few optimizations and adjustments to deal with the peculiarities of IBM i, Zend was confident that it would meet the high level of quality that IBM i shops typically expect from vendor-supported software.
“The database extensions typically deal heavily with data….so those types of extensions are probably the trickiest ones to port,” Suraski said. “It’s not rocket science. It doesn’t take a genius to do that. But it’s quite a bit of work to do the initial port and then to make sure that all the semantics were converted properly.”
There are a few caveats to moving to PHP 7.1 and Zend Server 7.1. Because it’s a major rewrite of the PHP language, Zend broke compatibility with older releases of PHP.
The impact will be felt greatest by companies running PHP version 4.x code that’s over 10 years old. Some of the old PHP version 4.x features were deprecated in version 5.x but still ran and generated alerts for the programmer. Those features have been removed entirely in PHP 7 and will generate errors now.
The good news is few IBM i shops are running PHP code that old. PHP version 4 pre-dates the first release of Zend Core for i5/OS way back in 2005, so the only IBM i shops today who have version 4 were rolling their own PHP code and runtime back then. The vast majority of IBM i shops that use PHP today are running PHP 5.x. Some shops running PHP version 5.4 code may find that they have some additional programming work to do.
“If your code is still running on 5.4, which is two versions back, then you need to essentially close the gaps of the changes in 5.5 and 5.6,” Suraski said. “But in our experience, it’s a relatively shallow level of investment. It’s not that you have to rewrite the code.”
Besides the performance enhancements, Zend Server for IBM i 9.1 brings several other notable features, including support for the MariaDB database and support for clustering on IBM i servers.
Shlomo Vanunu, an IBM i consultant in Zend’s global services practice, says the addition of MariaDB support in the Zend DBi extension picks up where MySQL left off, and enables IBM i shops to finally move up to newer releases of popular PHP applications like WordPress and Magento.
“Moving to MariaDB with Zend DBi allows PHP developers to start using very popular frameworks that require MySQL 5.6 updates, which can open up whole new horizons for all these developers in the IBM i world,” Vanunu said.
Support for clustering will also help IBM i shops scale out their PHP applications. While most IBM i shops address scalability needs by scaling up – or buying a bigger symmetric multi-processing (SMP) Power Systems box from IBM – there are some use cases where scaling out can help.
Several IBM i customer and prospects have asked Zend to support clustering so they can split a Zend Server-based PHP application across two separate LPARs on the same physical box, Suraski said.
“I don’t expect this to become as popular as it is in the Linux world,” he said. “But having that option does gives you the ability to create a situation where you can take one LPAR offline, do some maintenance on it, but still continue serving the application that you have completely uninterrupted.”
A less common use case for clustering involves running the same PHP application on multiple IBM i boxes located in different geographic regions. Zend has had a handful of customers ask the company to support clustering of PHP apps on IBM i so they can use the same application and integration points on servers located in different parts of the world, Suraski said.
PHP 7.1 and Zend Server for IBM i 9.1 are available immediately. For more info, see www.zend.com.