-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Cache] add array cache in front of serializer cache #35046
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
[Cache] add array cache in front of serializer cache #35046
Conversation
I tried to chain the system cache provider with an array adapater but it's not possible to include a chain in a chain (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php#L119) |
Alternatively, we could remove this restriction, by merging two chained chains into one. |
forget about this one, we should "just" not tag the decorating chain with cache.pool and that would work. |
d253cb6
to
910198e
Compare
@nicolas-grekas done. |
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.
Extra!
should we do the same for some other system caches (annotations for instance) ? |
I think we should first ensure the other system caches would benefit from it. Maybe it's not worth it because the annotation cache is behind another cache? Maybe it is. It should be investigated case by case IMHO. |
910198e
to
f7ae68e
Compare
hmm, new implementation: the array adapter was behind phparray adapter, so not useful in case of warmup. It's now in front of phparray adapter. Still 9ms slower than a direct local cache in CacheClassMetadataFactory, with a penalty of 5ms for the chain adapter only. Two better solutions:
|
Added a faster implantation with #35079. |
Should we close in favour of #35079? |
I think we can but it is a GREAT patch to apply to any 4.x and 5.0 symfony project, as master is now 5.1 and so, release in may. |
…e (bastnic) This PR was merged into the 5.1-dev branch. Discussion ---------- [Serializer] add array cache in front of serializer cache | Q | A | ------------- | --- | Branch? | master | Bug fix? | performance | New feature? | ... | Deprecations? | no | Tickets | #35041 | License | MIT | Doc PR | This is another implementation of #35041, after #35046. The DI solution is cleaner, but 10ms slower on my scenario (13 vs 3) and this data is not supposed to change at all (even in the original method there is a local cache). Diff from master (without warmup):  Diff form master (with warmup):  Diff from #35046:  Ping @nicolas-grekas Commits ------- 6ee306b [Cache] add array cache in front of serializer cache
Protect serializer apcu/opcache backend with an array cache. It applies only in prod mode.