[GODRIVER-2045] Cache DNS results Created: 11/Jun/21  Updated: 21/Dec/22  Resolved: 13/Oct/22

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Unknown
Reporter: Kevin Albertson Assignee: Qingyang Hu
Resolution: Done Votes: 3
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Quarter: FY23Q3
Case:

 Description   

Background
The Go driver by default uses the net.Dialer configured in connection_options.go. The behavior of net.Dialer’s DNS resolution is described here https://golang.org/pkg/net/#hdr-Name_Resolution.

By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions:

In the uncommon case that cgo is used, the system cache may be used. But otherwise the Go runtime explicitly does not cache DNS results. The proposal was rejected in https://github.com/golang/go/issues/24796.
 

 

Scope

Determine a caching policy add support for caching DNS results. Consider if this could negatively impact existing users if we change the default behavior (if so, consider making this opt-in).



 Comments   
Comment by Githook User [ 15/Oct/22 ]

Author:

{'name': 'Qingyang Hu', 'email': '103950869+qingyang-hu@users.noreply.github.com', 'username': 'qingyang-hu'}

Message: GODRIVER-2045 Fix broken build. (#1094)

GODRIVER-2045 Fix broken build.
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/25122e12942e5d1fa1dff4df03d8110515df3037

Comment by Qingyang Hu [ 13/Oct/22 ]

Proposed an example of a custom dialer with basic caching at https://github.com/mongodb/mongo-go-driver/blob/master/examples/example_customdns_test.go

Comment by Githook User [ 13/Oct/22 ]

Author:

{'name': 'Qingyang Hu', 'email': '103950869+qingyang-hu@users.noreply.github.com', 'username': 'qingyang-hu'}

Message: GODRIVER-2045 Propose an example of custom dialer with DNS cache. (#1088)

Propose an example of custom dialer with DNS cache.
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d30e7bc7e59f423986011e94017679dcdc5f0c49

Generated at Thu Feb 08 08:37:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.