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

[Question] Configure HTTP connections in CoreCLR (ServicePoint/ServicePointManager Properties) #18079

Closed
erezvani1529 opened this issue Aug 11, 2016 · 14 comments
Assignees
Labels
area-System.Net question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@erezvani1529
Copy link

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

@erezvani1529 erezvani1529 changed the title [Question] Configure HTTP connections in in CoreCLR (ServicePoint/ServicePointManager Properties) [Question] Configure HTTP connections in CoreCLR (ServicePoint/ServicePointManager Properties) Aug 12, 2016
@davidsh
Copy link
Contributor

davidsh commented Aug 22, 2016

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 davidsh closed this as completed Aug 22, 2016
@prajaybasu
Copy link

prajaybasu commented Aug 23, 2016

@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).

@clairernovotny
Copy link
Member

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.

@nbarbettini
Copy link
Member

Ditto @onovotny. AFAIK there is no way to set the connection lease timeout (as suggested by that link) in .NET Core.

@goncalo-oliveira
Copy link

@davidsh, @Petermarcu, are there any updates on this? Is there any chance to disable Nagle algorithm in .net core?

@yuske
Copy link

yuske commented Oct 13, 2017

@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.

@stickybun
Copy link

ListenOptions allow this to be set when using Kestrel

“Set NoDelay to false to enable Nagle's algorithm for all connections.”

https://github.com/aspnet/KestrelHttpServer/blob/6584a8b5fdaba0a79c52b981cac88472bcc92d1a/src/Kestrel.Transport.Abstractions/Internal/IEndPointInformation.cs#L44

@davidsh
Copy link
Contributor

davidsh commented Oct 13, 2017

cc: @karelz @stephentoub

@karelz
Copy link
Member

karelz commented Oct 13, 2017

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

@stephentoub
Copy link
Member

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.
dotnet/corefx#15354
dotnet/corefx#16895

@yuske
Copy link

yuske commented Oct 16, 2017

@stephentoub how can I configure Nagle algorithm for WebSockets in .NET Core 2.0? Thank you guys for answers!

@stephentoub
Copy link
Member

how can I configure Nagle algorithm for WebSockets in .NET Core 2.0?

Are you implementing a web socket client or server?

@yuske
Copy link

yuske commented Oct 16, 2017

@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.

@juanfranblanco
Copy link

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).

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests