Mobile app version of vmapp.org
Login or Join
YK1175434

: Dns-prefetch: Best practice for many resources I made a list of all domains that resources on my site may use. How do I add the link-tags for dns-prefetch for best practice? 1) Can I simplify

@YK1175434

Posted in: #Optimization #RelDnsPrefetch

I made a list of all domains that resources on my site may use.

How do I add the link-tags for dns-prefetch for best practice?

1) Can I simplify life and output them all on every page?
How painful is it to prefetch domains that may not be needed on the user's visit (e.g. a youtube player on some sub page). My thought is that dns resolving is cached in the browser for ~90(?) minutes...

2) Should I prefetch only domains that are referenced in the html directly, or also those that are needed after an action like click on a play button (e.g.) googlevideo.com for when a youtube player is started).

3) How to handle CDN subdomains like s.ytimg.com? I guess it's not enough to prefetch ytimg.com (if not even useless when this domain is never used alone)?
All hope is lost for unguessable subdomains like a1339.phobos.apple.com I guess.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @YK1175434

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

The performance issue will be negligible after the first prefetch has been done for each domain. The purpose of the prefetch is to speed up later linking in the page if the user clicks on a link or accesses a static resource that is on another DNS address as the initial fetching of the DNS record has already been done and is already cached in the computers DNS cache.

There is no need to prefetch domains for very busy and fast services like YouTube etc as these are already exceptionally fast for DNS resolution as many ISP's have those addresses cached in their local DNS caches rather than needing to send the browser to the SOA DNS server first to get the address.

As for CDN subdomains you do need to prefetch the absolute DNS that will be used and not just the parent domain but this depends on the CDN you are using as well as to if you need to use prefetch or not.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme