Today I saw this snippet in the HTML source of a webpage:
<!-- prefetch dns -->
<link rel="dns-prefetch" href="//s3.amazonaws.com">
<link rel="dns-prefetch" href="//cdn.api.twitter.com">
<link rel="dns-prefetch" href="//graph.facebook.com">
<link rel="dns-prefetch" href="//connect.facebook.net">
<link rel="dns-prefetch" href="//api.pinterest.com">
<link rel="dns-prefetch" href="//google-analytics.com">
How much can you gain by doing this? I haven’t seen this before, nor in the Yahoo! Developer Networks guidelines for optimization. The only thing that seems related is “Reduce DNS Lookups”.
In a similar fashion, why doesn’t these services expose an IP address to their services and avoid the DNS look-up altogether?
I guess that this gives parallel DNS lookup of those links later used for a bunch of JavaScript’s.
Direct IP-numbers does not work well with CDN’s. They resolve to a host close to the caller. If you are in the US they give you the IP of a server in US. If you are in Europe they give you the IP of a server in Europe, etc. You can’t cheat like that with direct IP numbers.