Skip to content

Improve HTTP/2 performance by using Channels #30235

Closed
@davidfowl

Description

@davidfowl

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.

cc @JamesNK @halter73 @Tratcher

Metadata

Metadata

Assignees

Labels

HTTP2Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions