I just changed my CSS image sprites to run from local to CloudFront and there’s now a noticeable lag, even across pages and page reloads. Any ideas as to why this might be happening?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Moving images from
localhostto a server (in this case CloudFront) will always incur a speed penalty (relative tolocalhost, certainly). This is because even with a great hosting service the browser has to send an http request via the internet to that server, to find out whether the document’s been modified since it was previously cached, or not (not modified: HTTP response304).Assuming that the document doesn’t need to be downloaded again/re-cached that should be the end of the image-requests for the CSS (particularly if you’re using css-sprites).
If the image-sprites have to be re-downloaded because the cache has expired, or the document’s changed, then obviously the browser has to download the file again, via the internet and network. And this incurs a cost due to contention on your own network/intranet, between your house and your neighbours between home and cabinet and then whatever speed your ISP provides to you.
Whereas
localhostis the same machine, and (likely) has a response measured in the milliseconds. In contrast, accessing Amazon’s CloudFront might only take a second or two, but that’s still an order of magnitude (or more) greater.