BunnyCDN Blog

Performance tips, updates, tricks and insights into our Content Delivery Network.

Speed Up Your CDN With DNS Prefetch

Introduction

CDN Performance Tips & Tricks

Speed Up Your CDN With DNS Prefetch

Posted by Dejan Grofelnik Pelzel on .
Featured

Speed Up Your CDN With DNS Prefetch

Posted on .

There's a neat little trick that allows you to squeeze an extra few milliseconds by pre-fetching your CDN hostnames in the HTML head section using a simple HTML5 tag. What this does is it tells the browser to start resolving the hostname immediately after the HTML is loaded. This means that when a file residing on the hostname is first requested there is no need to wait for the DNS lookup as it is most likely already resolved and waiting in the cache.

This can reduce the load time of your time anywhere from a few up to a few hundred milliseconds.

Best of all, DNS prefetching is incredibly easy to implement and is supported by most modern browsers. Just add the following link tag to your head section and replace the hostname with your own for each of the hostnames that you would like to prefetch.

<link rel="dns-prefetch" href="//cdn.mysite.com">  

When you're looking to squeeze every little bit of performance possible, small things can really add up and this is just one of the tricks you can use to make your website load as fast as possible.

Dejan Grofelnik Pelzel

Dejan Grofelnik Pelzel

https://bunnycdn.com

The founder of BunnyCDN. An expert in networking, servers and development. Makes sure things are always running fast and smooth.

View Comments...

Categories