Closed
Description
Today Kestrel locks and copies buffers into the connection pipe when multiplexing output from multiple streams. We could improve this by using a channel to queue writes to the pipe instead of locking (See
for an example).This samples shows the difference between a SemaphoreSlim
and a Channel<byte[]>
and the performance difference is almost 3x with 0 allocations https://gist.github.com/davidfowl/8af7b6fa21df0fe1f150fb5cfeafa8f7.
There was still lock contention in Channels itself but it was pretty optimized.
We should prototype and measure this change.