magento / community-features

Magento Features Development is an Initiative to Allows Community Memebers Join to Development of Magento Features
46 stars 18 forks source link

Support for PHP 7.4 Preload feature #98

Closed erickmarsh closed 3 years ago

erickmarsh commented 5 years ago

Although PHP 7.4 is still very much in development allowing for M2 to leverage the newly merged "preload" feature could have massive benefits for overall site speed since there is quite a bit of bootstrapping that has to happen in M2 to respond to a request.

RFC - https://wiki.php.net/rfc/preload Git Commit - https://github.com/php/php-src/commit/f6d227ed4f5d4c0276eb720806e808baceb37f10

kirmorozov commented 5 years ago

This one is MUST HAVE

kirmorozov commented 5 years ago

Comparison of means: PHP 7.4 with preload is 11.07% faster then PHP 7.3 PHP 7.4 with preload is 13.25% faster then PHP 7.1

Here is some evidence: https://gist.github.com/kirmorozov/979986508675c5c65a5c51e58d4fb2fa#file-magento_2-2-2_php7-4_preload_vs_php-7-3-results-md

I managed to compile 7.4 and tested just with homepage only. Main trouble is: Looping though xml files. In order to get real benefits we need to stop coding in xmls (kill fancy ui components).

cmuench commented 5 years ago

Magento will be the first class citizen of that feature.

kirmorozov commented 5 years ago

To do preload there is no need to make anything special, just add standalone loader and generate file with list of files to preload. Magento is not self-aware, so preload work like for any other php system.

kozie commented 4 years ago

To do preload there is no need to make anything special, just add standalone loader and generate file with list of files to preload. Magento is not self-aware, so preload work like for any other php system.

Saying it like so makes it sound like a handful of minutes to get a good preload configuration setup for Magento but i can't image it to be that simple. Perhaps there is much to gain with the possible use of composer but i'm not convinced it's a matter of loading everything Magento has in it's base.

kirmorozov commented 4 years ago

It is simple, just get opcode loaded files opcache_get_status(true) list and use opcache_compile_file($file) to load them. Here are some results: https://gist.github.com/kirmorozov/979986508675c5c65a5c51e58d4fb2fa Magento 2.3 works fine on my local 7.4 with minor core patching.

southerncomputer commented 4 years ago

@kirmorozov care to share a link with core patching to get 7.4.1 working with magento 2.3.4?

phoenix-bjoern commented 4 years ago

Can you share the list of files you've preloaded in your test @kirmorozov ?

rvitaliy commented 4 years ago

Yes, but magento doesn't support php 7.4. I opened an issue but it has been closed without any consideration. :cry: https://github.com/magento/magento2/issues/27227

ettoredn commented 3 years ago

Any updates on this?

sivaschenko commented 3 years ago

Magento team have done an internal investigation on this feature request and decided not to implement it as part of the core codebase.

The preload feature can still be used as part of server configuration setting it up with the consideration of the specifics for each individual Magento instance.

Internal Jira ticket: https://jira.corp.magento.com/browse/MC-31789

JosephMaxwell commented 3 years ago

@sivaschenko Would you share some more reasoning as to why? #1 Magento complaint is performance and it appears as if this feature will help mitigate this problem.

sivaschenko commented 3 years ago

@JosephMaxwell I believe it was based on the possible performance benefits comparing to efforts of implementation and maintaining the solution, and also the fact that preload feature can still be utilized without adding a specific preload script to the magento codebase (https://github.com/magento/community-features/issues/98#issuecomment-481635316)

ilnytskyi commented 3 years ago

@sivaschenko Wy the core team would not share some info and guidelines on how to build the preload file for magento. We know that preloading everything is not the best way to use this feature. Some recommendations would be very useful like: load everything from root/generated and vendor/magento/framework; this tool can help you to find "hot" files that you should preload; or something. Just closing the issue without sharing more info is not okay.

ettoredn commented 3 years ago

Why preloading everything is not acceptable?

sunilit42 commented 2 years ago

@JosephMaxwell @ilnytskyi https://github.com/MonogoPolska/monogo-m2-preload

can we use this package for preload? I tried to add that script and works fine for me