Reputation: 32978
Is DNS lookup time slowed down by the use of subdomains and CNAME? As I understand it, if a client wants to lookup for example rweb.stat.ucla.edu
at least four steps are needed:
[registrar] NS ucla.edu ==> ns2.dns.ucla.edu
[ns2.dns.ucla.edu] NS stat.ucla.edu ==> dns.stat.ucla.edu
[dns.stat.ucla.edu] CNAME rweb.stat.ucla.edu ==> id-86-243.stat.ucla.edu
[dns.stat.ucla.edu] A id-86-243.stat.ucla.edu ==> 128.97.86.243
Does this mean the client has to connect to each of these servers when visiting the page? Or do the DNS servers connect to each other and directly resolve (and cache) rweb.stat.ucla.edu ==> 128.97.86.243
? Also it is not clear to me how much work is involved in finding the initial record for the root domain?
Upvotes: 2
Views: 1660
Reputation: 22261
First of all, the registrar is never involved in the actual DNS lookup. Registrars (and indeed, registries) are administrative entities outside the scope of the DNS protocol. The actual lookup process looks more like this:
A
of rweb.stat.ucla.edu.
.
edu.
.edu.
servers for A
of rweb.stat.ucla.edu.
.
ucla.edu.
ucla.edu
servers for A
of rweb.stat.ucla.edu.
.
stat.ucla.edu
could be a zone that is delegated to yet another set of nameservers, in which case you'll get a referral answer for the third time.rweb.stat.ucla.edu.
has CNAME
id-86-243.stat.ucla.edu
.Now you have to start all over again and look up id-86-243.stat.ucla.edu
...
...except that because the target of the CNAME
is inside the same zone as the original record (or, in general, inside any zone that happens to be served from the same nameserver), the nameserver will helpfully give you the A
record for id-86-243.stat.ucla.edu
in the additional section of the DNS response. The resolver will notice this and won't have to run after the A
record itself.
Because resolvers cache answers, many queries can be answered from the cache and don't actually have to be asked every time. Especially the first few steps of the query are all likely to be already cached by the resolver, except immediately after it starts up with a cold cache. So the resolver can probably usually start at step 3 (because it remembers what the nameservers for ucla.edu.
are from its cache) or at least at step 2 (because it remembers what the nameservers for edu.
are) if it doesn't already know the final answer.
So the short answer to your question is yes, using CNAME
makes more work for the resolver and makes the resolution process take longer. But in practice it doesn't matter very much because the resolver's cache is so helpful. And if the CNAME
's target is in the same zone as the CNAME
record itself, it matters even less because of the helpful additional record.
Upvotes: 6