Using an IP still invokes DNS lookup due to callback being defined on datagram send
See original GitHub issueHello!
We recently integrated datadog ontop of our existing monitoring solution and discovered a lot of DNS lookups for our statsd agent IP. We were specifically passing an IP so we wouldn’t have to resolve a host name.
It seems to be the fact that for UDP we are using: https://nodejs.org/docs/latest-v12.x/api/dgram.html#dgram_socket_send_msg_offset_length_port_address_callback
Which is being utilised here: https://github.com/brightcove/hot-shots/blob/master/lib/transport.js#L46-L87 through this API: https://github.com/brightcove/hot-shots/blob/master/lib/statsd.js#L314-L373
Since we are always passing a callback the following kicks in:
An optional callback function may be specified to as a way of reporting DNS errors or for determining when it is safe to reuse the buf object. DNS lookups delay the time to send for at least one tick of the Node.js event loop.
which seems to cause a DNS lookup: https://github.com/nodejs/node/issues/35130
By that post, there should be a quick path for DNS Lookup for IPs but I couldn’t find it. We’re seeing A LOT of requests for resolving DNS for an IP. Any recommendations on how/if we should cut these down?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:10 (1 by maintainers)
Top GitHub Comments
Referencing https://github.com/DataDog/dd-trace-js/pull/1187
Since https://github.com/brightcove/hot-shots/commit/a399dda99fb1bf2b15e53646b3ef5d8cbb0b90c9 landed in
v9.2.0
you can do: