Prefetch DNS requests
If you have third-party content on your website (e.g fonts loaded from Google, or a video from YouTube), you may want to add its origin domain to the Prefetch DNS Requests option.
How to use DNS prefetching
Add the origin host, i.e. the domain on which the file is hosted, like so:
- Remove the
http
orhttps
- Keep the double slash
For example, if there is a request like this:
https://fonts.googleapis.com/css?family=Roboto:900%2C400%2C500%2C300%7CRaleway:700%2C300%7COpen+Sans:300%2C800
You would enter it as:
//fonts.googleapis.com
What does DNS Prefetching do?
When your site loads any content hosted on a domain besides yours, your visitor's browser has to retrieve the file(s) from that other domain. Part of that process is the browser connecting to the domain, which is called DNS resolution. DNS prefetching tells the browser to perform this connection before the file is needed, so that it's already complete by the time the file is requested.
This can give your loading time a minor boost, since DNS resolution will already have been processed when the external resources is requested.
Reduce DNS Lookups
When you use a lot of third party content on your site, you will see a recommendation from GT Metrix to Reduce DNS Lookups.
The Prefetch DNS Request option will not remove this recommendation. The only way to fix it is to actually remove the third-party content. There is no way to use third-party content without a DNS lookup for each domain. The Prefetch option doesn't remove the need for the lookup, it just processes it sooner.
Read this guide for more information on why too much third-party content is bad for performance.