Reputation: 294
We are working to switch our web infrastructure to use a single sub-domain for static resources as per Yahoo's web standards advice. This is theoretically supposed to improve performance because it will allow browsers to make requests asynchronously to grab the static resources that are needed. We are using Cloudflare as a CDN and I'm a little bit worried that the additional latency that will be added with DNS pointing to Cloudflare's any casted IP range (while only 15ms) may defeat any performance benefits that would be gained by switching to a static sub-domain.
Upvotes: 2
Views: 778
Reputation: 17508
The additional latency is negligent. The browser/client will only parse the new static subdomain once. Overall, it really pays off because of several reasons:
Regarding your last paragraph, I think there is some confusion... static files are not meant to be fetched from inside your web server. Your code should access local files (this is not always the case as some files can be stored in a NAS or so). Static files in static subdomains / CDNs are fetched from your users' browsers, not from your web server. Your web server creates the pages themselves (probably dynamic ones, such as PHP, ASP.NET files etc.) which render HTML to the client. That HTML references other static resources: JS, CSS, Images etc. - these are resources that should ideally reside in some sort of a CDN.
Upvotes: 1