CDN Take 2: Amazon CloudfrontPosted on March 26th, 2011 4 comments
Back on March 11 I ended the Content Distribution Network experiment with Cloudflare. However, the reason I entered into that experiment still existed – performance of the website, and fear of having my Hostgator shared hosting account suspended for overuse (“abuse” is what they call it; but they don’t provide a way of predicting when we’re getting close to that “abuse” level.) Today Twitter friend Steve Creek had his Hostgator shared hosting account suspended for this very reason – caused by the site’s popularity. Twitter friend Adam Jack had previously mentioned that he was looking at Amazon’s Cloudfront service, so I had taken a look at it and it seemed usable. I made some changes today.
Today I moved most of the thumbnails for USWildflowers.com over to Cloudfront. It was more complicated than I had hoped since I’m not up to speed technically to create the configuration using XML API calls, and it will be a bit of a pain to maintain until Amazon changes the administrative console to support external website sources, and it will cost some money (hopefully not much, USWildflowers.com is barely breaking even.) However, Amazon’s web service will hopefully be reliable and improve performance.
The reason I chose the thumbnails is that I made an assumption that it wouldn’t be a bandwidth issue that would get my account suspended but rather a cpu utilization issue. The “hit/file lookup/response” overhead is close to the same regardless of file size, so the smaller thumbnails should reduce CPU utilization almost as much an equivalent number of full size images, and since Amazon charges by the gigabyte transferred for Cloudfront, distributing the thumbnails rather than the full size images will hopefully be less expensive.
One thing that I had done several days ago that will also hopefully help some was to set cache control metadata tags on the images served up from USWildflowers.com so that browsers and network caching mechanisms will cache those images for up to four hours.
Incidentally, Google Webmasters statistics indicate that performance has improved recently over what it had been while on Cloudflare, so maybe the cache control metadata changes were having their intended effect.
Update 04/01/2011: Amazon Cloudfront handled almost 100,000 http requests for me in the 5+ days since moving the thumbnails over there, for a total of almost 2 gigabytes. The Hostgator stats show the significant drop in hits as well. During the period from when I left Cloudflare to moving onto Cloudfront, Hostgator stats showed an average of about 20 hits per page view. Since moving onto Cloudfront, the average is about 9 hits per page. While these hits are not the high-cpu ones in WordPress or the code hitting the database, eliminating the overhead of 10+ http requests per page has got to help; hopefully enough to avoid the dreaded “abuse” suspension.
Note that the average hits per page were even lower on Cloudflare than on Cloudfront (by about 1 hit per page.) Presumably this is because Cloudflare was caching all the images, not just the thumbnails. My feel is that the performance is better on Cloudfront than on Cloudflare, but I also feel more confident that with Amazon’s resources (and the simplified model; not a true “cache”, but rather a web server for static content) the results will be more reliable than with the *free*, beta Cloudflare product.
Speaking of economics – Cloudflare was free; Amazon’s handling of those 100,000 request cost me 44 cents. Amazon allow entry to the paid service at a low price point, based on utilization. Cloudfront provides a paid service as well, but the lowest cost is $20 per month, which was well beyond the reach of USWildflowers.com’s budget. Cloudflare also provides some other services beyond the caching (primarily security functions) but those were not within the target objectives for this effort.
How is this experiment going?
Sorry you had to upload manually. I think CloudFront works best for folks who already have their data in Amazon S3 ‘cos then it is just add the work cloud front into the URL and you are done. Sorry, guess I figured that out a bit late. :\
BTW: This is a neat new tool from Google:
it concurs that your browse cache settings are mainly working. The rest of the things it mentions are likely not worth much time, but at least it does let you know your looking good to Google.
Question: Do you use Google Webmasters tools? That has a neat “speed chart” in it that will even give you some history.
Last bit of geekery. Do you have a sitemap registered w/ Google/Bing? If you do, you might save some bandwidth by telling it that things (e.g. older postings) don’t change a lot, so don’t scan too often.
Just some random idea. Good luck.
Interesting post. I’ve been playing around with CloudFront versus CloudFlare myself, but my experiment turned out quite differently:
Basically, CloudFront only changed my page speed a tiny inkling, whereas CloudFlare made a huge difference. And since I was paying upward of $10/month for CloudFront, it’s obvious which service I give thumbs up.
Anyway, how have you been doing since you wrote this?
Leave a reply