-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix OPcache class preload requirement #13986
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
Conversation
I don't remember exactly how these settings relate to opcache and I'm afk. If either true or false work, it means we should remove the sentence actually, since these wouldn't be requirements. Please try and confirm what you observe. |
|
Honestly, these claims should be verified before we commit anything. |
I checked the four combinations using blackfire on a new Symfony project with preloading enabled and it worked for all of them, so I’m not sure there is any requirement. Also even if each combination performed roughly the same, |
@MatTheCat Did you spot And even if not, it doesn't make sense to call |
Nope. If I refer to https://bugs.php.net/bug.php?id=78169 it should not cause any error, but it is true preloaded classes files will still be included. @nicolas-grekas the PHP issue seems stalled; did you hear about it elsewhere? |
performance.rst
Outdated
@@ -111,7 +111,7 @@ performance significantly. | |||
During container compilation, Symfony generates the file with the list of | |||
classes to preload. The only requirement is that you need to set both | |||
``container.dumper.inline_factories`` and ``container.dumper.inline_class_loader`` | |||
parameters to ``true``. | |||
parameters to ``false``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we remove the sentence altogether? To me, the preload file is always generated no matter the value of these parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, agree that it can be removed here.
@nicolas-grekas Do you have an idea where is the best place to put a note about these flags should be false
with preload enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
container.dumper.inline_factories
should be true
with preloading if I understood correctly, and container.dumper.inline_class_loader
should be false
?
This could be added as a ..tip
note maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
container.dumper.inline_factories
should betrue
with preloading if I understood correctly, andcontainer.dumper.inline_class_loader
should befalse
?
Correct
This could be added as a ..tip note maybe?
I think it's kind of a hard requirement to have inline_class_loader: false
, to avoid unexpected errors.
What do you think about this wording?
The only requirement is that you need to set parameters
container.dumper.inline_factories: true
andcontainer.dumper.inline_class_loader: false
,
to disable performance improvements designed for execution without preload.
Let me know if it should be .. tip::
or new wording is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's kind of a hard requirement to have inline_class_loader: false, to avoid unexpected errors.
That's not a requirement, it works without this setting. If not, that should be reported and fixed.
I'm not sure anymore that we should add anything here, this is really a minor difference.
Let's just remove that sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just remove that sentence.
Ok, removed
That's not a requirement, it works without this setting. If not, that should be reported and fixed.
Ok, I'll report it as a bug separately, as it doesn't work well with preload enabled.
Thank you Ivan. |
container.dumper.inline_factories
As stated by @nicolas-grekas in symfony/symfony#32581 (comment)
container.dumper.inline_class_loader
With this parameter set to
true
, we'll do extrainclude_once
for classes already preloaded by OPcache.Additionally, it can lead to warnings (cannot redeclare class) in classes that use
class_alias
, like https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/blob/master/src/EventListener/InvalidationListener.php#L33It's because this class already declared in preload, and PHP tries to declare it again after
include_once
in service getter.