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

[release/6.0] Support zero-byte reads on raw response streams in SocketsHttpHandler #72804

Merged
merged 2 commits into from
Aug 11, 2022

Conversation

MihaZupan
Copy link
Member

@MihaZupan MihaZupan commented Jul 25, 2022

Backporting a minimal change to support zero-byte reads for 1.1 WebSockets (contributes to #61475).
Product change is 25029a7 from #61913. It skips changing zero-byte reads for non-WebSockets HTTP (1.x, 2, 3).

Customer Impact

Zero-byte reads are a way of deferring memory allocations while waiting for data to become available.
Their use can significantly reduce memory usage in networking scenarios where idle connections are common.
WebSocket connections represent a scenario that benefits greatly from this.

Zero-byte reads also allow us to avoid pinning large buffers for extended periods of time, avoiding heap fragmentation.
An internal partner facing memory issues due to fragmentation saw a 10x reduction in memory usage with this patch.

Testing

A targeted test case has been added and the patch was validated by an internal party in production.

Risk

Low.

The change is limited in scope to only HTTP/1.1 WebSocket connections.
It has been tested in 7.0 previews for more than half a year with no reported issues.

In order for the user to observe any changes after this patch, they must be explicitly issuing zero-byte reads, which has been uncommon so far (and always a no-op with HttpClient before 7.0).

@ghost
Copy link

ghost commented Jul 25, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Backporting a minimal change to support zero-byte reads for 1.1 WebSockets.
Product change is 25029a7 from #61913.

Author: MihaZupan
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@MihaZupan MihaZupan marked this pull request as ready for review August 2, 2022 16:55
@MihaZupan MihaZupan closed this Aug 11, 2022
@MihaZupan MihaZupan reopened this Aug 11, 2022
@MihaZupan MihaZupan added the Servicing-consider Issue for next servicing release review label Aug 11, 2022
@MihaZupan MihaZupan added this to the 6.0.x milestone Aug 11, 2022
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Aug 11, 2022
@rbhanda rbhanda modified the milestones: 6.0.x, 6.0.9 Aug 11, 2022
Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tactics approved.
Correct milestone applied.
CI errors seem unrelated (no Networking failures).
Area owners signed off.
No OOB package authoring changes for this project (double checked by looking at change history of the csproj).
Ready to merge. :shipit:

@carlossanlop carlossanlop merged commit aaf0840 into dotnet:release/6.0 Aug 11, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants