DEV Community

Productivity Hacks & Software Performance Analysis
Productivity Hacks & Software Performance Analysis

Posted on • Originally published at speedtestdemon.com on

Is a premium CDN like CloudFront worth it, instead of a free CDN? — Speed Test Demon

Short answer : yes you should use a premium CDN, because 1) premium CDNs are easily 3 times faster than free CDNs — 1+ seconds vs 0.3 seconds, a huge difference for traffic as valuable as ecommerce, 2) it doesn’t even cost you that much. Extensive cost analysis later in this essay. It’s only a few dollars unless you’re running a very large traffic website.

I’m on Twitter @SpeedTestDemon and email list is here.

EDIT: I just read on this random tech website (techradar) “no doubt prices can be high”. Ugh it’s just trash content. It’s written by someone who just wants to fill up word count. It’s not written by someone who’s actually operated a website. Come on and actually do the math. If you’re the typical small-time website, you know CDNs cost you close to nothing. If you actually have a lot of traffic, it might end up getting to $100/month — hardly more expensive than whatever you’re already paying for hosting. Apologies for the mini-rant.

EDIT 2: just looked up techradar’s monthly traffic and holy crap they have 52 million visitors a month for writing that kind of trash content? Unbelievable. Makes me feel like ranting. Why do people put up with trash content. I will write a rant about this later.

Longer answer : rest of this essay.

The main focus of the rest of this essay is going to be discussing the pricing advantage of free CDNs over premium CDNs.

Regarding the other dimension of performance — well I’m already going to be discussing that in 20+ articles analyzing 20+ free CDNs. A brief summary thus far: Premium CDNs are obviously way faster than free CDNs — easily 3 times better. It’s not even close. And it makes sense, right? A fast CDN like CloudFront is hugely expensive to maintain high performance across terabytes of data, thousands of servers. This is really hard. Imagine debugging and maintaining thousands of computers. And then making sure the servers have high availability. Really hard.

So the only advantage that free CDNs have over premium CDNs is pricing. It’s true: a premium CDN will cost you money. But how much is it really? Let’s explore the cost question for the rest of this essay.

To find out how much a CDN will cost you, all we need to find out is how much data your website transfers. This is because the metric that CDNs charge on is the amount of data transferred by the CDN. Cloudfront, for example, is around USD $0.11 per GB (BunnyCDN is a cheaper alternative at $0.04 / GB. Not sure whether it’s actually faster, I will be speed testing Bunny CDN shortly!).

Let’s estimate how much data you’re going to be using if you’re in either one of these two buckets:

  • You already have a working website
  • You’re still building out your website

How to find how much a CDN would cost you if you already have a working website

If you’ve already got a website setup, there’s a simple test you can do. Go to your website. Open up Chrome Developer Console. Click the Network tab. Ctrl+R or Cmd+R in order to reload the website. Then you see a number where it says how much data got transferred over the network. This is how much data the CDN will charge you.

Here’s an example screenshot of where to find the data transferred in the Chrome Developer Console tab. Look for the red circle. This example is for facebook by the way.

Please note you can safely ignore the “X MB resources” number. That number is usually far larger than the “X MB transferred” number because “X transferred” is highly compressed. For example, a 1 MB photo is usually first compressed (probably gzip, although brotli compression recently released by Google is starting to gain adoption) before your browser downloads a 500 KB photo, which gets decompressed back to 1 MB. Web servers do this in order to speed up how long it takes for the web page to render for you.

OK once you’ve got the number, jump down to the section analyzing the cost of the premium CDNs.

How to find how much a CDN would cost you if you are planning to build a website

If you’re still planning out your website, we can still get a good estimate of how much data you might transfer by looking at a few representative examples.

The first best thing you could do is to do the “data transfer” test (written about in the previous section for a working website) on somebody else’s website already out there that is most similar to what you want to create.

Another good rule of thumb is to assume your average web page has a size of 2.07 MB. Pingdom has conducted a study on the average web page size. They have all this data since millions of people use Pingdom to test how long their website takes to load. They found the average page size is 2.07 MB.

Lastly, you could go through a bunch of case studies below where we analyze how much data was transferred for each example. You can pick out the example that represents your goal most closely and use that number to calculate your estimated CDN cost.

Note: case studies are conducted with an adblocker, which means data transferred could be much smaller than without an adblocker.

Case Study: How much data does a Shopify store use?

Example: https://seloolive.com/ (they have awesome olive oil, you should buy from them)

Data transferred: 1.2 MB

Case Study: How much data does a minimal wordpress website use?

Example: https://speedtestdemon.com/ (my own website, haha, which runs on WordPress)

Data transferred: 203 KB (wow that’s small!)

Case Study: How much data does a complicated custom ecommerce solution on WooCommerce use?

Example: the product page of an ecommerce store doing 7 figures in revenue per year.

