So you’re using S3 to serve your assets, eh? You should rethink that.

129049522079385796

One of the first optimizations I did when FriendCameo first started taking off was moving our static assets into S3. That took a huge load off our application servers at the time and really helped us scale. It was a no-brainer – there were even Rails plugins that made uploading into S3 a piece of cake. But as the months went by we realized it wasn’t the optimum solution.

S3 (Bandwidth) is Expensive

If we’re talking about storing tons of data, S3 is really awesome. It’s pay-as-you go with crazy high redundancy at a good price. However, as soon as you start using up bandwidth, the costs start to add up. For FriendCameo, we were using about 750GB of bandwidth per month, with 20MM GET requests, which totaled about $130 a month. For a bootstrapped startup, that’s not exactly chump change. It became a sizable portion of our hosting bill.

S3 Requests come from a central location

As our site grew, we started to see a good amount of international users, especially coming from the United Kingdom. Being that our S3 files were in he US Standard region, they’d be served from Northern Virginia or the Pacific Northwest. So if you weren’t near those two locations… good luck! Since FriendCameo relies on the download of a SWF file, it was imperative that the download happens as timely as possible, and our UK users weren’t getting a good experience.

Yeah, so? That’s what CloudFront is for.

Right! CloudFront is an awesome way to distribute your content to your users globally. But it would increase our AWS hosting bill, which was already too high for our tastes. We had to find a better solution.

MaxCDN: The no-brainer solution for delivering your static assets

I discovered MaxCDN while poking around other sites to see what they used to deliver their content. At first it seemed too good to be true and after using them for about three months, I can indeed vouch for it’s awesomeness.

Pricing

It’s cheap. For $100 you get 1000GB of bandwidth that you can use up whenever you wish. So it’s pretty much pay-as-you-go. Also, if you wait around a bit, every few weeks they come out with sales that reduces the prices by 20% or more.

Global Delivery

MaxCDN has 10 edge locations, 9 in the US and one in Europe, along with peering to many other locations. It doesn’t have the coverage of CloudFront, but enough coverage for what we wanted to accomplish.

Setup

Setting it up is super easy. It’s a matter of telling MaxCDN where to pull the assets from (my S3 bucket in this case), and then adding a CNAME entry in your DNS. Simple as pie.

Conclusion

With MaxCDN we’ve significantly reduced our hosting costs, while also being able to globally distribute our asset files to better serve our UK and US users. Being in a startup, there’s many times where we have to weigh different options to try to find the best solution. But this is one of the few decisions that’s really a no-brainer and I recommend anyone who pays for S3 to give them a look.

About Anthony

I’m a software engineer based in the San Francisco Bay Area. I love the technology behind building products that people love. I co-founded FriendCameo, group video chat with over 3 million users. I’m currently working on building other projects that help people day-to-day.

Subscribe

You should subscribe to receive updates.

, , ,

12 Responses to So you’re using S3 to serve your assets, eh? You should rethink that.

  1. Huh August 23, 2011 at 3:16 pm #

    Why would CloudFront double your bill? It’s $0.12/gb just like S3.

  2. Jonathan Cremin August 23, 2011 at 3:23 pm #

    Have you actually benchmarked MaxCDN against Cloudfront? Can they afford to charge less because their service isn’t as good?

  3. Joe Moreno August 23, 2011 at 4:22 pm #

    Thanks for pointing out MaxCDN. I’d never heard of them before, but it’s definitely worth the price. Huh: CloudFront doubles your bill because you pay for bandwidth out of S3 to Cloudfront and then out of Cloudfront to your client.

  4. jlynch3 August 23, 2011 at 4:36 pm #

    How does MaxCDN compare to Cloudflare?

  5. DGoodall13 (Twitter) August 23, 2011 at 7:25 pm #

    If anyone is looking to test MaxCDN or our Enterprise platform NetDNA, just shoot me an email. dgoodall (at) netdna.com and let me know that you saw it here. We have created MaxCDN so small sites and blogs can benefit from using a CDN, our Enterprise platform is made for larger sites, or basically anyone that depends on their site to make money. We do have a Hong Kong PoP available as well as a full site product.Feel free to let me know if you have any questions at all and I will get them answered.Cheers,David Goodall

  6. james August 24, 2011 at 5:45 pm #

    Huh & Joe Moreno: CloudFront will NOT double your bill. We were hosting on S3 and paid ~$250/month, switching to CloudFront REDUCED our total bill. CloudFront only pull the file from s3 once and then caches it, the cost there is extremely small. CloudFront. The big savings are in requests:CloudFront – 10,000 Requests for $0.0075S3 – 1,000 Requests for $0.01That means switching to CloudFront would save you 92.5% on the requests portion of your bill.

  7. Mxx August 27, 2011 at 4:54 am #

    Well CloudFront would double the cost if you (stupidly) configured all files to never cache. Then on each request CloudFront would have to re-validate its cached file, hence doubling the number hits and doubling the cost.If you use proper ‘cache forever’ headers and invalidate using file names then CloudFront would be much cheaper.

  8. Anthony August 27, 2011 at 8:01 am #

    CloudFront doesn’t double the bill, you’re right, I’ve updated the blog post. But a properly configured S3 + CloudFront is still more expensive than S3 alone.

  9. James August 27, 2011 at 1:30 pm #

    It may increase your bill, it really depends on what type of files you serve. If you serve a lot of small files (as most people do) then your bill should go down with cloudfront. Look at your itemized bill, take the requests section and decrease it by 90%, then take the transfer section and add the total size of your bucket once, that should be your new bill. I can’t post the exact values, but our bill most definitely went down after making the switch to cloudfront.

  10. Cary Abramoff January 30, 2012 at 10:30 am #

    Hi,

    I am engaged in the migration to maxcdn & I use S3/Cloudfront but I do not want to pay for GETS since they are free with MaxCDN. As you say a no brainer.

    However the easy part I am not getting. I set up the CNAME record and configured my pull zone on maxcdn to yank from my S3 bucket so I can automagically have the Cache-Control & Expires meta-data (all mega far flung expiry dates) make my site bare metal cheap.

    Problem is the maxcdn settings are apparently picking up an IP from S3 and when I use the maxcdn dashboard to “test IP” it returns a 403. Further my understanding is S3 IP quads change all the time. So I am about to jump into chat but info on s3maxcdn configurations is scant, basically your blog post.

    So if you can comment on that it may save the next savvy architect some grief.

    • Cary Abramoff January 30, 2012 at 10:50 am #

      Just to help future travelers here is what maxcdn support had to say:

      The IP for amazon changes all the time, so the solution for this is actually to move pull zone to pull zone 2.0 which is not affected by that
      So please send an email to support requesting your pull zone to be moved to pull zone 2.0

      • Cary Abramoff January 31, 2012 at 5:42 am #

        Postscript: The next business day at 8AM they pushed me to pull 2.0 (no pun intended) and voila, my s3 bucket is being pulled by maxcdn. So far I am quite impressed with maxcdn even though the cname record does not yet work. :) )

Leave a Reply