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

Streaming XML decoder can reduce heap memory up to 30% #23429

Open
jhendrixMSFT opened this issue Sep 12, 2024 · 0 comments
Open

Streaming XML decoder can reduce heap memory up to 30% #23429

jhendrixMSFT opened this issue Sep 12, 2024 · 0 comments
Labels
Azure.Core CodeGen Issues that relate to code generation pillar-performance The issue is related to performance, one of our core engineering pillars.

Comments

@jhendrixMSFT
Copy link
Member

Current pipeline and codegen will read the response body in the pipeline so that if reading the body fails the operation will be retried. The cached body is then passed to xml.Unmarshal.

It was noticed that skipping body download in the pipeline and swapping out runtime.UnmarshalAsXML for xml.NewDecoder(resp.Body).Decode(&result.ListBlobsFlatSegmentResponse) reduced heap memory consumption by ~30%. Unclear if the same gains would be observed for JSON payloads but should be measured.

I believe we still want the decoding to happen in the pipeline so that if reading the body fails we can retry the request. This would likely require some new APIs in azcore and slight refactoring of codegen such that the *HandleResponse methods perform the decoding as part of the pipeline.

@jhendrixMSFT jhendrixMSFT added CodeGen Issues that relate to code generation Azure.Core pillar-performance The issue is related to performance, one of our core engineering pillars. labels Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core CodeGen Issues that relate to code generation pillar-performance The issue is related to performance, one of our core engineering pillars.
Projects
None yet
Development

No branches or pull requests

1 participant