Skip to content
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

ALPN processing on Linux can be improved #58299

Closed
wfurt opened this issue Aug 27, 2021 · 2 comments
Closed

ALPN processing on Linux can be improved #58299

wfurt opened this issue Aug 27, 2021 · 2 comments
Labels
area-System.Net.Security os-linux Linux OS (any supported distro)
Milestone

Comments

@wfurt
Copy link
Member

wfurt commented Aug 27, 2021

this was noticed while working on #57079
There are few places when we allocate when we may not need to - particularly converting ALPN list to array.
The list is typically small so we may use stackalloc.
Further more, typical use would probably have only http11 and h2. We can probably special-case this and avoid processing for each connection. HttpClient already does that:

private static readonly List<SslApplicationProtocol> s_http3ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http3 };
private static readonly List<SslApplicationProtocol> s_http2ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 };
private static readonly List<SslApplicationProtocol> s_http2OnlyApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2 };

@wfurt wfurt added area-System.Net.Security os-linux Linux OS (any supported distro) labels Aug 27, 2021
@wfurt wfurt added this to the 7.0.0 milestone Aug 27, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 27, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

Tagging subscribers to this area: @dotnet/ncl, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

this was noticed while working on #57079
There are few places when we allocate when we may not need to - particularly converting ALPN list to array.
The list is typically small so we may use stackalloc.
Further more, typical use would probably have only http11 and h2. We can probably special-case this and avoid processing for each connection. HttpClient already does that:

private static readonly List<SslApplicationProtocol> s_http3ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http3 };
private static readonly List<SslApplicationProtocol> s_http2ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 };
private static readonly List<SslApplicationProtocol> s_http2OnlyApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2 };

Author: wfurt
Assignees: -
Labels:

area-System.Net.Security, os-linux

Milestone: 7.0.0

@wfurt wfurt removed the untriaged New issue has not been triaged by the area owner label Aug 30, 2021
@rzikm rzikm self-assigned this Jan 11, 2022
@rzikm
Copy link
Member

rzikm commented Jan 20, 2022

After discussion, there don't seem to be more opportunities for (meaningful) optimizations other than stackalloc'ing the buffer when setting ALPN.

@rzikm rzikm closed this as completed Jan 20, 2022
@rzikm rzikm removed their assignment Jan 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Feb 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Security os-linux Linux OS (any supported distro)
Projects
None yet
Development

No branches or pull requests

2 participants