PHP Lands Preload Feature, Boosting Performance In Some Cases 30~50%

Written by Michael Larabel in Free Software on 15 November 2018 at 05:35 AM EST. 5 Comments
FREE SOFTWARE
PHP developers unanimously approved and already merged support for the new "preloading" concept for this web server language. PHP preloading basically allows loading PHP code that persists as long as the web server is running and that code will always be ready for each subsequent web request, which in some cases will dramatically speed-up the PHP performance on web servers.

While PHP has long supported caching to avoid PHP code recompilation on each new web request, with each request PHP has still had to check to see if any of the source file(s) were modified, re-link class dependencies, and similar work. PHP preloading allows for given functions/classes to be "preloaded" that will survive as long as the web server is active. It effectively allows loading of functions or entire/partial frameworks that will then be present for each new web request just as if it were a built-in function.

That level of caching/preloading allows a lot of per-request work to be eliminated, which leads to significant performance gains. But should you need to change any PHP code in those files, they will not go into affect without restarting the web server. This functionality can be controlled by new PHP INI configuration file directives.

Benchmarks done on PHP preload show a 30~50% speed-up though the actual performance impact will depend upon the amount of code that can be preloaded by your web application, among other factors.

The PHP preload support was merged yesterday for what will be released next year as PHP 7.4. More details on this big addition to PHP can be found via the preload Wiki page.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week