Why is DNS resolution via UDP faster than TCP on Mac?

My understanding is that DNS queries via UDP (the default) should be faster, but I am seeing the opposite on two Macs I own, and other 3 people I have asked who are also on Mac, see exactly the same thing. It’s weird, but queries over UDP are 3-5 times slower than queries over TCP. I cannot reproduce this on my Linux servers for example. On my Macs I switched to DNS over TLS which is much faster than the default UDP querying for me, but I am still curious. Can readers with Macs try as well? To test, I run the command `dig @1.1.1.1 somedomain.com` to test with UDP (with Cloudflare’s public DNS in this case, and any domain you want), and the same command but with the additional argument`+tcp` to query over TCP. Try each command a few times. Which one is faster for you? UDP or TCP? Trying to understand if it’s a Mac issue. Thanks in advance!
Story Published at: January 19, 2023 at 11:20AM