Hi,
Would you please provide some information on the .NetCore's suggested approach to configure the connection properties which used to be provided through ServicePoint/ServicePointManager in .Net Framework, such as > UseNagleAlgorithm?
Thanks!
cc: @davidsh
Currently, there is no way to control connection level properties for TCP connections in the .NET Core stack except for some small properties on HttpClientHandler like MaxConnectionsPerServer.
See:
https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/ref/System.Net.Http.cs#L78
We do not have any equivalent properties that were in ServicePointManager from .NET Framework.
The .NET team is considering adding back more API surface area in a future .NET Core release and that new surface area might include things like ServicePointManager properties. You’ll need to talk with @Petermarcu and other .NET management to get the details on that project planning.
@davidsh, I think this is quite important considering Azure Table Storage & Queue are affected by Nagle, and affects the performance of services running on CoreCLR, therefore should not be closed (Considering TcpClient already has NoDelay).
It's also important to be able to properly use a singleton HttpClient object while limiting connection lease timeouts.
http://byterot.blogspot.co.uk/2016/07/singleton-httpclient-dns.html
Otherwise things like failover where dns entries are updated become problematic.
Ditto @onovotny. AFAIK there is no way to set the connection lease timeout (as suggested by that link) in .NET Core.
@davidsh, @Petermarcu, are there any updates on this? Is there any chance to disable Nagle algorithm in .net core?
@davidsh, @Petermarcu, any news about disabling Nagle algorithm in .NET Core? Unfortunately, I will be forced to abandon using Kestrel if this is not possible.
ListenOptions allow this to be set when using Kestrel
“Set NoDelay to false to enable Nagle's algorithm for all connections.”
cc: @karelz @stephentoub
UseNagleAlgorithm
is part of .NET Core 2.0:
https://github.com/dotnet/corefx/blob/1ae37add7583acebfa21bbc2074ab627a2f765a7/src/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs#L85
https://github.com/dotnet/corefx/blob/9379ecc213fcd92209d3d7678dcfb286f5225d98/src/System.Net.ServicePoint/src/System/Net/ServicePoint.cs#L55
However, it doesn't seem we're doing anything useful with it beside remembering the value.
Given the impact described above, it may be valuable to actually implement it. @stephentoub @geoffkizer @Priya91 what do you think? Is it achievable goal?
BTW: We have it listed in networking stack roadmap: https://github.com/dotnet/designs/issues/9
Disable it in what part of .NET Core?
If you're using Sockets, set Socket.NoDelay.
If you're using HttpClient, it's disabled by default on Linux as of .NET Core 2.0 and as of one of the servicing releases for 1.1.
https://github.com/dotnet/corefx/pull/15354
https://github.com/dotnet/corefx/pull/16895
@stephentoub how can I configure Nagle algorithm for WebSockets in .NET Core 2.0? Thank you guys for answers!
how can I configure Nagle algorithm for WebSockets in .NET Core 2.0?
Are you implementing a web socket client or server?
@stephentoub I'm implementing the server using app.UseWebSockets()
. And the client using .NET Full Framework 4.6.2, maybe the problem on the client side, I'm investigating it now.
Any update on this? Changing the service point manager values, including the DefaultConnectionLimit does not do anything (it does remember the values which it makes it more confusing).
Most helpful comment
@davidsh, @Petermarcu, are there any updates on this? Is there any chance to disable Nagle algorithm in .net core?