-
Node http uses dns.lookup behind the scenes
-
dns.lookup = uses OS facilities i.e. should be same as ping/wget etc
-
dns.resolve = gets from network, ignores OS config
-
both have options to force IPv4
-
dns.lookup seems to cache (presumably OS cache) i.e. first lookup on app startup slow, after that fast
-
localhost: resolves and lookups all quick. lookup() slightly slower than lookup(...4) (until cache hits)
-
heroku: dns.resolve() a lot quicker than dns.lookup(). markets: lookup slower than lookup(v4), portfolio: lookup and lookup(v4) equally slow.
UPDATE - The reason portfolio lookup(v4) was still slow is because lookup
is constrained by a fixed threadpool size. Setting that UV_THREADPOOL_SIZE environment variable to a higher value got the test results back to expected. https://nodejs.org/api/dns.html#dns_implementation_considerations
- Not all urls work with an IP address e.g. amazon s3 redirects, heroku says no such app found.
URLS
https://github.com/yahoo/dnscache
https://floating-falls-5368.herokuapp.com/test
https://nodejs.org/api/dns.html#dns_implementation_considerations