Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
dnsdist packet cache is not working if all ECS enabled backend servers are down #6098
I wanted to try the setStaleCacheEntriesTTL parameter and found a problem with the packet cache in dnsdist for ECS enabled backend servers. Also for valid and non stale entries, the caching behaves not as expected and is not working if all backend servers are down.
Steps to reproduce
dnsdist should respond from the packet cache if all backend servers (with "useClientSubnet=true" set) are down. Also the setStaleCacheEntriesTTL should work for that.
If all backend servers (with "useClientSubnet=true" set) are down, dnsdist can't respond directly from the packet cache. It leads to a high rate of cache misses. If "useClientSubnet" is set to "false", it is working.
If all backend servers are down, dnsdist should respond from the packet cache as an emergency mechanism. --> Better to answer with stale entries than not to answer and the service behind is down.
When using "useClientSubnet=true" for backend servers, the dnsdist packet cache is working. As far as I know by hashing the whole query including the ECS. But if all backend servers are down, dnsdist can't respond from the cache. I assume it's because the ECS is not honored for the query hashing anymore. I can see 100% cache misses in this scenario.
Are you sending the queries in 2/ and 3/ from the exact same host? I'm asking because when
Yes, I'm sending the queries from the exact same host with the same source IP. Btw, if I already add the ECS in the query it is working. Just if dnsdist has to add it for the backend servers it is not working. I assume it's because the useClientSubnet parameter belongs to the "newServer" configuration and if there is no backend server available, the cache lookup is done without adding the ECS information.
Ah, you are right, we only add the