use dnscache resolver for resolving command line endpoints (#14135)

this helps in caching the resolved values early on, avoids
causing further resolution for individual nodes when
object layer comes online.

this can speed up our startup time during, upgrades etc by
an order of magnitude.

additional changes in connectLoadInitFormats() and parallelize
all calls that might be potentially blocking.
This commit is contained in:
Harshavardhana
2022-01-20 13:03:15 -08:00
committed by GitHub
parent e1a0a1e73c
commit 7f214a0e46
8 changed files with 80 additions and 41 deletions

View File

@@ -102,15 +102,14 @@ func mustGetLocalIP6() (ipList set.StringSet) {
// getHostIP returns IP address of given host.
func getHostIP(host string) (ipList set.StringSet, err error) {
var ips []net.IP
if ips, err = net.LookupIP(host); err != nil {
addrs, err := globalDNSCache.LookupHost(GlobalContext, host)
if err != nil {
return ipList, err
}
ipList = set.NewStringSet()
for _, ip := range ips {
ipList.Add(ip.String())
for _, addr := range addrs {
ipList.Add(addr)
}
return ipList, err