[GH-ISSUE #2225] Default dns timeout of 5 seconds is excessive (causes 40s of time being wasted in mongodb) #929

Open
opened 2026-03-16 01:00:11 +03:00 by kerem · 5 comments
Owner

Originally created by @Jasper-Bekkers on GitHub (May 29, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2225

In depth analysis downstream: https://github.com/mongodb/mongo-rust-driver/issues/1112

Changing the timeout value to 100ms in ResolverOpts speeds things up significantly (to acceptable levels).

The biggest question is where do we make the change (either reduce the default in this crate) or figure out a better way to drive this crate from mongodb. It does however appear that (at least on windows) ResolverOpts is set with this same default value in read_system_conf with no real way of modifying this value later.

Originally created by @Jasper-Bekkers on GitHub (May 29, 2024). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2225 In depth analysis downstream: https://github.com/mongodb/mongo-rust-driver/issues/1112 Changing the timeout value to 100ms in `ResolverOpts` speeds things up significantly (to acceptable levels). The biggest question is where do we make the change (either reduce the default in this crate) or figure out a better way to drive this crate from mongodb. It does however appear that (at least on windows) `ResolverOpts` is set with this same default value in `read_system_conf` with no real way of modifying this value later.
Author
Owner

@djc commented on GitHub (May 30, 2024):

Agree that 5 seconds is probably excessive. Where does the 8x multiplier come from, is that inside Hickory?

I think it would make sense to change the default but would also like to make ResolverOpts easier to change after construction (see also https://github.com/hickory-dns/hickory-dns/issues/2188#issuecomment-2069314665).

Are you able to submit a PR?

<!-- gh-comment-id:2138877318 --> @djc commented on GitHub (May 30, 2024): Agree that 5 seconds is probably excessive. Where does the 8x multiplier come from, is that inside Hickory? I think it would make sense to change the default but would also like to make `ResolverOpts` easier to change after construction (see also https://github.com/hickory-dns/hickory-dns/issues/2188#issuecomment-2069314665). Are you able to submit a PR?
Author
Owner

@Jasper-Bekkers commented on GitHub (May 30, 2024):

Agree that 5 seconds is probably excessive. Where does the 8x multiplier come from, is that inside Hickory?

I think the 8x multiplier is from mongo directly where it may try 8 servers in a pool or something.

Are you able to submit a PR?

I tried looking into this, but it feels like this is closer related to some moving parts then I'd feel comfortable changing. If its just lowering the default I can do that, but exposing the timeout more widely looks like it requires some thinking specifically when it comes to the system level defaults.

<!-- gh-comment-id:2139370270 --> @Jasper-Bekkers commented on GitHub (May 30, 2024): > Agree that 5 seconds is probably excessive. Where does the 8x multiplier come from, is that inside Hickory? I think the 8x multiplier is from mongo directly where it may try 8 servers in a pool or something. > Are you able to submit a PR? I tried looking into this, but it feels like this is closer related to some moving parts then I'd feel comfortable changing. If its just lowering the default I can do that, but exposing the timeout more widely looks like it requires some thinking specifically when it comes to the system level defaults.
Author
Owner

@djc commented on GitHub (May 30, 2024):

Okay, can you just do a PR for changing the default?

<!-- gh-comment-id:2139421946 --> @djc commented on GitHub (May 30, 2024): Okay, can you just do a PR for changing the default?
Author
Owner

@bluejekyll commented on GitHub (May 30, 2024):

Can we instead make the PR focused on making the timeout easier to set? I don't think we can assume resolvers always operating inside a single datacenter, and need to assume that real-world latencies, like trans-atlantic or trans-pacific round-trips of >500ms are normal.

<!-- gh-comment-id:2140614094 --> @bluejekyll commented on GitHub (May 30, 2024): Can we instead make the PR focused on making the timeout easier to set? I don't think we can assume resolvers always operating inside a single datacenter, and need to assume that real-world latencies, like trans-atlantic or trans-pacific round-trips of >500ms are normal.
Author
Owner

@Jasper-Bekkers commented on GitHub (May 30, 2024):

Can we instead make the PR focused on making the timeout easier to set? I don't think we can assume resolvers always operating inside a single datacenter, and need to assume that real-world latencies, like trans-atlantic or trans-pacific round-trips of >500ms are normal.

Yeah that's why I also was hesitant.

Apparently this was a Known Issue for mongodb with this crate, specifically on Windows. So maybe it's just a regular bug? https://crates.io/crates/mongodb#windows-dns-note

<!-- gh-comment-id:2140736957 --> @Jasper-Bekkers commented on GitHub (May 30, 2024): > Can we instead make the PR focused on making the timeout easier to set? I don't think we can assume resolvers always operating inside a single datacenter, and need to assume that real-world latencies, like trans-atlantic or trans-pacific round-trips of >500ms are normal. Yeah that's why I also was hesitant. Apparently this was a Known Issue for mongodb with this crate, specifically on Windows. So maybe it's just a regular bug? https://crates.io/crates/mongodb#windows-dns-note
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#929
No description provided.