Link: https://www.solioswatches.com/product/solar-black-black-mesh?caseColor=matte-black&dialSize=36mm&gender=men

Data transferred: 4.6 MB

Case Study: How much data does a simple sports betting web app use?

Example: this is a simple web app that does optimizing.

Link: https://www.topflightfantasysports.com/pga/pga-fd-optimizer/

Data transferred: 4.4 MB

Case Study: How much data does a big complicated web app like Facebook use?

Example: facebook.com

Data transferred: 3.8 MB

Case Study: How much data does a simple landing page use?

Example: https://sizzy.co/

Data transferred: 516 KB

Case Study: How much data does a portfolio website use?

Example: http://www.baileyritchiephoto.com/

Data transferred: 1.8 MB

Case Study: How much data does a magazine website use?

Example 1: typical techcrunch.com article

Link: https://techcrunch.com/2018/09/11/comma-ais-george-hotz-ousts-george-hotz-as-ceo/

Data transferred: 2.4 MB

Example 2: oil price news site

Link: https://oilprice.com/Geopolitics/Middle-East/Could-Energy-Ties-Bring-Saudi-Arabias-Conflict-With-Iran-To-An-End.html

Data transferred: 650 KB (oh interesting, MUCH smaller than techcrunch)

Example 3: bitcoin news site (because who doesn’t love bitcoin??)

Link: https://news.bitcoin.com/latin-american-countries-bitcoin-adoption-el-salvador-bitcoin-law/

Data transferred: 3.6 MB

So how much does a premium CDN really cost you?

Once you’ve got the number of how much data you’re transferring per pageview, now find how many pageviews you’re getting per month (or per day, your preference). The math is just a simple multiply: (number of pageviews * amount of data per pageview) = total data per month (or day).

OK now what is the cost of transferring that data? In the case of Cloudfront, you can just use the highend number of $0.11 / GB (they vary their pricing per region).

If you rather use other premium CDNs, here’s the full list of the most popular ones (it’s a crowded market, there’s probably many premium CDNs I missed. Drop me a comment on twitter or email if you want me to include your favorite CDN).

  • CloudFront: $0.11 / GB
  • Cloudflare (the premium version, not their free tier which also has bad performance like every other free CDN): cheapest premium plan is $20/month.
  • Fastly: minimum charge $50/month.
  • BunnyCDN: $0.01 / GB for North America & Europe, $0.06 / GB for Africa.
  • KeyCDN: minimum charge $0.04/GB to $0.11 depending on your location.
  • StackPath (MaxCDN): Starting from $15
  • Akamai: flexible pricing model starting from $0.087 / GB
  • Microsoft Azure CDN: Starting from $0.081 to $0.233 depending on location.
  • CDN77: starting at $199/month ($0.033 / GB).
  • Leaseweb: minimum of $49/month ($0.06 / GB).

Have you finished calculating how much that premium CDN costs you? If you’re a small-time website, you should probably go with CloudFront (or KeyCDN or Azure) which allows you to pay a much smaller upfront cost than some of these other premium CDNs like Fastly. $50/month is ridiculous to pay for a CDN if you’ve got barely a few thousand traffic.

Let’s say you’re a website doing 10,000 pageviews/month, which is an amount most websites don’t even get to. The math is 10,000 pageviews/month * 2 MB/pageview = 20 GB/month of data. Then 20 GB/month * $0.11 /GB = $2.20 / month. Basically a pittance. Chances are pretty good you’re already paying $5/month for hosting along with many other widgets and plugins.

In that example we just quickly analyzed, you’re getting 3 times faster page loading times for 10,000 people for just $2.20/month. It’s an incredible deal.

Are there exceptions where a Free CDN is as good as a premium CDN?

Actually, yes. I’m currently doing an investigation on free CDNs and I’ve been impressed with some Free CDNs so far.

The best one I’ve seen so far is Jetpack CDN (a.k.a. Photon CDN), where Jetpack’s image CDN performed very admirably (as well as CloudFront) while also having a great image compression algorithm. However, very limited to images, when you probably would also like to put HTML, JS, CSS, video, and audio on the CDN.

Another good one is Cloudinary but they have a fairly limited free tier of 25 GB in a month, after which you need to pay $99/month. I’m currently writing an article on Cloudinary right now.

So the answer is yes, premium CDNs are worth it

In my humble opinion, the premium CDNs don’t cost that much. The only problem is if you’re the kind of person who has trouble understanding how to set up a CDN. Am I wrong? Feel free to argue with me on Twitter or in email (hello at speedtestdemon dot com). I’m willing to change my mind if your argument’s good.

Related Essays

Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!

Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!

Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl

CDN Speed Tests (Testing Methodology)

Python CDN Speed Test Script: I use this to automate the collection of metrics about CDNs.

Top comments (0)