-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Investigate performance of large writes on Kestrel #31110
Comments
Thanks for contacting us. |
As this a typical way to write string responses though? I mean, given a user string, one can encode and write at the same time using Encoding.GetBytes. In other words, one of the copies above is only really needed if writing binary data in the first place, no? |
Large buffered responses are common because serializers are mostly synchronous (with the exception of System.Text.Json and maybe some others). This results in application code producing a large response that gets buffered directly in application code, then written to the response. There's 2 ways to do this:
In the second case, we end up copying at multiple layers in the stack. Something I'd like to see us reduce. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
When testing writing a 1MB chunked response, we spend a considerable amount of time copying buffers (this profile is on windows):
The above shows:
Here's what the flow looks like for HTTP/1.1 connections:
HTTPS
copies buffer then flushes(copy removed in .NET 6)HTTP
Packet sizes on the wire look good for both TLS and non-TLS connections:
Non-TLS
TLS
Code sample:
The text was updated successfully, but these errors were encountered: