How often does a browser need to perform a DNS lookup for the same site?
-
browser may perform DNS lookups on every request but all they are cached, on windows - with DNS Client service, on Mac - with mDNSResponder daemon. Anyway even if you don't have any local DNS cache, the DNS server you use will cache a record. The record is being resolved again from the website domain's DNS servers as soon as it's TTL expires.
GregH : thanks disserman - one thing that doesn't make sense to me however is, when I monitor for outgoing DNS calls using wireshark, if I actually issue a "ipconfig /flushdns" and then refresh the page, I do not see a new DNS request being issued from the PC. Doesn't that imply that the browser must not issue a DNS request each time then?disserman : what DNS servers your PC is using? btw try restarting "DNS Client" instead of flushing dns with ipconfigFrom disserman -
DNS is (meant to be) cached until the TTL (Time to Live) on the DNS record expires. The TTL starts counting down from when the DNS record is retrieved.
So, if you have a TTL of 5 minutes, then if it's been more than 5 minutes since the DNS record has been retrieved, then it will be re-retrieved.
However - this is only how well behaved DNS services work. There are some not-so-well behaved DNS services that will cache a record for a lot longer than the TTL, which has caused a lot of problems for webmasters in the past (there's lots of questions on this site about it).
GregH : thanks Farseeker - however are you implying that the browser (e.g. firefox say) will do this caching itself? So if I have a site in firefox and keep hitting refresh, is firefox actually issuing a DNS call each time, which may be then picked up at the windows level by the local Windows DNS cache which then does the cache check?wolfgangsz : Yes, normally the browser will perform a fresh lookup for every page refresh. As the records are cached, this isn't expensive.vmfarms : Further to that, if you have the command `dig` available, you can run it on the domain in question and watch the TTL go down.Farseeker : @Greg - wolfgangsz and vmfarms have got it right. Additionally if you're on Windows, try `nslookup` instead of `dig`.From Farseeker
0 comments:
Post a Comment