3 ms·
I didn't mean it was directly implementing the networking call to the dns server -- just that it wasn't directly caching the result. getaddrinfo(3) and getname
by ComputerGuru 3y ago
I didn't mean it was directly implementing the networking call to the dns server -- just that it wasn't directly caching the result.
getaddrinfo(3) and getnameinfo(3) (guessing that's what you meant) don't implement caching, at least not explicitly in the spec and not normally in practice. On Windows, DNS results are cached by the OS but on Linux that would be distro-dependent behavior and usually requires setting up a local caching dns server (Ubuntu uses unbound out-of-the-box, iirc. Other choices include ncsd and dnsmasq).
Even if they implemented caching at the syscall level, this still assumes no connection stays open for more than 1s or is reused except per query. It seems like a big assumption (at least I hope it is, because I certainly wouldn't want my app to initialize a new db connection, let alone perform a DNS lookup, for every query).
- juggertao 3y agoThey mentioned they had a script which terminated all connections to the old database then changed the password. But on the app side you typically don't cache DNS, that creates other problems like stale DNS.