-
Notifications
You must be signed in to change notification settings - Fork 10.3k
API http.sys: EnableKernelResponseBuffering #47777
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
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Is there any reason to want to do this per request rather than per server instance? |
@davidfowl I can see that being a requested option - we have discussed it a few times; I did consider some new optional feature interface, but my view was that ultimately: we don't make buffering per-request for Kestrel (or even an option at all), so it seems weird to say that it would be a hard demand here - so keep the API as simple as possible. But if you disagree, I know how we'd do it. I welcome your thoughts. |
A per-request feature could be useful to libraries that do a bunch of small writes, care about HttpSys perf, and want to avoid mucking with global HttpSysOptions. It's also possible that app developers might only have a specific endpoint they want to enable buffering on. Are there any scenarios where enabling this would be very bad? If so, we should definitely add a feature. If not, should we change the default behavior staring in .NET 8? We could wait for someone to ask for a per-request feature if it's not clear anyone will use it. But if it's easy, why not? |
@halter73 I'm happy to make it a per-request thing - I was mostly trying to minimize the API impact; the actual code for per-request would be minimal:
That ^^^ is the per-request change-set; isn't huge - trickiest bit is naming the feature and API. By contrast: if we keep it simple, the API change is already fairly obvious. Thoughts? |
Don't overcomplicate it. The current proposal fulfils the requirements. The feature could be added later if needed. |
API Review Notes:
API Approved! namespace Microsoft.AspNetCore.Server.HttpSys;
public class HttpSysOptions
{
+ public bool EnableKernelResponseBuffering { get; set; }
} |
@halter73 there might have been a misunderstanding, my comment was that the alternative to enabling kernel buffering was not as performant (i.e. attempting overlapping writes instead of simply enabling kernel buffering didn't work so well). I have no evidence of any downsides of enabling kernel buffering, much the contrary. |
Thanks for the correction @davidni. I'd be tempted to change the default then if we don't think it's going to hurt latency in streaming scenarios or anything like that. I understand wanting to be conservative with this kind of change though. If we did decide to change the default before shipping .NET 8, we'd probably want the feature to selectively disable it just in case. And I'd want to change the option name to |
@halter73 in some ways it is tempting to remove the "enable" vs "disable" nomenclature, preferring just "use", but: that isn't the existing convention :( |
Why is the issue closed? |
@BrennanConroy if I'm doing it wrong: let me know; I thought it was "closed as complete" since approved |
Usually issues are closed when the PR is merged. |
Background and Motivation
Additional configuration option for http.sys : #47776
Proposed API
namespace Microsoft.AspNetCore.Server.HttpSys; public class HttpSysOptions { + public bool EnableKernelResponseBuffering { get; set; } }
Usage Examples
Alternative Designs
for back-port and compat; app-context switch that also impacts initial value
Risks
None; no change if not used; no overload resolution issues.
The text was updated successfully, but these errors were encountered: