msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Support Async DNS Resolution

Open nibanks opened this issue 3 years ago • 4 comments

Describe the feature you'd like supported

Currently we call synchronous DNS resolution APIs (GetAddrInfo) on our QUIC worker threads. Most of the time this is quick and there isn't any noticed perf issue; but it is entirely possible for these APIs to take a long time.

Proposed solution

We should use async version where possible (GetAddrInfoEx). This will likely require changes at the PAL. I'm not sure what (if any) built-in APIs are available for Posix.

nibanks avatar Mar 01 '21 22:03 nibanks

getaddrinfo_a is the equivalent on linux. There does not look to be a macOS equivalent however.

ThadHouse avatar Mar 01 '21 22:03 ThadHouse

getaddrinfo_a is the equivalent on linux. There does not look to be a macOS equivalent however.

Unfortunately getaddrinfo_a just queues up a synchronous getaddrinfo in a thread pool. We chose not to use it in .NET because we have our own thread pool, but I'm not sure if MsQuic has similar concerns.

scalablecory avatar Apr 16 '21 16:04 scalablecory

I can't find any de-facto async cross-platform DNS library that we might use. I had the idea that we might instead support QUIC based DNS internally, but there are problems with that as well. First, the only deployed DNS over QUIC is actually DNS over HTTP/3, and we don't have an HTTP solution built-in. Second, There is a DNS over QUIC draft out there, but I don't know if it's deployed; also it's probably fairly complex. So, currently I don't have a good solution here. Going to mark this as blocked.

nibanks avatar Aug 21 '21 14:08 nibanks

Perhaps we simply dedicate a separate platform thread for this? We really shouldn't be blocking the normal QUIC or datapath threads on network IO like this. This PR is a good example of this: https://github.com/microsoft/msquic/pull/2376.

nibanks avatar Feb 16 '22 15:02 nibanks