-
Notifications
You must be signed in to change notification settings - Fork 10.4k
HTTP/2: Improve incoming header performance #38834
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
Conversation
I think it was mainly there for benchmarks. Using a DIM should be fine. Removing it is a different matter. @sebastienros |
|
I think the DIM makes this okay. Even though this would break older netstandard TFMs, Kestrel no longer ships on NuGet. |
Platform benchmarks are also in TechEmpower. I'm guessing that making this type internal and having to copy and paste code to aspnet/benchmarks and techempower isn't ideal. |
Despite the "pubternal" namespace, we've decided to treat |
PR updated. Logic is simplified by removing validation on adding headers to the dynamic table. It is unnecessary because that validation already happens when header name and value are first received. Before:
After:
|
981b612
to
939b765
Compare
This PR makes a bunch of changes designed to improve the performance of parsing incoming HTTP/2 headers:
The most invasive change is moving validation of headers to when they are added to the dynamic table. They are validated once when added to the table and requests can then skip the check. If a header is invalid then an error is thrown before the header is added to the dynamic table. It seems like this is ok to me because it is a connection error either way, but it would be good to get confirmation.This isn't necessary. Header is already validated using existing technology. Optimization is just detecting whether header comes from dynamic table and then skipping all validation.Validation:
What is the deal with IHttpHeadersHandler being public? I worked around breaking the interface by using a default method implementation. Is this acceptable? Any plans to make the interface internal?It's basically public API. Workaround is to use DIM to avoid breaking change to interface.Also, checking the value doesn't contain newlines required some hacky code if an encoding selector is configured.Removed.