: DNS lookup when using a CDN Using a CDN can vastly improve the load time of a website. I been thinking of using it to host all my external files like CSS, JS, Images, Videos etc. However
Using a CDN can vastly improve the load time of a website. I been thinking of using it to host all my external files like CSS, JS, Images, Videos etc. However I was thinking when linking to a CDN, wouldn't the browser have to use additional DNS lookup? So wouldn't this be counter productive? Or is the benefit to host every external files on a CDN out weighs the additional cost of a DNS lookup?
What are your thoughts?
More posts by @Sims2060225
3 Comments
Sorted by latest first Latest Oldest Best
Actually the DNS lookup will be only ONE!
Once the OS looked up the domain DNS it will store the IP of the domain in its internal DNS table, and call directly the IP for all subsequent requests.
On Windows you can view the DNS table running the command: ipconfig /displaydns
Basically if in your site thare are 100 images + js + css and they are all on a CDN at some-cdn-domain.com, the browser will do only 1 DNS lookup, and not 100.
Therefor 1 DNS lookup will always be a no issue in term of speed. It could be if on the CDN you had only one file, but I struggle to see how a website can have only one static file nowadays.
Yes, a DNS lookup will have to take place, however, as with most things these days; they have the possibility of being cached either by the OS, or by the browser itself.
You'll find that servers used for DNS resolution are normally much closer both topologically and geographically to the user than your server; meaning a smaller round-trip time than normal (DNS servers are normally located within the network of a user's ISP). A DNS lookup is also much smaller than the downloading of a web resource.
With this in mind, it'd be unlikely for such a small hit to outweigh such a potentially large gain (the fast download of all your assets). All in all, you should find that using a CDN will give you an advantage.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.