-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[API Proposal]: Enable DNS Round Robin as a configurable option for SocketsHttpHandler #68967
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBackground and motivationA lot of our services previously use API Proposalnamespace System.Net.Http
{
public sealed class SocketsHttpHandler : HttpMessageHandler
{
public bool EnableDnsRoundRobin;
} API Usagevar handler = new SocketsHttpHandler();
handler.EnableDnsRoundRobin = true; Alternative DesignsNo response RisksNo response
|
You can use Also we have a more work planned around connection pooling and DNS, e.g.: happy eyeballs #26177. So we might consider this issue more as a request for a feature than a fully fledged API suggestion. |
FWIW if anyone's blocked by the lack of this API, I put a (not really tested) implementation here: https://github.com/MihaZupan/DnsRoundRobin |
If anything, I would much rather see connect policy instead of just bool. That would give user more control beyond just one type of preference. Perhaps what ever comes from #63162. |
Triage: It might be useful together with other connection policies (Happy Eyeball). |
Background and motivation
A lot of our services previously use
System.Net.ServicePointManager
to manage connections to URIs in .Net Framework, and there was an optionServicePointManager.EnableDnsRoundRobin
that we could enable to load balance requests with round robin DNS resolution. However, as we are migrating these services to .Net Core whereServicePointManager
becomes legacy andSystem.Net.Http.SocketsHttpHandler
is used for managing connections instead, the built-in DNS resolution logic does not support round robin. Per connection, it tries the host's list of IP addresses starting from index 0, directing all requests to that address until connection fails or until cache is refreshed. I propose that we addEnableDnsRoundRobin
as a public field inSocketsHttpHandler
so that, when it's set totrue
, the DNS resolution part of the connection will be handled using round robin similarly to how it's done inServicePointManager
.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: