I'm trying to speed up my webpage load time in distant locations.
My server is located in Germany and I installed the second one in LA, CA.
Then I configured BIND to return LA IP for clients from Americas and German IP for clients from Europe and Asia.
Though it seems there is still room to reduce response time by some dozens of ms with DNS and name servers.
At the moment both name servers which serve my domain name are located in Germany which from my understanding causes delays for clients who has no dns cache for my domain. Am I right here?
- If I will move one of name servers to LA will in reduce DNS resolution time?
- How name server to query is chosen during name resolution?
- E.g. specified two NS: ns1.domain.com which is in DE and ns2.domain.com which is in US. which one will be queried? Will it help to specify IP instead of ns1.domain.com?
I agree with ceejayoz's comment: if international presence is a concern, you should use a DNS provider with an international presence. In practice that is the only cost effective solution for the concern you are addressing. That said, what you primarily get out of an international DNS presence isn't low response time but reliability, as your presence is less likely to be impacted by major routing problems between regions.
From my experience, in most cases people in your situation are chasing a red herring by trying to solve this problem. If you aren't, there is a problem with the DNS servers themselves, how well they're operated, or the network that they sit on.
For all of the reasons above, we strongly encourage people not to run their own authoritative DNS servers.
"It depends": For machines querying this nameserver, which are located in LA: yes. For machines querying this nameserver, which are located, for example, in Germany, it will increase resolution time.
If you want to check where the querying machines are located, and hand out the topologically nearest nameserver, you would have to introduce for example Anycast, which "is a network addressing and routing methodology in which datagrams from a single sender are routed to the topologically nearest node in a group of potential receivers, though it may be sent to several nodes, all identified by the same destination address."
AFAIK, it's random. You can't predict this in advance.
Sometimes you will get an answer from
ns1.domain.com
, sometimes fromns2.domain.com
. You can't predict or influence this.According to RFC 1035, the data of an
NS
record is "A domain-name which specifies a host which should be authoritative for the specified class and domain.". So you can't use an IP instead ofns1.domain.com
.Edit: Maybe the threads Practical Anycast and/or How can I send visitors to the closest server using DNS? are of help for you too.