-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Reuse HTTP2 stream pipes to reduce allocations #19356
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
PR Benchmark? @halter73 ? I think we have an http2 one now. |
src/Servers/Kestrel/test/Interop.FunctionalTests/HttpClientHttp2InteropTests.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs
Outdated
Show resolved
Hide resolved
@aspnet-hello benchmark http2 |
Starting 'http2' pipelined plaintext benchmark with session ID 'f587ddda7fd541c7ab34bd6f96cfa9ed'. This could take up to 30 minutes... |
Baseline
PR
|
I had some feedback with regards to whether we are allowed to reuse a stream here: #19360. Let's see if my hypothesis is correct, and if so, we should be able to use BeginRequestProcessing as another place to reset the Http2OutputProcuder/Pipe. |
src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/Core/src/Internal/Infrastructure/PipeWriterHelpers/ConcurrentPipeWriter.cs
Outdated
Show resolved
Hide resolved
9bcdbf0
to
f127560
Compare
src/Servers/Kestrel/Core/src/Internal/Infrastructure/PipeWriterHelpers/ConcurrentPipeWriter.cs
Show resolved
Hide resolved
@aspnet-hello benchmark http2 |
Starting 'http2' pipelined plaintext benchmark with session ID 'b8d774b98cad4c4fba20d75206a84278'. This could take up to 30 minutes... |
Baseline
PR
|
src/Servers/Kestrel/Core/src/Internal/Http2/FlowControl/InputFlowControl.cs
Show resolved
Hide resolved
src/Servers/Kestrel/Core/src/Internal/Http2/FlowControl/OutputFlowControl.cs
Outdated
Show resolved
Hide resolved
src/Servers/Kestrel/Core/src/Internal/Http2/FlowControl/StreamOutputFlowControl.cs
Outdated
Show resolved
Hide resolved
|
||
_pipeWriter = new ConcurrentPipeWriter(pipe.Writer, pool, _dataWriterLock); | ||
_pipeReader = pipe.Reader; | ||
_pipeWriter = new ConcurrentPipeWriter(_pipe.Writer, _memoryPool, _dataWriterLock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually surprised that ConcurrentPipeWriter doesn't show up in your profile. I guess there aren't many scenarios where it would allocate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For comparison, how much did it allocate before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Servers/Kestrel/Core/src/Internal/Http2/FlowControl/StreamOutputFlowControl.cs
Outdated
Show resolved
Hide resolved
1d5b809
to
bcbaef4
Compare
Before:
After:
|
bcbaef4
to
a19e489
Compare
8e2a154
to
32a91be
Compare
b4504d9
to
43391fb
Compare
Fixes #19276