-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Performance degradation #54865
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
Comments
I can confirm that this issue occurs on 7.0.7 but not on the previous one: Most likely created after the merge of #52917, as you can see above, especially affected seems to be that method: https://github.com/symfony/symfony/pull/52917/files#diff-397b4689ce56cc95e54911f6d78639bb3258a9ee9b36bfa06ec719e9635e6b1dR195 |
Cc @mtarld |
Just created a PR caching the check whether a property is readable or writable. Could you try on your project @mateuszsip and @stloyd? |
…arld) This PR was merged into the 6.4 branch. Discussion ---------- [Serializer] Cache readability/writability computation | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54865 | License | MIT Add in memory cache to reduce the number of times we check whether a property is readable or writable. Commits ------- 94fd291 [Serializer] Cache readability/writability computation
Symfony version(s) affected
7.0.7, 6.4.7
Description
Recently after renovate upgrade bumping a few SF components (including serializer bump 6.4.6 -> 6.4.7) we noticed that our service started having performance problems on one endpoint.
CPU usage went to 100%, service autoscaled up to the limit and we've noticed on traces that service is getting stuck on processing not related to any IO operations.
What's specific about this endpoint is that we receive large json strings that are at some point getting serialized/deserialized and that's what got slow after upgrade.
At some point I even upgraded service to SF 7.0.7 and problem didn't go away.
It looks that downgrading to 6.4.6 or 7.0.6 helps, so I believe that root cause is here: symfony/serializer@v7.0.6...v7.0.7
I don't have any profiles that would tell exactly where it uses so much CPU the problem.
How to reproduce
I will do my best to prepare example repo later today.
Possible Solution
No response
Additional Context
We denormalize payload to an object that uses attributes with serialization group and public getters/setters.
See that changes between tags are related to that.
To test fixes, I prepared a load test using example payload (~850kb)

And p95 went to above 15s on 7.0.7.
Where on revision with a simple serializer dowgrade to 7.0.6 and exactly the same test it's back to normal:

The text was updated successfully, but these errors were encountered: