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

[ManagedHandler] Add equivalent of ServicePoint.ConnectionLeaseTimeout #24665

Closed
geoffkizer opened this issue Jan 14, 2018 · 7 comments
Closed
Assignees
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation
Milestone

Comments

@geoffkizer
Copy link
Contributor

This is necessary to support DNS based routing with TTLs. See #18348 for more details.

@stephentoub
Copy link
Member

stephentoub commented Jan 14, 2018

This is necessary to support DNS based routing with TTLs

It seems like an alternative to that, rather than being a way to implement that?

@stephentoub
Copy link
Member

(hit wrong button :)

@geoffkizer
Copy link
Contributor Author

Yes, that's correct.

If we had proper TTL handling, we (probably) wouldn't need ConnectionLeaseTimeout.

Supporting ConnectionLeaseTimeout gives us a way to make DNS TTL-based routing work reasonably well, without actually retrieving and respecting the TTL.

@Tratcher
Copy link
Member

Related discussions: aspnet/HttpClientFactory#44

@Tratcher
Copy link
Member

@geoffkizer
Copy link
Contributor Author

@Tratcher What's the difference between the two? Seems like we probably don't need both, but which is preferable for DNS TTL scenarios?

@Tratcher
Copy link
Member

Tratcher commented Jan 25, 2018

It's an artifact of the ServicePoint impelementation, you won't necessarily need both settings, but you will need to cover the end-to-end scenario.

ServicePoint internally caches DNS resolves for the given DnsRefreshTimeout. It also re-uses connections for the given ConnectionLeaseTimeout. The two are implemented separately, it doesn't drop all active connections when it does a DNS refresh, nor refresh DNS for every new connection.

Things for ManagedHandler to address:

  • Periodically resolve DNS
    • Don't do it for every new connection, this causes overhead and is one more operation that could sporadically fail.
    • The resolve period should be related to the DNS TTL. Unfortunately that's not available with any of the .NET DNS APIs, nor is it clear how to get it from native the APIs. That's why ServicePoint used DnsRefreshTimeout.
    • Async DNS would be a bonus, now available on Win10.
    • Refreshing in the background rather than blocking all new connections would be nice too. It would also help limit concurrent DNS calls and smooth over sporadic failures.
    • Round robin DNS is another common request.
  • Don't keep connections open forever, you won't move to the new IPs/servers. Using the DNS TTL as the connection lifetime would be one approach, if it were available. ServicePoint used ConnectionLeaseTimeout for this.

Really people expect basic load ballancer functionality to be built in, rather than using a dedicated load ballancer intermediate.

@stephentoub stephentoub self-assigned this Feb 6, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation
Projects
None yet
Development

No branches or pull requests

4 participants