msquic
msquic copied to clipboard
Support Async DNS Resolution
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.
getaddrinfo_a
is the equivalent on linux. There does not look to be a macOS equivalent however.
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.
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.
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.