You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SocketsHttpHandler allocating more per HTTP/1.1 request due to additional async state machines #57977
The other piece of data that would be interesting here is, how much does this contribute to allocation overall?
There's some allocation overhead per request that is unavoidable... stuff like request/response objects, response streams, header collections, etc. I don't have a great sense for how much these state machines impact overall memory usage. Obviously the ideal would be to eliminate as much as possible, but if that becomes painful it would be good to understand the overall impact here.
I posted an allocation breakdown for YARP in OneNote - this was for preview 3 of .NET 6.
The new state machines mean an ~8% increase in overall allocated bytes when proxying a request.
Comparing to just HttpClient using non-validated headers, it is a ~1/3 increase in allocated bytes.
Activity
geoffkizer commentedon Aug 24, 2021
Makes sense, as those routines all got refactored a bunch.
I really wish we could combine these state machines without having to reorganize the code.
geoffkizer commentedon Aug 24, 2021
The other piece of data that would be interesting here is, how much does this contribute to allocation overall?
There's some allocation overhead per request that is unavoidable... stuff like request/response objects, response streams, header collections, etc. I don't have a great sense for how much these state machines impact overall memory usage. Obviously the ideal would be to eliminate as much as possible, but if that becomes painful it would be good to understand the overall impact here.
MihaZupan commentedon Aug 24, 2021
I posted an allocation breakdown for YARP in OneNote - this was for preview 3 of .NET 6.
The new state machines mean an ~8% increase in overall allocated bytes when proxying a request.
Comparing to just
HttpClientusing non-validated headers, it is a ~1/3 increase in allocated bytes.stephentoub commentedon Aug 24, 2021
(Miha and I were writing concurrently; I'll post this anyway, but it's consistent with his numbers...)
For this benchmark:
Code
I get:
which means the extra 472 bytes represents a 33% increase over .NET 5.
geoffkizer commentedon Aug 24, 2021
BTW this seems like a benchmark we should preserve somewhere and measure on an ongoing basis.
karelz commentedon Aug 27, 2021
Reopening to track backport to 6.0
karelz commentedon Aug 31, 2021
Fixed in 6.0 RC2 in PR #58252.
Fixed in 7.0 in PR #58092.