Queries are routed the to closest DNS providing faster domain resolution.
I wanted to step in here and say that as much as I'd like to agree (it would make things way easier!), that is not how it works.
When you attempt to resolve a domain, your DNS resolver (by default, your ISP) will:
0. Check local cache and return result if present (hence, DNS takes time to propagate)
1. Query the root servers (e.g: a.root-servers.net), and the root servers will instruct the resolver to contact the TLD servers
2. Query the TLD servers (e.g: a.gtld-servers.net) and the TLD servers will instruct the resolver to contact the nameservers of the domain in question
3. Query the nameservers
When I first learned this process, I thought that the resolver would query the Nameservers in the order they were set, however it is done randomly (which, some would argue, is nice of them, given that they avoid hammering all DNS servers of the domain in question, and it sort-of acts as a load balancer by not always querying the first listed nameserver). I have 2
glue nameservers for a personal website, I host the 2 nameservers on a personal server and if I trace my DNS Requests, they're sometimes answered by the 1st NS and sometimes answered by the 2nd NS, even though
they are physically located in the same place.
There is a technology called
Anycast which "runs" on the network level (BGP) and despite multiple usages, it is commonly used for DNS, simply put, Anycast is essentially a server cluster ("ton of servers") that "share" the same IP address, but when you start a connection to a (name)server that runs on Anycast, the
geographically closest server will be the one to reply because BGP will route you to the closest one.
At Epik, our DNS runs on Anycast, if you run a ping test from multiple locations to
ns4.epik.com you will see that despite great physical distance between locations, the pings are relatively small from all of them:
The most notorious example here is
USA, New Jersey showing an RTT of
1.2ms and
Germany which is on another continent, showing an
RTT of 0.9.
If Anycast wasn't used and instead we offered 2 nameservers, one physically located in the USA and the other in the EU, visitors from EU would still be querying the USA server and likewise, which would result in higher response times.
Hope this sheds in some light!