You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[API Proposal]: Enable DNS Round Robin as a configurable option for SocketsHttpHandler #68967
A lot of our services previously use System.Net.ServicePointManager to manage connections to URIs in .Net Framework, and there was an option ServicePointManager.EnableDnsRoundRobin that we could enable to load balance requests with round robin DNS resolution. However, as we are migrating these services to .Net Core where ServicePointManager becomes legacy and System.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 add EnableDnsRoundRobin as a public field in SocketsHttpHandler so that, when it's set to true, the DNS resolution part of the connection will be handled using round robin similarly to how it's done in ServicePointManager.
You can use ConnectCallback for this. It's more involved than a single boolean, but it can unblock you right now.
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.
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.
Activity
ManickaP commentedon May 6, 2022
You can use
ConnectCallbackfor this. It's more involved than a single boolean, but it can unblock you right now.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.
MihaZupan commentedon May 6, 2022
FWIW if anyone's blocked by the lack of this API, I put a (not really tested) implementation here: https://github.com/MihaZupan/DnsRoundRobin
wfurt commentedon May 6, 2022
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.
karelz commentedon May 10, 2022
Triage: It might be useful together with other connection policies (Happy Eyeball).
There is a workaround, so not critical for 7.0.