PHP Lands Preload Feature, Boosting Performance In Some Cases 30~50%
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.
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.
5 Comments