-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify servers for dns.lookup(...)
#25560
Comments
Regular
Can't say I noticed this. Do you have an minimal benchmark? |
Okay, except this is global. All things that use the
Yup: https://github.com/szmarczak/cacheable-lookup/blob/master/benchmark.js dns#resolve4 x 27.03 ops/sec ±41.64% (246 runs sampled)
dns#lookup x 5,994 ops/sec ±0.26% (285 runs sampled) |
Yeah, Regarding your benchmark, you have to keep in mind that all And to answer your question on servers/TTL for |
Very well explained, I understand now :)
Thank you for your help :) |
@szmarczak you crossed out your question about setServers() and dns.lookup()? The answer is "no", for posterity. Its implied by https://nodejs.org/api/dns.html#dns_dns_lookup to someone who knows how the system resolvers work and are configured, but your question makes me think it should be stated more explicitly. https://nodejs.org/api/dns.html#dns_dns_setservers_servers use the word "resolution" in its text, but maybe that's not explicit enough, and a note to the effect that it does not effect dns.lookup() should be added. |
@silverwind has given the answer already:
Indeed. |
The performance of
Resolver.resolve4
/Resolver.resolve6
is very poor (~15 ops/sec).As I see it, it does the same as
dns.lookup
but you can select custom DNS servers as well as you can also get the TTL.The performance of
dns.lookup
is ~6000 ops/sec. Is it somehow possible to select the servers fordns.lookup
?The text was updated successfully, but these errors were encountered: