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

dns/client: optimize udp timeout #916

Merged
merged 1 commit into from
Aug 29, 2023
Merged

dns/client: optimize udp timeout #916

merged 1 commit into from
Aug 29, 2023

Conversation

sreimers
Copy link
Member

@sreimers sreimers commented Aug 26, 2023

The default dns client udp timeout is quite high with ~71,5 seconds. This PR introduces a per-server limit (four tries) and reduces the first timeout so that fallback servers are tried earlier.

Old (one or more servers):

dnsc: trying udp server#0: 127.0.0.1:53 500ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 1000ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 4000ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 4000ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 4000ms timeout
... (14 more)
ETIMEDOUT 110 Connection timed out

New (three servers):

dnsc: trying udp server#0: 127.0.0.1:53 500ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 500ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 500ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 1000ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 1000ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 1000ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.2:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.3:53 2000ms timeout
ETIMEDOUT 110 Connection timed out

New (one server):

dnsc: trying udp server#0: 127.0.0.1:53 500ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 1000ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 2000ms timeout
dnsc: trying udp server#0: 127.0.0.1:53 2000ms timeout
ETIMEDOUT 110 Connection timed out

New overall timeouts:

  • One nameserver: 5,5 seconds
  • Two nameservers: 11 seconds
  • Three nameservers: 16,5 seconds
    ...

@sreimers sreimers marked this pull request as ready for review August 26, 2023 07:56
@sreimers sreimers merged commit 3af9f61 into main Aug 29, 2023
38 checks passed
@sreimers sreimers deleted the dns_client_timeout branch August 29, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant