Re: FPM preloading of PHP files
| From: | Dmitry Stogov | Date: | Fri, 20 Apr 2018 07:54:17 +0000 |
| Subject: | Re: FPM preloading of PHP files | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102064@lists.php.net to get a copy of this message | ||
Hi Jakub,
I thought about pre-loading explicitly specified files (or directories) on PHP startup, before
forking worker processes.
As result all pre-loadd files should be available to all workers. Of course the should be kept in
immutable form.
Thanks. Dmitry.
________________________________
From: jakub.php@gmail.com <jakub.php@gmail.com> on behalf of Jakub Zelenka
<bukka@php.net>
Sent: Wednesday, April 18, 2018 8:18:33 PM
To: Dmitry Stogov
Cc: PHP internals list
Subject: Re: FPM preloading of PHP files
Hi Dmitry
On Tue, Apr 17, 2018 at 5:44 PM, Dmitry Stogov <dmitry@zend.com<mailto:dmitry@zend.com>> wrote:
Hi Jakub,
I though not only about FPM, but a technology for any SAPI.
Pre-loaded classes and functions might be kept in CG() tables, in the same way as
"internal" ones.
EG() constants and variables may be re-created at start of request, executing pre-loaded PHP code.
Few years ago, I developed something similar for PHP-5.
Yeah that's what I kind of meant by the engine support. :) My idea was more about when it
should be preloaded. For example one option would be to preload it automatically if nothing has been
preloaded as part of php_execute_script / zend_execute_script. However that would mean to do it for
each child (basically use it for all request for the child process life). It should work and might
be a viable options for the initial implementation but more optimal would be do it once for all
children running in the same pool which could be doable using the pool managers. I think it would be
great to have some kind of API so the SAPI can explicitly preload the script.
Cheers
Jakub