Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] enable metadata cache when annotation is disabled#49679
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
This patch works for me as a fix for the regression in 5.4
This means the serializer cache is not auto-invalidated when using yaml/xml. That was the case before, and is an acceptable tradeoff given the perf drop of parsing all files in every requests (in dev).
For 6.3 or up, we could add some auto-invalidation mechanism based on resource checkers, like we do for the container. That'd mean allowing loaders to declare their resources and the cache metadata factory to use those resources to trigger a prune on the pool when needed.
If you're OK with that, can you please open an issue so that we keep track of the need?
bastnic commentedMar 14, 2023
No no, it is! |
nicolas-grekas commentedMar 16, 2023
(please check test failures, they look related) |
090ea0b tof1bf23dComparebastnic commentedMar 25, 2023
@nicolas-grekas tests are fixed now. |
nicolas-grekas commentedMar 28, 2023
In standalone mode, tests still fail, can you have a look? (aka when running them from inside the FWB directory.) |
f1bf23d to1773dffComparenicolas-grekas commentedMar 31, 2023
Thank you@bastnic. |
Uh oh!
There was an error while loading.Please reload this page.
When using Annotations, annotations are cached at
AnnotationLoaderlevel.Which is cleared when entities are changed. So the dev experience is optimal.
When using yaml files, there is no cache at the loader level so I added in the past the same cache as for the prod env, as the metadata are effectively cleared when using only yaml config files.
#35109
The regression introduced by my patch is for people that do not use mapping files but use annotations.
#41961
But now, we are in the opposite situation: no cache for people using mapping files but not annotations.
On a current project it means loading 83 yaml files for each dev requests. It's not good at all.
A simple local fix is to add that in a dev services files.
A solution in Symfony could be:
1/ only yaml/xml mapping files (
enable_annotations: false) : cache like prod => that what I did in this PR, as it fixes the current perf regressions on my different projects. There is no cache on yaml/xml file as soon as annotation is enabled (which is the default)2/ add a cache at reader level for yaml/xml loader
3/ add a cache cleaner at metadata level when annotation are enabled