http-networkingAnswer last reviewed July 2026

How does Node actually turn a hostname into an IP, and why might DNS be quietly capping your outbound throughput?

The strong answer keeps dns.lookup, getaddrinfo on the thread pool, apart from dns.resolve, c-ares over the network, and knows Node caches nothing by default.

What an AI-prepared candidate might say

Node does hostname resolution through the dns module. The common path is dns.lookup, that's what runs under the hood when you make an HTTP request to a hostname, it turns the name into an IP address. There's also dns.resolve, plus dns.resolve4 and dns.resolve6, which query DNS servers directly. The difference as I understand it is that dns.lookup uses the operating system's resolver, so it respects /etc/hosts and system configuration, while dns.resolve talks to DNS servers over the network instead. Node doesn't cache DNS results by default, so every new connection can trigger a fresh lookup, and under high outbound volume that adds latency and load. To cut that down you can add a DNS cache, either in the application or by running a local caching resolver. Which method you pick kind of depends on whether you want system behavior or raw DNS records.

Senior
Locked

The two resolution paths, getaddrinfo on the thread pool against c-ares over the network, and why the one every http request takes can starve fs and crypto.

Unlock the depth
Staff
Locked

How an uncached, thread-pool-bound lookup turns into latency your downstream gets blamed for, and where caching belongs if you don't want to break failover.

Unlock the depth
Follow-up chain
How does Node actually turn a hostname into an IP, and why might DNS be quietly capping your outbound throughput? | NodeBook