Skip to content

Blocking DNS resolution on the poller critical path #107

Description

@somethingwithproof

Is your feature request related to a problem? Please describe.

gethostbyname() is synchronous and has no timeout. It is called once per distinct hostname per poller cycle, on the poller's critical path.

One unresponsive resolver stalls the whole cycle. This is an availability problem rather than a missing feature, and it is the kind that only becomes visible during an incident, when DNS is often the thing already failing.

The single-pass loader reduced the call count sharply, from once per hostname per subnet to once per hostname per cycle. It did not take the calls off the critical path.

Describe the solution you'd like

Stop resolving during the poll where possible.

Cacti already stores each Device's address in host.hostname, and for Devices configured by address no lookup is needed at all. For Devices configured by name, cache the resolution in a table with a timestamp and treat DNS as a refresh path rather than a blocking dependency. A stale entry is better than a stalled poller, and the map is already a snapshot from the last cycle.

Describe alternatives you've considered

A short timeout around the lookup. PHP offers no timeout on gethostbyname(), so this means dropping to dns_get_record() or a socket with its own timeout, which is more code for a worse cache story.

Resolving in parallel. Real gains, but it needs an async DNS extension the plugin cannot assume.

Additional context

plugin_flowview already ships a manageable DNS cache and documents it as a feature, so there is precedent in the org for the approach.

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions