-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Don't double-flush HTTP/1 Content-Length responses #11825
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
Conversation
|
Here are some before and after numbers from the Pipelined Plaintext TechEmpower benchmark: Before PRAfter PRSo it looks like we got about ~6.5% of our RPS back in this benchmark. |
src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/test/InMemory.FunctionalTests/ResponseTests.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/test/InMemory.FunctionalTests/ResponseTests.cs
Outdated
Show resolved
Hide resolved
|
@jkotalik can you please sign off on this, if you feel comfortable with the fix? Thanks! |
|
Is WebApiTemplateAsync a known flaky test? I've seen it fail once here https://github.com/aspnet/AspNetCore-Internal/issues/2220 but Template failures scare me as they showed problems in the past. |
|
The template tests have caught some HTTP/2-related issues. Fortunately, this change is HTTP/1-only where we have much better test coverage. |
|
Merging as this is approved for Preview 7! |
|
@dougbu this was approved for Preview 7 release. Please make sure this is included in the build we produce. |
|
We don't have a coherent build yet but @wtgodbe is aware of this and started a couple of internal builds containing the fix to shorten the time-to-BAR |
This should fix the biggest single cause of the perf regression discussed in #11778. The regression was introduced by #11675 which caused PipeWriter.FlushAsync() to be called twice per response in the TechEmpower plaintext benchmark instead of once like before.
I fixed this by checking whether
_unflushedBytes > 0in Http1OutputProducer.WriteStreamSuffixAsync() for non-chunked responses. If there are no remaining unflushed bytes, we now skip the redundant flush.