Node.js · Senior · Question 14 of 75
Why can dns.lookup be a hidden bottleneck for outgoing HTTP calls?
- ✓Correct answer: It uses the OS resolver through the thread pool, so many lookups can occupy the pool and slow down
fsandcryptotoo - 2It always queries a remote DNS server over TCP
- 3It's synchronous and blocks the event loop
Explanation
Options include connection reuse (keep-alive), caching DNS results, or dns.resolve*, which uses c-ares on the network instead of the pool (but ignores /etc/hosts).