Skip to content

Add dns resolver cache for net.Resolver #608

@snwiem

Description

@snwiem

Is your feature request related to a problem? Please describe.
I noticed a lot of DNS queries from the pulse application. I only have a single proxmox host running several docker hosts and lxc containers which are monitored by pulse.
My particular problem is not the perfomance on my local dns proxy, but more the traffic generated on the network and especially the data volume produced within my dns query logs (currently stored in a postgres database).

Here is an extract of the latest logs:

2025-10-25 08:39:24.375552+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:24.37555+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:24.240186+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:24.240175+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:24.206564+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:24.206478+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:21.190456+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:21.19044+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:21.162619+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:21.162544+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:20.950566+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:20.950447+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:20.915685+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:20.915626+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:20.538836+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	AAAA	srv-01.my-domain.de	my-domain.de		NOERROR	blocky
2025-10-25 08:39:20.538759+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky
2025-10-25 08:39:14.237248+00	10.10.0.109	10.10.0.109	0	CUSTOM DNS	CUSTOMDNS	A	srv-01.my-domain.de	my-domain.de	A (10.10.0.10)	NOERROR	blocky```

Currently there are more than 260.000 requests just from the pulse application within the time range of
`2025-10-23 19:46:02.718961+00 -- 2025-10-25 08:50:24.288341+00`

Usually for local Homelab setups the hostsnames of the monitored proxmox hosts do not change that often. The hosted instances of vms, lxc and docker containers will, but I think with a reasonable cache value the value of dns queries can be reduced quite a bit.

**Describe the solution you'd like**
I would think about adding an application internal dns cache like, https://github.com/rs/dnscache for example, ideally combined with a configurable cache timeout value.


**Describe alternatives you've considered**
-

**Additional context**
-

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions