Skip to content
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

Perf: OData performance regressions found between 6.0.0 and 7.7.4 #2835

Closed
xuzhg opened this issue Mar 29, 2024 · 0 comments · Fixed by #2836
Closed

Perf: OData performance regressions found between 6.0.0 and 7.7.4 #2835

xuzhg opened this issue Mar 29, 2024 · 0 comments · Fixed by #2836

Comments

@xuzhg
Copy link
Member

xuzhg commented Mar 29, 2024

Short summary (3-5 sentences) describing the issue.

Assemblies affected

*Which assemblies and versions are known to be affected e.g. OData WebApi lib 7.x

Reproduce steps

  • The Reflection loading is only happening on the initial request for an organization, I can see that it tries to load the Annotation Values and if not found in the EdmModel goes out and calls the EdmLibHelpers.GetMatchingTypes() where the GetClrType is invoked and we see the significant CPU Spike. Subsequent request I see are successfully getting the Annotation from the model.

image

This by itself isn’t a problem, but Dataverse is hosting up to 300 Organizations on an environment and each Organization is trying to load over 1700 assemblies and many more types which is what is generating the spike in CPU load.

Looking at this block here
https://github.com/OData/WebApi/blob/7dbaf97e17acecfb842edd002d7085d423189d87/src/Microsoft.AspNet.OData.Shared/Formatter/Serialization/ODataResourceSerializer.cs#L1751-L1769

Expected result

image

It appears that we are loading all the types available just so that we can ignore the ODataIdContainer type in the GetPropertiesToWrite() method.

We also found this change last year as well around this code block that seems relevant fix regression issue. by ElizabethOkerio · Pull Request #2769 · OData/WebApi · GitHub

What would happen if there wasn't a bug.

Actual result

What is actually happening.

Additional detail

Optional, details of the root cause if known. Delete this section if you have no additional details to add.

xuzhg added a commit that referenced this issue May 6, 2024
… serializer (#2836)

* fixes #2835: omit the ODataIdContainer from model builder, change the serializer

* remove unused test

* Address the comments

* fix the null reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant