Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How often does a browser need to perform a DNS lookup for the same site?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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).

share|improve this answer
    
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? –  GregH Aug 17 '10 at 7:03
    
Yes, normally the browser will perform a fresh lookup for every page refresh. As the records are cached, this isn't expensive. –  wolfgangsz Aug 17 '10 at 8:49
    
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. –  vmfarms Aug 17 '10 at 14:47
    
@Greg - wolfgangsz and vmfarms have got it right. Additionally if you're on Windows, try nslookup instead of dig. –  Mark Henderson Aug 17 '10 at 21:11
add comment

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.

share|improve this answer
    
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? –  GregH Aug 17 '10 at 7:08
    
what DNS servers your PC is using? btw try restarting "DNS Client" instead of flushing dns with ipconfig –  disserman Aug 18 '10 at 11:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.