I have heard for the first time that I can put a line with a domain name in the and the browser is then already searching for the IP address. As a consequence, there would be then no time needed for a DNS Lookup.
So, this would really make sense …
What I found out was that at least Firefox 3.5+, Chrome 5+ and the IE10 support this tag:
The IE9 supports this tag:
This means that I would need these 2 lines to have an earlier DNS Lookup of the ca. 40 % FF/Chrome users and the ca. 15 % IE9 users of our website … and maybe other browsers as well as I just read that Safari (15 % of our users) has this feature since the year 2010 (version 5.0.1) as well.
Would it make sense to use the dns-prefetch? Why is nearly nobody using it? According to the article ca. 0,5 % of the pages checked on Alexa.
If so, and I put 15 domains in it … this would mean ca. 2.000 letters if I put them in …
… and …
… which have ca. 50 letters each.
Would it have any negative effect for Google if I make the URLs on my website more similar by having the same lines in the head of all URLs?
Google says no, but I remember a while ago that this had an influence.
If you can you need to cut down the number of domains even if the browser prefetches the DNS for them all then you’re still going to have the delay of making the TCP connection and waiting for the TCP window to open wide enough (though some sites will start with a window wide enough for 15KB)
Add 15 prefetch directives will add 2KB (ish) to the page, it’s got lots of repeated patterns so should compress well with to gzip.
Perhaps a way to start is to prefetch the DNS for those domains that are needed for page-render to happen and monitor the change in performance, then test whether it’s worth adding any more.
Pat, so when I understand correctly, you think that most modern browsers already pre-resolve a domain xyz.com that is in the source code?
But a dns-prefetch of a domain that is e.g. in a JS file and that will load later might make sense?
I don’t provide any special hints on my site though I’m also not doing things like url-encoding small images, etc. I try to go for the best ROI on my time and some of those micro-optimizations aren’t worth the dev effort (maybe when nginx pagespeed is beta I might try having some of those automated).
Interesting. Those are some pretty painful lookup times when the browser didn’t prefetch (contending with the large downloads going on in parallel). Also looks like the browser didn’t do a good job with the prescanner - I stand corrected, nice work.
Which browser were you testing? Just wondering if I need to go ping the Chrome team to take a look
The real use case for [font=Courier]meta dns prefetch[/font] isn’t desktop browsers running on good networks. It is smartphone browsers running on poor 3G network connections. 3G can often have atrocious performance characteristics.
Putting a list of hostnames to prefetch at the top of [font=Courier]html head[/font] allows reallife gains in this case. Take for example the classical placement of script tags, which is just above the closing [font=Courier]/html[/font]. This last chunk of HTML might arrive up to 200-300 ms later than the chunk at the top of [font=Courier]head[/font].
Thus placing [font=Courier]meta dns prefetch[/font] would in this specific case allow the browser DNS prefetcher to start working sooner.