Skip to content

Support for PHP 7.4 Preload feature #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
erickmarsh opened this issue Nov 14, 2018 · 16 comments
Closed

Support for PHP 7.4 Preload feature #98

erickmarsh opened this issue Nov 14, 2018 · 16 comments

Comments

@erickmarsh
Copy link

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 - php/php-src@f6d227e

@kirmorozov
Copy link
Member

This one is MUST HAVE

@kirmorozov
Copy link
Member

kirmorozov commented Mar 21, 2019

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
Copy link

cmuench commented Mar 21, 2019

Magento will be the first class citizen of that feature.

@kirmorozov
Copy link
Member

kirmorozov commented Apr 10, 2019

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
Copy link

kozie commented Dec 10, 2019

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
Copy link
Member

kirmorozov commented Dec 17, 2019

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
Copy link

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

@phoenix-bjoern
Copy link

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

@rvitaliy
Copy link
Member

Yes, but magento doesn't support php 7.4.
I opened an issue but it has been closed without any consideration. 😢
magento/magento2#27227

@ettoredn
Copy link

ettoredn commented Oct 3, 2020

Any updates on this?

@sivaschenko
Copy link
Member

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
Copy link

@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
Copy link
Member

@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 (#98 (comment))

@ilnytskyi
Copy link

@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
Copy link

Why preloading everything is not acceptable?

@sunilit42
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests