There is no caching built in to the golang dns resolver. If you use a hostname in an address, it will look it up every time it needs to connect to it.
creamy-pencil-82913
06/26/2025, 5:53 PM
Use the ip instead, or use a local cache on your node (nscd, systemd-resolved, or the like).
q
quick-dentist-45681
06/26/2025, 6:33 PM
Still, doesn't that imply that the server creates a new connection 35000 times over 14 hours? That means every connection has a lifetime of between 1 and 2 seconds, which seems awfully wasteful?
c
creamy-pencil-82913
06/26/2025, 6:47 PM
it is up to the postgres sql driver to pool connections. but yes that does suggest it is opening and closing connections frequently.