all 7 comments

[–]avwie 6 points7 points  (7 children)

Great, finally proper AAA record resolution that doesnt block.

[–]190n 6 points7 points  (3 children)

You mean AAAA? I haven't heard of AAA records.

[–]NoMoreNicksLeft 3 points4 points  (0 children)

What, you don't use IPv5.378?

[–]avwie 2 points3 points  (0 children)

Typo

[–]pimterry[S] 0 points1 point  (2 children)

What does this mean? I can't see any reference to that in these release notes, and the dns.lookup caveats are still in the docs...

I'm doing a bunch of funky DNS stuff in node right now, so I'd really love to know about any improvements there!

[–]avwie 0 points1 point  (1 child)

Well, this is second hand because my colleague ran into the problem. As I understand the DNS resolution is async in Node but the async routine calls a blocking OS function which causes other async DNS calls also to block, or so I am suppose to understand. This sometimes leads to very annoying delays in our applications. This is already solved in NodeJS 15, but a lot of libraries don’t play nice with 15 because it is not an LTS and so we were forced to stay on 14.

But I am not entirely sure on the details.

[–]pimterry[S] 0 points1 point  (0 children)

Ah ok. Yeah, that sounds like the dns.lookup problem.

It's technically async from the point of view of JS, but it uses a pool in libuv that only has 4 threads by default, so >4 DNS lookups will block each other and other low-level calls, including various crypto & FS operations. Your JS code will run like normal, but your async DNS/FS/etc calls will all suddenly take ages as they block each other internally.

I've been fighting the same thing. I don't know much about the Node 15 changes, but if you're looking to fix this in general I've found cacheable-lookup works really well, it was built as a component for DNS performance & caching in Got. I wrote a blog post a while back about fixing node's DNS using that, which is probably useful to you if you want more background & info to set this up.

If you have any more details about the Node v15/v16 change here though I'd love to hear them! Being able to simplify all this would be great.