@@ -620,15 +620,16 @@ but note that changing these files will change the behavior of _all other
620620programs running on the same operating system_ .
621621
622622Though the call to ` dns.lookup() ` will be asynchronous from JavaScript's
623- perspective, it is implemented as a synchronous call to getaddrinfo(3) that
624- runs on libuv's threadpool. Because libuv's threadpool has a fixed size, it
625- means that if for whatever reason the call to getaddrinfo(3) takes a long
626- time, other operations that could run on libuv's threadpool (such as filesystem
627- operations) will experience degraded performance. In order to mitigate this
628- issue, one potential solution is to increase the size of libuv's threadpool by
629- setting the ` 'UV_THREADPOOL_SIZE' ` environment variable to a value greater than
630- ` 4 ` (its current default value). For more information on libuv's threadpool, see
631- [ the official libuv documentation] [ ] .
623+ perspective, it is implemented as a synchronous call to getaddrinfo(3) that runs
624+ on libuv's threadpool. This can have surprising negative performance
625+ implications for some applications, see the [ ` UV_THREADPOOL_SIZE ` ] [ ]
626+ documentation for more information.
627+
628+ Note that various networking APIs will call ` dns.lookup() ` internally to resolve
629+ host names. If that is an issue, consider resolving the hostname to and address
630+ using ` dns.resolve() ` and using the address instead of a host name. Also, some
631+ networking APIs (such as [ ` socket.connect() ` ] [ ] and [ ` dgram.createSocket() ` ] [ ] )
632+ allow the default resolver, ` dns.lookup() ` , to be replaced.
632633
633634### ` dns.resolve() ` , ` dns.resolve*() ` and ` dns.reverse() `
634635
@@ -644,6 +645,8 @@ They do not use the same set of configuration files than what [`dns.lookup()`][]
644645uses. For instance, _ they do not use the configuration from ` /etc/hosts ` _ .
645646
646647[ `Error` ] : errors.html#errors_class_error
648+ [ `UV_THREADPOOL_SIZE` ] : cli.html#cli_uv_threadpool_size_size
649+ [ `dgram.createSocket()` ] : dgram.html#dgram_dgram_createsocket_options_callback
647650[ `dns.getServers()` ] : #dns_dns_getservers
648651[ `dns.lookup()` ] : #dns_dns_lookup_hostname_options_callback
649652[ `dns.resolve()` ] : #dns_dns_resolve_hostname_rrtype_callback
@@ -660,6 +663,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
660663[ `dns.resolveTxt()` ] : #dns_dns_resolvetxt_hostname_callback
661664[ `dns.reverse()` ] : #dns_dns_reverse_ip_callback
662665[ `dns.setServers()` ] : #dns_dns_setservers_servers
666+ [ `socket.connect()` ] : net.html#net_socket_connect_options_connectlistener
663667[ `util.promisify()` ] : util.html#util_util_promisify_original
664668[ DNS error codes ] : #dns_error_codes
665669[ Implementation considerations section ] : #dns_implementation_considerations
0 commit comments