-
Notifications
You must be signed in to change notification settings - Fork 472
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
DNSMasq cache has low cache hit rate for some reason #160
Comments
A few questions:
The way the client pod You could roll out CoreDNS (https://coredns.io) - see kubernetes/community#1100 for some details on numbers there (as a maintainer of that I am biased of course). We also have an |
|
Ok, if it were disabled you would see Using |
Even with negative caching it doubles the load - but they hit dnsmasq not kube-dns. This is what the auto path CoreDNS plugin is designed to fix - it figures out the path and returns a CNAME instead of NXDOMAIN from the first query. |
Also the caching of the external responses will help but only in the sense that the last of the 5 or so queries will hit that cache. For example, even if google.com that is only the 5th query in my cluster - all those other queries will go before it tries
|
I see, setting neg-ttl helped a bit (cache hit rate is about 0.35, 0.4 now). Is it better to always use the fqnd (service.ns.svc.cluster.local)? Are there any configs I can do to optimize dnsmasq? thanks @johnbelamaric |
doing some queries it seems that its not good to use fqdn
wtf... edit: this seems to be the better way:
|
An FQDN MUST end with a ".", e.g. Anything else may be subject to search path expansion (look at the manpage for /etc/resolv.conf and search for "ndots") |
Fyi, using only fqdns made my cache hit rate way bigger, I've also allocated more memory for dnsmasq pod and set cache size to 64k, I was able to go from 40 kube-dns pods to only 10 doing that (I think I could set it even lower). |
I just tried specifying |
I also observe this. My cache hit rate is ~20%, event though I always resolve the same rarely changing names. I actually had |
Hi, I'm running a k8s cluster in production with ~ 60 nodes, it has 870 pods on it.
Currently, 40 of these pods are kube-dns pods, each with 150m requests of CPU. (Yes, I had to scale it a lot)
I'm currently trying to figure out why I do need so much of them, one thing that I did today was to take a look at prometheus metrics exposed by the sidecar container and observed that:
The ratio between hits/total number of requests is too low (around 21%), any hints on why it is too low? seeing dnsmasq requests it seems that some of the addresses it is resolving are never being cached for some reason.
just for reference, this is the number of requests that kubedns is receiving per minute (I guess)
The text was updated successfully, but these errors were encountered: