add DNS cache support to avoid DNS flooding (#10693)

Go stdlib resolver doesn't support caching DNS
resolutions, since we compile with CGO disabled
we are more probe to DNS flooding for all network
calls to resolve for DNS from the DNS server.

Under various containerized environments such as
VMWare this becomes a problem because there are
no DNS caches available and we may end up overloading
the kube-dns resolver under concurrent I/O.

To circumvent this issue implement a DNSCache resolver
which resolves DNS and caches them for around 10secs
with every 3sec invalidation attempted.
This commit is contained in:
Harshavardhana
2020-10-16 14:49:05 -07:00
committed by GitHub
parent 73a41a725a
commit bd2131ba34
7 changed files with 422 additions and 3 deletions

View File

@@ -274,6 +274,8 @@ var (
globalFSOSync bool
globalProxyEndpoints []ProxyEndpoint
globalDNSCache *xhttp.DNSCache
// Add new variable global values here.
)