Tuesday, April 6, 2021

Performance boost using DNS Prefetching

Despite anchor tags having HREF attributes which lead to other host names, browsers do not execute DNS lookups on those domains. Content prefetching can be invaluable in speeding up your websites, but did you know that you can also implement DNS prefetching? It's as easy as simple LINK element:   Of many things one of the step in boosting website performance in a way by improving user experience is using DNS Prefetching. For an example if you have some or many links pointing to other domains HREF attribute doesn't help browsers in executing DNS lookups on those domains. By using Content Prefetching helps speeding up your website but by DNS Prefetching browsers executes DNS lookups on those domains. Its very simple as adding a LINK tag, look at the below code
<link rel="dns-prefetch" href="//somehost.tld" />
This is useful when your website links to related host names. Twitter for example uses two DNS Prefetches
<link rel="dns-prefetch" href="https://si0.twimg.com" />
<link rel="dns-prefetch" href="https://api.twitter.com" />
Its up to you to decide will it help in your case. You can refer more details at http://www.chromium.org/developers/design-documents/dns-prefetching

No comments:

Post a Comment