On Tue, Apr 19, 2016 at 3:10 AM, François Laupretre <franc...@php.net>
wrote:
>
> Le 13/04/2016 17:55, Lin Yo-An a écrit :
> You are mixing 2 related mechanisms here : code persistence and data
> persistence.
>
> Code persistence (reloading the same code again and again in each request)
> is achieved through the autoloader. Autoloading, compbined with opcache
> provides a very fast mechanism to retrieve class definitions. If you
> measure the time taken by your 'require "vendor/autoload.php"' stance, you
> should find it to be extremely fast (with opcache on, of course).
>

"vendor/autoload.php", in this example, is pretty simple, however in most
applications, there are bootstrap script for bootstrapping services (mongo
service, mysql service, sms service ... etc) and setting up some
configurations.

Data persistence is another question: the need here is to save and restore
> object instances. Several cache mechanisms exist for this, saving and
> restoring via serialize/unserialize. The problem with your 'bootstrap'
> approach (apart from the fact that it is not physically possible in PHP) is
> that you won't want to snapshot the *whole* environment, because you always
> want to keep at least some dynamic context. What you actually want to
> 'snapshot' is a set of well-defined object instances. So, the question,
> IMO, is to develop a mechanism faster than the current ones to store and
> retrieve object instances from memory


Yes!  not all global variables will be snapshotted, for now I think EG,
SPL_G (which saves the autoloader instances), and some object instances and
zval. Then these opcode could be skipped a lot. So this looks like
something on top of opcache.







-- 
Best Regards,

Yo-An Lin

Reply via email to