-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.Net.SecurityenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue
Milestone
Description
As part of the work to reduce the allocation overhead of websocket reads (and possibly writes), there are 3 state machine allocations that happen per-read remaining in the end to end scenario in ASP.NET Core:
- There are 3 state machine boxes that allocate per operation read
- Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal() (Pool the missing ReadAsync state machine aspnetcore#41345)
- System.IO.Pipelines.StreamPipeReader.ReadAsync.__Core|36_0() (Add ValueTask pooling in more places #68457)
- System.Net.Security.SslStream.ReadAsyncInternal() <- This one
Ideally, we'd add the PoolingAsyncValueTaskMethodBuilder
here to avoid the extra allocation when TLS is involved (which is most of the time these days 😄). This would make our server websocket end to end mostly allocation free on a per operation basis.
PS: The writing size needs to be investigated as well but haven't shown up on many profiles that I've seen (mostly because there hasn't been backpressure).
PaulusParssinen and rzikm
Metadata
Metadata
Assignees
Labels
area-System.Net.SecurityenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue