<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Productivity Hacks &amp; Software Performance Analysis</title>
    <description>The latest articles on DEV Community by Productivity Hacks &amp; Software Performance Analysis (@productivityhacks).</description>
    <link>https://dev.to/productivityhacks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F690553%2F727cd855-02c6-4010-9f29-f998e1275582.png</url>
      <title>DEV Community: Productivity Hacks &amp; Software Performance Analysis</title>
      <link>https://dev.to/productivityhacks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/productivityhacks"/>
    <language>en</language>
    <item>
      <title>Turing Technique: Trick I learned from Taleb to get better at chess and chess variants extremely quickly— Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Mon, 06 Sep 2021 08:14:25 +0000</pubDate>
      <link>https://dev.to/productivityhacks/turing-technique-life-changing-tip-to-get-better-at-chess-and-chess-j7a</link>
      <guid>https://dev.to/productivityhacks/turing-technique-life-changing-tip-to-get-better-at-chess-and-chess-j7a</guid>
      <description>&lt;p&gt;&lt;em&gt;(NOTE: If you disagree with me, I’ll be willing to listen on Twitter 😊:&lt;/em&gt; &lt;a href="https://twitter.com/SpeedTestDemon"&gt;&lt;em&gt;@SpeedTestDemon&lt;/em&gt;&lt;/a&gt;&lt;em&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This technique was life-changing because it helped end a gaming addiction consuming nearly every moment of my day. And I got it from the famous author Nassim Taleb (thank you, eternally grateful). Other mental techniques I used to solve the addiction was &lt;a href="https://speedtestdemon.com/surprising-mention-of-affirmations-from-3-totally-different-people-a-cartoonist-an-olympian-americas-greatest-salesman/"&gt;affirmations&lt;/a&gt; and &lt;a href="https://speedtestdemon.com/the-four-most-powerful-mindset-hacks-that-have-worked-for-me/#Replacing_addiction_with_a_alternative_habit_that_is_meaningful_to_you"&gt;gradually replacing addiction with a meaningful hobby&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Turing Technique is summarized as follows: the fastest way to learn a game that a computer has mastered… &lt;em&gt;is to play against the computer&lt;/em&gt;. And memorize as many positions, moves, and patterns as you can. To be clear, this is **not just** about memorizing the beginning moves (also called opening theory by chess players), but also about improving anything in the middlegame and endgame.&lt;/p&gt;

&lt;p&gt;I’m calling this the Turing Technique because this learning hack makes heavy use of the computer as a shortcut to mastery, and Turing is famous for pioneering computer science.&lt;/p&gt;

&lt;p&gt;The Turing Technique is a rather bold claim. However, I speak from deep personal experience. This increased my &lt;a href="https://en.wikipedia.org/wiki/Crazyhouse"&gt;crazyhouse (a popular chess-like game)&lt;/a&gt; rating by 217 &lt;a href="https://en.wikipedia.org/wiki/Elo_rating_system"&gt;Elo points&lt;/a&gt; (from 2233 to 2450) in only 4 hours of work for 5 days, or 20 hours total. And it finally helped end my crazyhouse addiction that I was desperate to end.&lt;/p&gt;

&lt;p&gt;I’m certain the Turing Technique is the best way to learn chess — and I am certain beyond the shadow of a doubt that the Turing Technique is highly effective for simple chess-like games like crazyhouse due to my personal experience I write about in this essay.&lt;/p&gt;

&lt;p&gt;Some people are immediately going to question whether I actually know what I’m talking about. Before crazyhouse, I’ve played chess for over 10 years and quit at National Master as I personally no longer cared about “chasing rating points.” Way back in the day when we were growing up, I’ve played International Master (IM) Eric Rosen and IM Kassa Korley and won both games (to be fair, it was a LONG time ago now) — I mention because it seems they’re both popular streamers now (I sometimes wonder if I went down that path…). And I’ve played Marc Esserman at Harvard Square, where he gave me an extra Queen and I still lost horribly (I was already a couple years retired from chess though 😅) — and then later he tried to sell me his Smith-Morra book. I know way more about the game than I probably should.&lt;/p&gt;

&lt;p&gt;Skeptics are going to say the Turing Technique won’t work with chess, as the game is too large “to be memorized”. At the end, I have a full section of rebuttals addressing concerns such as these.&lt;/p&gt;

&lt;h1&gt;
  
  
  First, Thank you Nicholas Nassim Taleb
&lt;/h1&gt;

&lt;p&gt;First, let me give credit where credit is due: Nassim Taleb deserves 80–90% of the credit for the Turing Technique. He might not remember these two tweets, but it totally changed my life completely (by putting an end to my gaming addiction).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;My point is that if you want to practice skiing, you learn disproportionally more from hard runs (tail events) than from slopes for a beginner. Just as you gain more from lifting extremes (from convexity) than regular weights.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You learn disproportionally more from tails of distributions than you do from their center.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/nntaleb/status/1060384417024217088"&gt;&lt;em&gt;https://twitter.com/nntaleb/status/1060384417024217088&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  The Epiphany
&lt;/h1&gt;

&lt;p&gt;You see it’s not a far jump from Taleb’s tweets to the Turing Technique. My first thought was: “What is the chess equivalent of a hard ski slope? Is it playing against Grandmasters?”. A moment’s pause. No…it’s &lt;em&gt;playing against computers!&lt;/em&gt; What could be tougher than playing against computers? And it struck me that this &lt;em&gt;must&lt;/em&gt; be correct. It &lt;em&gt;must&lt;/em&gt; be the fastest learning method.&lt;/p&gt;

&lt;p&gt;It’s like solving Rubik’s cube, which has thousands of combinations, but you only need to memorize a few key patterns to take you from start to finish.&lt;/p&gt;

&lt;p&gt;How did this change my life? At the time I was extremely addicted to a chess variant called crazyhouse, spending 13+ hours a day playing the game. I had just successfully paused playing the game using mindset hacks, which I write about &lt;a href="https://speedtestdemon.com/the-four-most-powerful-mindset-hacks-that-have-worked-for-me/"&gt;here&lt;/a&gt; and &lt;a href="https://speedtestdemon.com/surprising-mention-of-affirmations-from-3-totally-different-people-a-cartoonist-an-olympian-americas-greatest-salesman/"&gt;here&lt;/a&gt;. Then…I read Taleb’s tweet…commencing a funny “Angel vs Demon” dialogue inside my head:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “I know I want to stop playing this game, but…….what if I tried &lt;em&gt;one more thing…&lt;/em&gt;”.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Angel&lt;/strong&gt;: “That’s literally what every addict says. Do you really want to end up playing 13+ hours a day again? You &lt;em&gt;just&lt;/em&gt; managed to stop playing, and now you want to jump back in?”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “But I think this time it’s different!”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Angel&lt;/strong&gt;: “Aren’t those the most dangerous words in finance? This time it’s different?”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “But this time I think it’s really different!”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Angel&lt;/strong&gt;: “Oh really? How is it different?”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “It really is different! I’ve never tried learning by playing against computers, and only computers…”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Angel&lt;/strong&gt;: “OK, I guess you have a point. And if this learning technique doesn’t work? What’s the worst case scenario?”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “Then I guess it’s going to be 40+ hours of my life gone while trying to knock the addiction off again…”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Angel&lt;/strong&gt;: “Sounds like you know the devil’s bargain. Your choice.”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Devil&lt;/strong&gt;: “I just &lt;em&gt;have&lt;/em&gt; to try it…Taleb’s tweet makes too much sense. I think this could really work…”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Taleb’s idea just made too much sense-the signal-to-noise ratio of learning from the computer &lt;em&gt;must&lt;/em&gt; be very high…&lt;/p&gt;

&lt;h1&gt;
  
  
  The Turing Technique in Action
&lt;/h1&gt;

&lt;p&gt;…so of course, I went ahead and tried the Turing Technique.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_eWex_C4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/700/0%2AAZcTkrjvgAe67tdX" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_eWex_C4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/700/0%2AAZcTkrjvgAe67tdX" alt=""&gt;&lt;/a&gt;&lt;br&gt;
The plan was simple.&lt;/p&gt;

&lt;p&gt;The “test procedure”: How to test my knowledge&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Go to &lt;a href="https://lichess.org"&gt;lichess.org&lt;/a&gt; and play crazyhouse against the lichess Stockfish computer&lt;/li&gt;
&lt;li&gt; Allow myself as many take backs as I wanted.&lt;/li&gt;
&lt;li&gt; Lose horribly despite all the take backs.&lt;/li&gt;
&lt;li&gt; Resign the game and open the analysis board, which shows computer analysis. Find all the mistakes I made. Use curiosity to explore anything interesting.&lt;/li&gt;
&lt;li&gt; Go to Step 1. Repeat.&lt;/li&gt;
&lt;li&gt; Occasionally switch it up by playing taking the other side: play &lt;em&gt;against&lt;/em&gt; the line I was trying to learn.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The “learn procedure”: how to learn&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Open &lt;a href="https://lichess.org/analysis/crazyhouse"&gt;lichess analysis board&lt;/a&gt;, turn on Stockfish computer.&lt;/li&gt;
&lt;li&gt; Play out opening and all moves I was interested in analyzing.&lt;/li&gt;
&lt;li&gt; Then to test the new opening knowledge, run the “test procedure”.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HMTbh2OQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/700/0%2AQ3nGbpI3BVEIbmw5" alt=""&gt;
Then finally, the “real world test procedure”: play a few rated games against humans-but only a few…majority of time should be spent with the computer. This is to get real-world feedback on what to learn next. If a particular line was weak, then you know where to spend more time with the computer.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Results? End of the week report.
&lt;/h1&gt;

&lt;p&gt;It was very consistent progress. Every single day I would put in 4 hours of training against the computer, then a few games against humans, and I would gain 50 points. By the end of the week, only 5 days later, my rating went from 2233 to 2450. That’s when I &lt;em&gt;knew&lt;/em&gt;, this time in my &lt;em&gt;gut&lt;/em&gt;, this &lt;em&gt;visceral&lt;/em&gt; feeling…that I was done with crazyhouse. I was really done. My addiction was finally over. Because…if mastery means playing as close to a computer as possible, then I don’t want to play the game. Let me do something that computers cannot master. &lt;em&gt;Let me be human&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Incidentally, my “Let me be human” desire resonates extremely similar to this clip I found about Bobby Fischer hating chess…&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Bobby Fischer Hated Chess:
&lt;/h1&gt;

&lt;p&gt;This section was a last-minute add to the essay, but I just had to add it because it fit so perfectly. I just watched this great clip of &lt;a href="https://www.youtube.com/watch?v=P349BdHUxlc&amp;amp;t=19s"&gt;Bobby Fischer hating chess&lt;/a&gt;, and it ties in so perfectly with this essay. Why does he hate chess? Because of computers. Good quotes from the clip:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  “I hate chess because I know what chess is all about. It’s about memorization, it’s all about pre-arrangement, creativity is lower down on the list!”.&lt;/li&gt;
&lt;li&gt;  NOTE on “pre-arrangement”: a terrible word choice by Fischer that implies conspiracy and collusion by players. This is NOT what he means. He’s referring to the grandmasters analyzing and memorizing the crap out of the first 20–30 moves in chess. His complaint is players aren’t finding moves over the board, but just playing from memory. A better word choice that chess people will understand would have been “extremely excessive opening theory”. &lt;a href="http://chessforallages.blogspot.com/2008/09/ruining-chess-with-prearranged-games.html"&gt;Here’s another guy’s explanation&lt;/a&gt; of the same thing.&lt;/li&gt;
&lt;li&gt;  “Chess just the last few years has changed dramatically with all this computer stuff”&lt;/li&gt;
&lt;li&gt;  “But why would you want to get involved with something that is mainly rote and pre-arrangement?”&lt;/li&gt;
&lt;li&gt;  Nakamura comments: “When he talks about chess and how it’s getting harder and harder, that’s true of every game…he should be angry at computers, not angry at the game”.&lt;/li&gt;
&lt;li&gt;  I think Nakamura misses the point — I don’t think Fischer is angry about “chess getting harder”, but that it’s no fun playing a game that’s largely based on rote memorization and massive opening theory.&lt;/li&gt;
&lt;li&gt;  Tangential point: this is why he spent a lot of time trying to revive chess with &lt;a href="https://en.wikipedia.org/wiki/Fischer_random_chess"&gt;FischerRandom&lt;/a&gt;, which throws away all the opening theory by randomizing the starting position.&lt;/li&gt;
&lt;li&gt;  And lastly, there’s this great Youtube comment that resonates so much with me that I’ll quote it here:&lt;/li&gt;
&lt;li&gt;  “I quit chess at 2200 for this reason. I “looked ahead” at FMs IMs GMs and saw what they did. They just memorize. They know all the endgame principles, are very good at calculation and objective evaluation, but ultimately… all that separates a 2200 from a 2500 is how many hours he spent on his engine memorizing a line in the Sicilian. Chess at the beginner level is its most pure form of the game. Wild sacs, fun mates and silly opening traps, kids smiling and old people sipping their coffee. Thats what chess is about, friends and community.. not the hyper competitive memorization and brute force analysis of tournaments today.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There IS one thing I’d like to comment on Fischer Random since Bobby Fischer thinks it’ll bring back chess: the optimal way to learn Fischer Random is &lt;em&gt;still&lt;/em&gt; ……playing against the computer! This time it’s not about memorizing a lot of the beginning moves but about recognizing patterns really well. Still, it feels so lame that the best learning strategy is to bang your head against the computer. Why not do something that only humans can do?&lt;/p&gt;

&lt;h1&gt;
  
  
  Rebuttals to potential arguments by skeptics
&lt;/h1&gt;

&lt;h1&gt;
  
  
  But how are you supposed to learn basic chess concepts by playing the computer?
&lt;/h1&gt;

&lt;p&gt;Fair point. I’d say you still need to know the “big ideas” or “mental models” of the chess game in order to hang all the learnings on those hooks. However, the middlegame concepts can easily be covered in a book, while your specific opening patterns can be covered in a book as well. The rest of the time…?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  How would you learn chess tactics? By learning how the computer crushes you with those tactics&lt;/li&gt;
&lt;li&gt;  How would you learn chess openings? By learning how the computer crushes you in those openings&lt;/li&gt;
&lt;li&gt;  How would you learn positional play? By learning how the computer crushes you in positional play.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seeing a pattern?&lt;/p&gt;

&lt;p&gt;You can still learn those good moves by learning from your losses against the computer.&lt;/p&gt;

&lt;h1&gt;
  
  
  If you really believe this is the best way to learn chess, why don’t you become a chess grandmaster (GM)?
&lt;/h1&gt;

&lt;p&gt;For the same reason Bobby Fischer hated chess, dear reader. Why get involved in something that’s &lt;em&gt;largely&lt;/em&gt; based on rote and memorization and opening theory? Scroll up to see the quotes from Bobby Fischer on chess.&lt;/p&gt;

&lt;p&gt;And besides, I already proved for myself that the Turing Technique drastically speeds up learning in crazyhouse. That’s good enough for me. And I really don’t want to be like a computer. &lt;em&gt;Let me be human&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Secondly, I’m sure out of the thousands of people who’ve read this blog post, there’ll be one person who takes it to heart. That person will succeed, and write a blog post going viral. You can let me know and I’ll write the blog post publicizing it for you.&lt;/p&gt;

&lt;h1&gt;
  
  
  But chess is much more complex than crazyhouse. You can’t learn chess just by playing a computer
&lt;/h1&gt;

&lt;p&gt;Readers who are chess fans will have disbelief that the same rapid growth of 200 Elo points in such a short time (~20 hours over a week) could be achieved in a game as big and complex as chess.&lt;/p&gt;

&lt;p&gt;Let me preface this by saying I’ve spent many years of my childhood playing chess. I was only a few points away from the National Master title, when I purposely quit when I realized the futility and pointlessness of these chess titles and rating points. I quit in protest and rebellion of the whole darned system.&lt;/p&gt;

&lt;p&gt;Let me also say that I agree chess is a much bigger, complex game than crazyhouse. Chess has much more to memorize. Crazyhouse barely has an opening, and no possibility of an endgame.&lt;/p&gt;

&lt;p&gt;However, I firmly believe the Turing Technique applies to chess as well. Just wait a moment: you realize grandmasters are famed for having insane recall of literally thousands of games? They can recall games played decades ago. There was one &lt;a href="https://www.youtube.com/watch?v=eC1BAcOzHyY"&gt;video that went mega-viral testing Magnus Carlsen’s memory&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now why wouldn’t you expect the GMs to just memorize against the computer? It’s a miracle of the computing revolution that even cheap pocket phone computers have more processing power than the famous Deep Blue computer that beat Kasparov.&lt;/p&gt;

&lt;p&gt;I would advise an aspiring chess player to learn from a book the “mental models” of chess such as pawn structure. But all the ideas can be easily covered in a single book (How to Reassess Your Chess by Silman was one book I read often in my childhood). Then, spend a ton of time with the computer, tying specific examples to the mental models.&lt;/p&gt;

&lt;p&gt;It’s not going to be as quick as crazyhouse…it won’t take only 20 hours and 2 weeks of work. It might take 6–12 months to gain 200 Elo points. But the Turing Technique is without a doubt the fastest possible path.&lt;/p&gt;

&lt;p&gt;Think about it. Do you really think Magnus Carlsen (or whoever the World Champ is) is &lt;em&gt;not&lt;/em&gt; using a computer? Do you really think &lt;em&gt;none&lt;/em&gt; of the grandmasters are using computers to analyze the crap out of &lt;em&gt;everything&lt;/em&gt;? I remember Marc Esserman spending his entire Harvard winter break analyzing the hell out of the Smith-Morra, which is how he became the expert on that variation (By the way, I have actually met and played Marc Esserman at Harvard Square! Pretty chill dude 😊). Why has the age of “world’s youngest GM” been steadily declining, now to only 9 years old?&lt;/p&gt;

&lt;p&gt;Rhetorical questions. The answers are obvious.&lt;/p&gt;

&lt;p&gt;A related point: I believe one of the best things an aspiring chess player can do is to take a couple well known opening books and just memorize the crap out of it. One of the most common (bad) advice is advising beginners to focus on the middle game principles instead of studying openings. I had the most rapid growth (200 Elo points easily) in my “chess career” simply by studying the heck out of 3 chess opening books, every single line and position. Usually middle game performance improves from understanding the opening so well.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why not play a human then analyze that game with a computer?
&lt;/h1&gt;

&lt;p&gt;Some people might say the Turing Technique doesn’t sound that different from playing a game with a human and then analyzing it with a computer.&lt;/p&gt;

&lt;p&gt;Au contraire. Couldn’t be more different.&lt;/p&gt;

&lt;p&gt;Forget humans. You should literally play against &lt;em&gt;computers&lt;/em&gt;, and &lt;em&gt;mainly computers&lt;/em&gt;. Why? The signal-to-noise ratio is &lt;em&gt;far&lt;/em&gt; higher. Even the slightest mistake is punished, and highly visible. And it is easy to explore many variations simply out of curiosity, with the computer showing you the best moves every step of the way.&lt;/p&gt;

&lt;p&gt;The main benefit of playing against computers is being able to focus on &lt;em&gt;exactly&lt;/em&gt; the problem area. It’s focused training. Playing against random humans on the internet…well you can easily go a whole hour until you get challenged in that one line you have trouble with. Playing against computers, you get heavily challenged, 10 times in a row, in a very short time.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why not study Grandmaster games?
&lt;/h1&gt;

&lt;p&gt;This is sort of the same idea as the Turing Technique, in that the goal is to study what the good moves and patterns are. However, the major missing weakness is the Grandmaster is not there to answer what would happen if a different move was played.&lt;/p&gt;

&lt;p&gt;If you’re going to study GM games, better have computer analysis nearby so that you are able to explore questions easily. It’s a mistake to study GM games in isolation otherwise.&lt;/p&gt;

&lt;p&gt;There is no crazyhouse book, hence no one has any idea what the “best moves” are. You can try copying the high-rated players, but what happens if you get taken off-variation…?&lt;/p&gt;

&lt;h1&gt;
  
  
  How To Learn Chess Openings?
&lt;/h1&gt;

&lt;p&gt;A combination of an opening book and Turing Technique. One book per opening is probably fine. The opening book is mainly to learn the “mental models”. Then test and expand your opening knowledge fast and heavy with the Turing Technique. Play against the computer with both colors on the same opening.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts: Dear Younger Self…
&lt;/h1&gt;

&lt;p&gt;I’m writing this as if I were writing a guide to my younger self.&lt;/p&gt;

&lt;p&gt;Several years ago, I was severely addicted to crazyhouse and desperately wanted to shake off the addiction.&lt;/p&gt;

&lt;p&gt;Here’s what I’d say to my younger self of several years ago: “Son. It’s simple. Just use the Turing Technique. Just play against the computer and memorize everything. That’s all there is to it. You can go do something else now. Don’t be addicted.” Followed by a wholesome hug 🥰&lt;/p&gt;

&lt;p&gt;Don’t believe me that this Turing Technique works? Why don’t you try it out for 10–20 hours and come &lt;a href="https://twitter.com/SpeedTestDemon"&gt;discuss it with me on Twitter&lt;/a&gt; about it.&lt;/p&gt;

&lt;p&gt;I also have a theory on how to master first-person shooter games like Halo rapidly. However, I haven’t tested it yet. If it works I’ll write about it 😊. &lt;a href="https://speedtestdemon.com/"&gt;Subscribe&lt;/a&gt; if you’re interested in getting that update.&lt;/p&gt;

&lt;h1&gt;
  
  
  Random Thoughts I Couldn’t Fit Into Essay
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;  The corresponding “hard ski slope” for language learning would be going to a bar in France and attempting to converse using French. This thought is also inspired by something Nassim Taleb said in a tweet, which I am too lazy to dig up at the moment (readers, help?).&lt;/li&gt;
&lt;li&gt;  Computers are significantly cheaper and more widespread, leading to ever-younger chess GMs from even countries with lower median income.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>chess</category>
      <category>learning</category>
    </item>
    <item>
      <title>Python CDN Speed Test Script — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Sat, 21 Aug 2021 11:03:21 +0000</pubDate>
      <link>https://dev.to/productivityhacks/python-cdn-speed-test-script-speed-test-demon-2fda</link>
      <guid>https://dev.to/productivityhacks/python-cdn-speed-test-script-speed-test-demon-2fda</guid>
      <description>&lt;p&gt;Simple python script I use to speed test CDNs. It’s open sourced under MIT license. The repository is: &lt;a href="https://github.com/speedtestdemon/speed-tests"&gt;https://github.com/speedtestdemon/speed-tests&lt;/a&gt; and the python script is “test.py”.&lt;/p&gt;

&lt;p&gt;The script takes a single input “URL”. Example usage: &lt;code&gt;python3 test.py [https://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/cf.png](https://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/cf.png)\&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The script outputs these things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Cold cache, hot cache, and warm cache tests (in that order).&lt;/li&gt;
&lt;li&gt; The response headers for cold cache and warm cache tests. This is important to see the header that reports “Hit”, “Miss”, or “RefreshHit”. It ensures that you’re running the cold cache and warm cache tests correctly.&lt;/li&gt;
&lt;li&gt; The hot cache times are averages of 10 curls.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unique notes about the CDN Speed Test Script:&lt;/p&gt;

&lt;p&gt;Here is an example output of the python script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;\-------------------------------------------------------------  
Testing "Cold cache speed"  
\-------------------------------------------------------------  
Got headers:  
HTTP/2 200  
content-type: image/png  
content-length: 719983  
date: Fri, 25 Jun 2021 15:01:17 GMT  
last-modified: Mon, 07 Jun 2021 00:16:21 GMT  
etag: "52ae2ff2354d4a68e680b77b4da58985"  
accept-ranges: bytes  
server: AmazonS3  
x-cache: Miss from cloudfront  
via: 1.1 9e8d1ff1eee770054f1561535ab320b2.cloudfront.net (CloudFront)  
x-amz-cf-pop: DFW55-C3  
x-amz-cf-id: lQPqV7PnAuwl\_52kDXS2rsC20kSrloThTOG8cN1fK-MHUce0NNIDIA==time\_namelookup: 0.12467000000000000304  
time\_connect: 0.02141099999999998560  
time\_appconnect: 0.06681200000000001027  
time\_pretransfer: 0.00020100000000000673  
time\_redirect: 0.00000000000000000000  
time\_starttransfer: 1.02790999999999987935  
time to download: 1.06810300000000002463  
time\_total: 2.30910700000000002063  
\-------------------------------------------------------------  
Testing "Hot cache speed"  
\-------------------------------------------------------------  
10 requests done. Average:  
time\_namelookup: 0.00173870000000000036  
time\_connect: 0.02068409999999999693  
time\_appconnect: 0.06124410000000000270  
time\_pretransfer: 0.00024639999999999802  
time\_redirect: 0.00000000000000000000  
time\_starttransfer: 0.03418949999999999767  
time to download: 0.21361620000000000608  
time\_total: 0.33171899999999998609  
\-------------------------------------------------------------  
Testing "Warm cache speed"  
\-------------------------------------------------------------  
Sleeping for 0.5 hr to move cache from hot to warm  
Got headers:  
HTTP/2 200  
content-type: image/png  
content-length: 719983  
date: Fri, 25 Jun 2021 15:01:17 GMT  
last-modified: Mon, 07 Jun 2021 00:16:21 GMT  
etag: "52ae2ff2354d4a68e680b77b4da58985"  
accept-ranges: bytes  
server: AmazonS3  
x-cache: Hit from cloudfront  
via: 1.1 7c556a1545ad08a01c9e86ad41ac73a1.cloudfront.net (CloudFront)  
x-amz-cf-pop: DFW55-C3  
x-amz-cf-id: ACpfQ14wbO\_vjjAisApBAJkRphZQ7IbD4Lawc77eo\_K5UM\_3-yWPZw==  
age: 1804time\_namelookup: 0.05657399999999999929  
time\_connect: 0.02411100000000000743  
time\_appconnect: 0.07374400000000000399  
time\_pretransfer: 0.00145299999999998208  
time\_redirect: 0.00000000000000000000  
time\_starttransfer: 0.02921799999999999398  
time to download: 0.22752000000000000002  
time\_total: 0.41261999999999998678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;Test Methodology: how I test CDNs&lt;/a&gt;. I use this python script to test CDNs.&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl&lt;/a&gt;: explains the curl metrics outputted by the python script.&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!&lt;/a&gt;, where I analyze Jetpack CDN using the python script.&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront/"&gt;Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!&lt;/a&gt;, where I analyze Cloudinary using the python script.&lt;/p&gt;

</description>
      <category>engineering</category>
      <category>python</category>
      <category>testing</category>
      <category>development</category>
    </item>
    <item>
      <title>Prediction: YC startup Mighty will be new default infrastructure as web VIP pass — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Sat, 21 Aug 2021 10:51:15 +0000</pubDate>
      <link>https://dev.to/productivityhacks/prediction-yc-startup-mighty-will-be-new-default-infrastructure-as-web-vip-pass-speed-test-demon-1ld3</link>
      <guid>https://dev.to/productivityhacks/prediction-yc-startup-mighty-will-be-new-default-infrastructure-as-web-vip-pass-speed-test-demon-1ld3</guid>
      <description>&lt;p&gt;&lt;em&gt;(Note: people, this is just my opinion, possibly overexcited and incorrect. Discuss cordially with me if you think I’m wrong 😊. I’m on&lt;/em&gt; &lt;a href="https://twitter.com/SpeedTestDemon"&gt;&lt;em&gt;Twitter @SpeedTestDemon&lt;/em&gt;&lt;/a&gt; &lt;em&gt;or&lt;/em&gt; &lt;a href="https://speedtestdemon.com/"&gt;&lt;em&gt;email list at blog&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. And by the way, I’m not affiliated with Mighty App whatsoever. I don’t know anybody who works there)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;There was this big commotion on Twitter and the news media that Mighty App was just a glorified Desktop-in-the-cloud, and “why would anyone in the world pay for $30/month for this”. And noticeably Paul Graham on twitter tweeting many supporting tweets, including a “ &lt;a href="https://twitter.com/paulg/status/1387065619011543040"&gt;There’s a good chance it’s the new default infrastructure&lt;/a&gt; “&lt;/p&gt;

&lt;p&gt;For those who don’t know Mighty App, it’s a service where a datacenter runs Chrome (Chromium?), and is streamed to the user’s computer. Advertised benefits are: multi-day battery life, better browser experience.&lt;/p&gt;

&lt;p&gt;While I personally was not 100% skeptic, I wasn’t 100% convinced either.&lt;/p&gt;

&lt;p&gt;But then I had this epiphany while testing CDN speeds. I finally realized what could make Mighty App work.&lt;/p&gt;

&lt;p&gt;It’s like getting a VIP pass in Disneyland with short lines. It’s like a toll road with almost no traffic. It’s like TSA pre-check line with few people.&lt;/p&gt;

&lt;p&gt;What am I talking about?&lt;/p&gt;

&lt;p&gt;It seems the main focus of all the Mighty App skeptics is they think Mighty is simply a faster computer hosted in the datacenter. You know: a faster CPU, more RAM, faster disk (NVMe?). And, the skeptics say, why would you pay $30/month for a faster computer when you could just shell out $1000 for a computer that lasts a few years?&lt;/p&gt;

&lt;p&gt;The thing is, Mighty App’s performance gains are NOT just about “a faster computer”. If it were really just about “faster hardware”, I’d agree with the skeptics.&lt;/p&gt;

&lt;p&gt;However……while those things are nice, and certainly help, what everybody is missing is the &lt;em&gt;internet speed&lt;/em&gt; in a datacenter is &lt;em&gt;blazingly faster&lt;/em&gt; than you could ever hope to buy at home.&lt;/p&gt;

&lt;p&gt;The thing is that &lt;em&gt;you simply cannot buy a “faster internet”&lt;/em&gt;. The fastest internet you could possibly buy, apparently, is Google Fiber. They &lt;em&gt;advertise&lt;/em&gt; “max speed of 2000 Mbps”, but according to “ &lt;a href="https://www.highspeedinternet.com/resources/fastest-internet-providers"&gt;highspeedinternet.com”, they only have slightly higher average download speed of 160.5 Mbps, and average upload speed of 173.6 Mbps&lt;/a&gt;. Seems fast, right? And it’s fiber optic too!&lt;/p&gt;

&lt;p&gt;Except if you run an internet speed test on a DigitalOcean VM, which I did while speed testing CDNs, it’s a whopping 1740 Mbps! Upload speed was 1420 Mbps.&lt;/p&gt;

&lt;p&gt;What the hell! 1740 Mbps? You simply cannot buy that kind of internet unless you’re Tony Stark on a buying binge with no regard for cost. It is simply not commercially available.&lt;/p&gt;

&lt;p&gt;Do you guys realize how crazy that 1740 Mbps number is? It’s 10x faster than the Google Fiber number of 160 Mbps. &lt;em&gt;10x faster&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Wait a second. Does this mean files will download 10x faster? Really? Let me check.&lt;/p&gt;

&lt;p&gt;I test downloading a file from CloudFront…and the DigitalOcean VM downloaded the file in just &lt;em&gt;22 milliseconds&lt;/em&gt;. Seriously! While my home computer downloaded it usually around 300 milliseconds.&lt;/p&gt;

&lt;p&gt;That’s right. 300 milliseconds vs 22 milliseconds. More than 10x speedup. Holy cow.&lt;/p&gt;

&lt;p&gt;And you can easily reproduce the results yourself. Here’s a CloudFront URL you can use from your home computer vs DigitalOcean VM: &lt;a href="https://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/cf.png"&gt;https://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/cf.png&lt;/a&gt; and here’s a &lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;tutorial on curl performance testing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When I saw that 10x speedup show up in the terminal, was the moment I had the epiphany that Mighty App is really on to something.&lt;/p&gt;

&lt;p&gt;How did DigitalOcean do that? Turns out it’s &lt;em&gt;not&lt;/em&gt; just fiber optic cables. Cloud providers like DigitalOcean can have something called “peering”, which is much faster than usual internet connections. As a very simplified summary: “peering” is like running a cable between your computer and the server, while normal internet connections rely on many intermediate routers. In other words, it’s like getting in the special VIP line at Disneyland. They have a special line so that the data travels faster.&lt;/p&gt;

&lt;p&gt;Do you think you can buy that at home? How are you going to get peering connections with the popular CDNs or services like Netflix? It is &lt;em&gt;not&lt;/em&gt; simple to replicate that internet access.&lt;/p&gt;

&lt;p&gt;So, that’s what I mean when I say the Mighty App is like a VIP pass to the internet. They literally have special access to the most popular CDNs and data centers.&lt;/p&gt;

&lt;p&gt;And that’s just the beginning. There’s so many mind-boggling performance hacks that Mighty App can do.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Cache common internet pages so &lt;em&gt;every&lt;/em&gt; user’s browser simply reads from disk instead of downloading from internet?&lt;/li&gt;
&lt;li&gt;  Buy ASICs (custom hardware) for TLS encryption. This is probably a 10% speedup by itself, and is extremely expensive hardware.&lt;/li&gt;
&lt;li&gt;  Heck, design a custom ASIC for JS? LOL.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Rebuttals
&lt;/h1&gt;

&lt;p&gt;But SpeedTestDemon, you still have to account for the time it takes to stream a frame over! Answer: the good news is no matter how large the web app is, you’re only streaming that frame, while the web app is speedily downloaded (or cached!).&lt;/p&gt;

&lt;p&gt;But SpeedTestDemon, 1 Gbps is going to be more and more available! Answer: I already talked about this. Even if you had Google Fiber, which advertised 2 Gbps max speed, you still only had average download 160 Mbps. Even if everybody in the world got Google Fiber, chances are pretty good you’re never going to get the “peering” agreements that data centers have, unless you’re Tony Stark and decide to buy your own data center.&lt;/p&gt;

&lt;p&gt;But SpeedTestDemon, mightyapp.com tech specs advertise only “over 1 Gbps”, not 1740 Mbps! Answer: that may be true for now. My bet is if DigitalOcean could make it work, then so can Mighty.&lt;/p&gt;

&lt;p&gt;But SpeedTestDemon, I want to say something you didn’t point out here! Fine, drop me an angry comment on &lt;a href="https://twitter.com/SpeedTestDemon/status/1420410922917584901"&gt;this twitter thread&lt;/a&gt; I wrote for this article. I promise to at least read it 😊.&lt;/p&gt;

</description>
      <category>rant</category>
      <category>silicon</category>
      <category>ycombinator</category>
      <category>startup</category>
    </item>
    <item>
      <title>Cloudinary CDN totally smokes Amazon AWS CDN CloudFront — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Sat, 21 Aug 2021 06:22:04 +0000</pubDate>
      <link>https://dev.to/productivityhacks/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront-speed-test-demon-n5a</link>
      <guid>https://dev.to/productivityhacks/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront-speed-test-demon-n5a</guid>
      <description>&lt;p&gt;&lt;em&gt;(Note: after seeing stern feedback on Hacker News and reddit, I’m changing my test approach to hire 10+ contractors in popular cities around the globe to compare CDN download times. And if you disagree with my analysis in any way, please cordially do so 😊. I’m on&lt;/em&gt; &lt;a href="https://twitter.com/SpeedTestDemon" rel="noopener noreferrer"&gt;&lt;em&gt;twitter at @SpeedTestDemon&lt;/em&gt;&lt;/a&gt;&lt;em&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I’ve learned Cloudinary basically does image and video transformations on top of the Fastly CDN. As such, I feel this is basically a review of the Fastly CDN platform. Fastly costs minimum $50/month, so it’s not free CDN I’m interested in analyzing. However, Cloudinary has a free tier going up to 25 GB of storage or bandwidth, so here’s “Analysis #2 of a Free CDN”.&lt;/p&gt;

&lt;p&gt;Cloudinary was SUPER impressive. Cloudinary was way better than AWS CloudFront. They had a secret sauce: dramatic image transformation. Cloudinary somehow compressed a 703 KB image down to 37 KB.&lt;/p&gt;

&lt;p&gt;Before I present the simplified summary, here are some links relevant to this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://speedtestdemon.com/testing-methodology/" rel="noopener noreferrer"&gt;My testing approach to CDNs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/" rel="noopener noreferrer"&gt;Python script for measuring CDNs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  Analysis #1 of a Free CDN: &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs CloudFront&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://twitter.com/SpeedTestDemon" rel="noopener noreferrer"&gt;I tweet analysis about software performance&lt;/a&gt; or &lt;a href="https://speedtestdemon.com/" rel="noopener noreferrer"&gt;email list&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;As a very simplified summary&lt;/strong&gt;, based only on hot cache results&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Cloudinary was faster than CloudFront by 3x (0.133 vs 0.397 seconds, or difference of 264 milliseconds)&lt;/li&gt;
&lt;li&gt;  Even after controlling for image size, Cloudinary was still faster by 13% (0.11 vs 0.126)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloudinary had better performance for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  How did Cloudinary compress that image 95% smaller? (~700 KB image to ~36 KB).&lt;/li&gt;
&lt;li&gt;  Much more common DNS path (res.cloudinary.com vs d20zaq59cm4c4j.cloudfront.net), which allows for significantly faster DNS lookup. In one case, 0.11 vs 0.008 seconds.&lt;/li&gt;
&lt;li&gt;  Uses Fastly CDN underneath. A lot of big companies (including Amazon) have adopted Fastly, &lt;em&gt;probably&lt;/em&gt; for a good reason.&lt;/li&gt;
&lt;li&gt;  CloudFront typically degrades a file from hot cache to warm cache very rapidly, whereas Cloudinary (i.e. Fastly) doesn’t do this until…weeks? (it’s a long time whatever it is).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What follows is a much more detailed technical analysis.&lt;/p&gt;

&lt;p&gt;I had to do 2 speed tests. The 1st speed test was not apples-to-apples because Cloudinary had compressed the image by nearly 95%. The 2nd speed test, I controlled for file size, and this time Cloudinary came out ahead very slightly by 6% (although the main credit should be due to Fastly).&lt;/p&gt;

&lt;p&gt;In the first speed test, Cloudinary really crushed CloudFront.&lt;/p&gt;

&lt;p&gt;At first sight, I had to double-check for errors. Cloudinary was nearly 3x faster — on the hot cache! — and it didn’t make sense. Turns out the test was correct. Cloudinary simply compressed the image 95% lower (700 KB to 36 KB).&lt;/p&gt;

&lt;p&gt;I had to do a second speed test to make it more apples-to-apples between CloudFront and Cloudinary (masquerading as Fastly). CloudFront did a lot better in the hot cache. Still sucked at the other two metrics.&lt;/p&gt;

&lt;p&gt;There were several reasons for Cloudinary performing so well:&lt;/p&gt;

&lt;p&gt;OK Cloudinary’s free tier is pretty impressive. The only limitation I can think of is you can’t host your whole site on it like you can with Cloudfront.&lt;/p&gt;

&lt;p&gt;Now one moment…you do “get what you pay for”…while Cloudinary has great performance, it is limited in many other ways. You can’t update a file on Cloudinary easily, unless you wholesale rename the file (very annoying). The amazing performance applies mainly to images. JS and CSS won’t have the same amazing image compression, although you will see Cloudinary perform on par with CloudFront. See the conclusion for my thoughts on the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Which_CDN_is_better_Jetpack_CDN_aka_Photon_CDN_or_Cloudfront" rel="noopener noreferrer"&gt;Cloudinary vs CloudFront decision&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It should be noted that not every free CDN performs as well as Cloudinary. I found a couple free CDNs that performed really poorly.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why is it interesting to test Cloudinary?
&lt;/h1&gt;

&lt;p&gt;Honestly it was just because they had a free tier CDN and my goal here was just to test every free CDN.&lt;/p&gt;

&lt;p&gt;I didn’t know anything about Cloudinary before writing this article.&lt;/p&gt;

&lt;p&gt;But wow, the results have blown my mind. Good job Cloudinary guys! These guys have a good product.&lt;/p&gt;

&lt;p&gt;After doing some more research on Cloudinary, I found out these guys have won some interesting accolades&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Inc. Magazine called Cloudinary the “gold standard” of image management on the web (according to Wikipedia at least).&lt;/li&gt;
&lt;li&gt;  Actually has rather large usage (unusual that I’ve never heard of them even though I’ve been in the industry for many years). Usage stats are 1 million developers and 7500 companies (Wikipedia).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;OK, so it’s got a reputation for great image management. I can see that actually. They did insanely well in this test.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why is it interesting to test CloudFront as the gold standard in CDN speed tests?
&lt;/h1&gt;

&lt;p&gt;Because Amazon is Amazon and they’re the biggest cloud provider out there (they are #1 at 32% of the market). But Cloudinary’s impressive speed test results here have me really questioning why I’m using CloudFront. Well Cloudinary’s premium tier is very expensive at $100/month, so it’s not an obvious switch. CloudFront is only at $2/month for the equivalent network out.&lt;/p&gt;

&lt;h1&gt;
  
  
  Brief Summary Of The Metrics Being Measured
&lt;/h1&gt;

&lt;p&gt;We are interested in the hot, cold, and warm cache speeds because CDNs are essentially a cache layer. If you’re interested in reading more, see the analysis here: &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Brief_Summary_Of_The_Metrics_Being_Measured" rel="noopener noreferrer"&gt;metrics measured in Jetpack vs CloudFront&lt;/a&gt; and &lt;a href="https://speedtestdemon.com/testing-methodology/" rel="noopener noreferrer"&gt;my CDN testing methodology&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Couple findings on why Cloudinary was so much better than Amazon AWS Cloudfront.&lt;/p&gt;

&lt;h1&gt;
  
  
  Finding #1: Cloudinary’s DNS lookup is significantly faster than CloudFront’s DNS lookup.
&lt;/h1&gt;

&lt;p&gt;This was similar to what I found in &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs Cloudfront&lt;/a&gt;. Cloudinary is able to achieve a significantly faster lookup time because it’s DNS path is more likely to be cached by the intermediate routers. Cloudinary DNS lookup path is “res.cloudinary.com” which seems to be the shared DNS path between most Cloudinary users, so that DNS lookup path is receiving a lot of traffic. While CloudFront’s DNS lookup path is a very customized “d20zaq59cm4c4j.cloudfront.net”.&lt;/p&gt;

&lt;p&gt;What’s &lt;em&gt;very&lt;/em&gt; interesting is Jetpack CDN’s DNS lookup times were always nearly as fast as the hot cache’s DNS lookup time (even the cold cache 0.00223 seconds was so close to hot cache 0.0016 seconds), while Cloudinary’s DNS lookup times took a small hit (hot cache 0.00175 seconds to warm cache 0.0236 seconds). I think this can be attributed to Jetpack CDN’s immense popularity which means its DNS lookup path “i0.wp.com” is going to be cached much more frequently than Cloudinary.&lt;/p&gt;

&lt;h1&gt;
  
  
  Finding #2: Cloudinary had a mind blowingly good image compression algorithm
&lt;/h1&gt;

&lt;p&gt;I’m not exactly sure Cloudinary got it so good. The same 703 KB image was somehow compressed down to 36 KB. That’s just really good and explains how Cloudinary was able to get much faster Data Transfer times than CloudFront.&lt;/p&gt;

&lt;h1&gt;
  
  
  Other interesting findings
&lt;/h1&gt;

&lt;p&gt;I already talked about these in previous essays ( &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs CloudFront&lt;/a&gt;) so I didn’t want to write more paragraphs for these.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Generally, the TCP handshake and SSL handshake times are the same regardless of file size or file type. Most CDNs and servers are going to be equally fast on these metrics, unless they are using a slower CPU to do SSL computations.&lt;/li&gt;
&lt;li&gt;  CloudFront’s warm cache (a request 30 minute after the most recent) is about 2x to 4x slower than hot cache. I found this a lot when testing Jetpack CDN. CloudFront likes to degrade a file from RAM to disk (NVMe or SSD) if it’s not seen active requests recently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first time I ran this comparison test, I was blown away by how good Cloudinary was. I thought &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN was a good Image CDN&lt;/a&gt;. I was wrong. Cloudinary was way better.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Cold cache&lt;/strong&gt;: OK so Cloudinary was 5x faster than CloudFront….because Cloudinary doesn’t really have a cold cache? Because there is no expiration on the files (unless you get Cloudinary’s premium tier).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hot cache&lt;/strong&gt;: I guess this is the metric that &lt;em&gt;really&lt;/em&gt; matters, since it’s the most common case that a CDN is going to contain the file. And boy did Cloudinary impress. By compressing the file from ~700 KB down to 36 KB, Cloudinary beat CloudFront by 3x.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Warm cache&lt;/strong&gt;: Cloudinary did even better, beating CloudFront by 4x. Cloudinary hot cache didn’t degrade even after 30 minute wait time, while CloudFront once again degraded the file so it performed 33% worse (same thing I found in &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs CloudFront&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Cold cache measurement and analysis (speed test #1)
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ttk0sqjthoegkmu0zn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ttk0sqjthoegkmu0zn8.png" alt="Cold cache measurement and analysis"&gt;&lt;/a&gt;&lt;br&gt;
CloudFront really lagged horribly here at 2.355 vs 0.395 seconds for Cloudinary.&lt;/p&gt;

&lt;p&gt;Sharp readers will notice that CloudFront showed a much worse time (2.355 seconds) in this speed test comparison than in the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs CloudFront analysis&lt;/a&gt; (1.199 seconds). It’s because I just ran this CloudFront download at a different time than when I wrote the Jetpack CDN analysis.&lt;/p&gt;

&lt;p&gt;Wait a second. CloudFront took 2.35 seconds while Cloudinary was only 0.39 seconds? Holy moly. Where did all that time go?&lt;/p&gt;

&lt;p&gt;The two big time consumers were: 1) Request Latency, and 2) Data Transfer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding Request Latency&lt;/strong&gt;: CloudFront took 1.022 seconds while Cloudinary took 0.258 seconds. What’s impressive is Cloudinary must have done two things during the cold cache lookup: it must have had the file still cached on a server despite my asking for the file only several days after getting that CDN setup. Cloudinary certainly did not fetch the file again, or it wouldn’t have gotten such a fast time. That’s really really good.&lt;/p&gt;

&lt;p&gt;Cloudinary’s cold cache is not as fast as its hot cache. Most of the time went in Request Latency. For cold cache, it’s likely they had the file stored somewhere on disk, while for hot cache, it’s probably in RAM. Actually, since Cloudinary is built on top of Fastly, I would place a strong bet that Fastly has the file in RAM or else why are people buying Fastly?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding Data Transfer&lt;/strong&gt;: yeah this was really incredible. Cloudinary only needed 0.0069 seconds while CloudFront took 1.098 seconds. There’s only one main factor for this and it’s Cloudinary’s insane image compression algorithm which means Cloudinary only has to send 36 KB while CloudFront has to send 703 KB. It’s just not even close. See more analysis in Finding #2.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding SSL handshake&lt;/strong&gt;: honestly not sure why CloudFront took much longer at 0.091 seconds vs 0.056 seconds but the absolute difference is only 0.035 seconds, so it’s a small contributor to the overall delta of nearly 2 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding TCP handshake&lt;/strong&gt;: this is just the same for any connection. So there’s not a big absolute time delta.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding DNS lookup&lt;/strong&gt;: not the biggest factor for the large overall time delta but it’s still worth mentioning because on a relative basis, Cloudinary outperformed by over 100% (0.0494 seconds vs 0.124 seconds). See Finding #1 analysis for why Cloudinary’s DNS lookup is generally much faster than CloudFront.&lt;/p&gt;

&lt;h1&gt;
  
  
  Hot cache measurement and analysis (speed test #1)
&lt;/h1&gt;

&lt;p&gt;This hot cache measurement was the one that really blew my mind.&lt;/p&gt;

&lt;p&gt;Cloudinary smokes Cloudfront, nearly 3x faster (0.133 vs 0.397 seconds).&lt;/p&gt;

&lt;p&gt;Wow! How did Cloudinary do that?&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsakqzhkydekqhmct658.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsakqzhkydekqhmct658.png" alt="Hot cache measurement and analysis"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Reminder: these times are an average of 10 curl calls).&lt;/p&gt;

&lt;p&gt;Looks like all the times are pretty similar except for Data Transfer. In fact, Data Transfer accounts for 0.234 seconds of the overall time difference of 0.263 seconds. Literally about 90%.&lt;/p&gt;

&lt;p&gt;It’s really shocking that CloudFront took so much longer to transfer the file, even in a hot cache state.&lt;/p&gt;

&lt;p&gt;Reason is Cloudinary compressed the original 700 KB file down to 36 KB. That’s nearly a 20x reduction in file size. So no wonder Cloudinary ended up smoking the pants off CloudFront.&lt;/p&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;h1&gt;
  
  
  Warm cache measurement and analysis (speed test #1)
&lt;/h1&gt;

&lt;p&gt;Ouch. CloudFront nearly 4x slower than Cloudinary: 0.465 vs 0.126 seconds.&lt;/p&gt;

&lt;p&gt;What happened??&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2ljmfjbuv5gnogmwxxm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2ljmfjbuv5gnogmwxxm.png" alt="Warm cache measurement and analysis"&gt;&lt;/a&gt;&lt;br&gt;
(reminder: warm cache is download taken exactly 30 minutes after hot cache)&lt;/p&gt;

&lt;p&gt;First off, a monstrous Data Transfer difference: Cloudfront 0.198 seconds vs Cloudinary 0.009 seconds. Absolute difference of 0.19 seconds, contributing to the overall time difference of 0.34 seconds.&lt;/p&gt;

&lt;p&gt;Second, a monstrous DNS lookup difference: Cloudfront 0.115 seconds vs Cloudinary 0.0236 seconds. Absolute difference of 0.09 seconds, contributing to the overall time difference of 0.34 seconds. If you thought DNS lookup speeds don’t matter — well think again. See “Finding #1” for why CloudFront’s DNS lookup is so much slower than Cloudinary.&lt;/p&gt;

&lt;p&gt;Data Transfer and DNS lookup combine for 0.28 seconds out of the 0.34 seconds difference.&lt;/p&gt;

&lt;p&gt;Other notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  As said in Finding #2, CloudFront’s Data Transfer was so much slower because it was transferring ~700 KB of data while Cloudinary was transferring ~36 KB. Cloudinary compressed the image really well.&lt;/li&gt;
&lt;li&gt;  Dang, Cloudinary’s warm cache faster than the hot cache time (0.126 vs 0.133 seconds). That’s impressive.&lt;/li&gt;
&lt;li&gt;  I don’t know why CloudFront’s SSL handshake is always slower than Fastly’s SSL handshake. I’m still thinking about it. (Cloudinary is built on Fastly’s CDN).&lt;/li&gt;
&lt;li&gt;  Yeah, CloudFront’s “Request Latency” was 2x slower. I’ve noticed CloudFront tends to degrade the file from RAM to NVMe or SSD.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Speed Test #1 conclusion and analysis
&lt;/h1&gt;

&lt;p&gt;Cloudinary beat CloudFront in hot cache, cold cache, and warm cache, due mainly to the image automatically compressed to 36 KB and CloudFront still trying to transfer a 720 KB PNG.&lt;/p&gt;

&lt;p&gt;Impressively, the hot cache was a staggering 3x faster: 0.133 vs 0.397 seconds.&lt;/p&gt;

&lt;p&gt;What if we even the odds and make CloudFront and Cloudinary transfer the same file? Surely CloudFront should beat Cloudinary now? It’s not that simple. See the next section for Speed Test #2.&lt;/p&gt;

&lt;p&gt;I re-ran the speed test to make sure CloudFront and Cloudinary were downloading the exact same file. To do this, I just uploaded the Cloudinary 36 KB file to CloudFront CDN.&lt;/p&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Cold cache&lt;/strong&gt;: I guess Cloudinary keeps the file in hot cache for an absurdly long time (this is a good thing for the end-consumer. It does not cost extra money for this feature). it takes a long time for Cloudinary’s cache to turn cold…so I’m skipping this test.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hot cache&lt;/strong&gt;: Cloudinary still slightly faster (12%). Absolute difference is only 0.016 seconds. Not a big deal I guess.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Warm cache&lt;/strong&gt;: after waiting 30 minutes, Cloudinary didn’t degrade the cache at all, while CloudFront faced a 2x slow down.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Cold cache measurement and analysis (speed test #2)
&lt;/h1&gt;

&lt;p&gt;So….I found out Cloudinary doesn’t really have a cold cache? Even if I try running the test a few days after my last fetch…it is still pretty much the exact same as the hot cache result….&lt;/p&gt;

&lt;p&gt;For example, I ran the Cloudinary test again, and I noticed the cold cache was only 0.02 seconds slower than the hot cache…nearly all of which was in the DNS lookup.&lt;/p&gt;

&lt;p&gt;The coldest I’ve ever seen Cloudinary was when I waited a couple weeks to test Cloudinary. If you test only a few days after, it is pretty much the same as hot cache.&lt;/p&gt;

&lt;p&gt;This is actually a good thing for the consumer. It means Cloudinary doesn’t degrade the file down to cold cache until a couple weeks. It is kind of incredible.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrm2ezzg1uf7nku9idta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrm2ezzg1uf7nku9idta.png" alt="Cold cache measurement and analysis"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m not going to bother writing much of an analysis for this.&lt;/p&gt;

&lt;p&gt;Cloudinary’s cold cache is pretty much as fast as the hot cache, with the only difference of the DNS lookup (was not cached by intermediate routers).&lt;/p&gt;

&lt;p&gt;CloudFront’s cold cache is just the same as last time except for significantly faster Data Transfer phase since we are making CloudFront download 36 KB.&lt;/p&gt;

&lt;h1&gt;
  
  
  Hot cache measurement and analysis (speed test #2)
&lt;/h1&gt;

&lt;p&gt;Much closer where we can say that perhaps CloudFront is as fast as Cloudinary. Cloudinary holds a slight 12% faster time.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h1dh5lzwad1l4w5pmtl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h1dh5lzwad1l4w5pmtl.png" alt="Hot cache measurement and analysis"&gt;&lt;/a&gt;&lt;br&gt;
Cloudinary still 12% faster than CloudFront. Although the absolute difference is only 0.016 seconds so perhaps not a big deal.&lt;/p&gt;

&lt;p&gt;DNS lookup, TCP handshake, SSL handshake, Data Transfer were all pretty close (these are the same operations for any file size or type).&lt;/p&gt;

&lt;p&gt;The main difference of 0.010 seconds comes from Request Latency, where CloudFront takes 50% long (0.030 vs 0.20 seconds). Honestly not sure but perhaps Cloudinary has a more efficient file cache read than CloudFront. Cloudinary is built on Fastly, which has significant market share among enterprise companies.&lt;/p&gt;

&lt;p&gt;So Cloudinary is faster, but it’s not really worth stressing about it at this point. The difference is small enough.&lt;/p&gt;

&lt;h1&gt;
  
  
  Warm cache measurement and analysis (speed test #2)
&lt;/h1&gt;

&lt;p&gt;Same thing that happened in &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs AWS CloudFront&lt;/a&gt;. CloudFront warm cache degraded significantly (relative to hot cache) — 2x slower (0.25 seconds vs 0.126 seconds). Cloudinary warm cache pretty much the same as hot cache.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsy4gbki8rlfjrpq27ik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsy4gbki8rlfjrpq27ik.png" alt="Warm cache measurement and analysis"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Regarding Request Latency&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;: the big rock was Request Latency: 0.076 vs 0.0168 seconds. Cloudinary’s Request Latency was the same in both hot and warm cache, so Cloudinary must be keeping the file in RAM. CloudFront definitely downgraded the file from RAM down to disk. This is very consistent behavior that I’ve seen in the&lt;/em&gt; &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;&lt;em&gt;Jetpack CDN vs Cloudfront&lt;/em&gt;&lt;/a&gt; &lt;em&gt;comparison as well.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;(reminder: warm cache is download taken exactly 30 minutes after hot cache)&lt;/p&gt;

&lt;p&gt;CloudFront’s speed performance is once again significantly slower as found when I was doing &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/" rel="noopener noreferrer"&gt;Jetpack CDN vs CloudFront&lt;/a&gt;. Cloudfront’s slowdown came in 3 areas: DNS lookup, SSL handshake, and Request Latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding DNS lookup&lt;/strong&gt;: Cloudfront is slower here because the DNS name d20zaq59cm4c4j.cloudfront.net is entirely unique to my account so it is even more unlikely to be cached in routers than the Cloudinary DNS name res.cloudinary.com (which appears to be shared with multiple users).&lt;/p&gt;

&lt;p&gt;Interestingly, Cloudinary’s DNS lookup was significantly slower when going from the hot cache to the warm cache (0.035 seconds vs 0.0016 seconds).&lt;/p&gt;

&lt;p&gt;Another interesting point is Jetpack CDN’s DNS lookup was only 0.0092 seconds. This happened because the Jetpack CDN DNS name i0.wp.com is heavily used across millions of wordpress installations and Cloudinary has significantly smaller install base, so the Jetpack’s DNS name is way more likely than Cloudinary to be cached in routers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regarding SSL handshake&lt;/strong&gt;: it is really unusual that Cloudfront’s SSL handshake takes nearly 2x as long as Cloudinary (0.084 vs 0.045 seconds), because the TCP handshake occurred with equal speed on both CDNs, which indicates the problem is &lt;em&gt;not&lt;/em&gt; the internet speed. There’s 2 possibilities: 1) for some reason the certificate authority is taking a long time to respond, and 2) the CloudFront is serving the traffic from a cheap CPU server so the SSL calculations are taking much longer?&lt;/p&gt;

&lt;p&gt;I guess possibility #2 is more likely. Still weird.&lt;/p&gt;

&lt;p&gt;My thoughts on this are extremely mixed. I would say it highly depends on your circumstances whether you should use Cloudinary.&lt;/p&gt;

&lt;h1&gt;
  
  
  Reasons to use Cloudinary
&lt;/h1&gt;

&lt;p&gt;Cloudinary is a highly performant CDN built on top of Fastly CDN, very widely used among tech companies such as Reddit and even Amazon itself (which is weird because Amazon has its own CDN called CloudFront…).&lt;/p&gt;

&lt;p&gt;Cloudinary has some very impressive image compression capabilities. The 700 KB test image was compressed down to 36 KB. It’s possible to do the same thing in CloudFront…but it’s more involved. You’d need a WordPress plugin that was as good at compressing images. Actually Jetpack CDN was already compressing, but only down to 216 KB. Again, really impressive stuff from Cloudinary. I guess nobody is compressing the image that well…(…yet. I will probably build this WordPress plugin).&lt;/p&gt;

&lt;p&gt;Cloudinary keeps files in a hot cache state for weeks (much longer than CloudFront which degrades the file in less than 30 minutes).&lt;/p&gt;

&lt;p&gt;Cloudinary also boasts video CDN delivery. I have not tested using videos so I can’t make an evaluation here. Although…it’s likely the video CDN performs as well as the image CDN, although we still need to test it.&lt;/p&gt;

&lt;p&gt;Even in the scenario that CloudFront is delivery the same compressed file as Cloudinary, I’m seeing Cloudinary (i.e. Fastly) is performing better on cold, hot, and warm cache.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  12% faster on hot cache&lt;/li&gt;
&lt;li&gt;  2x faster on warm cache&lt;/li&gt;
&lt;li&gt;  Cloudinary’s cold cache is a couple weeks, not 30 minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So…Cloudinary has been extremely impressive indeed.&lt;/p&gt;

&lt;h1&gt;
  
  
  Reasons not to use Cloudinary
&lt;/h1&gt;

&lt;p&gt;However, the free tier is extremely limited to only 25 GB/month of data transfer, while the premium tier is very expensive (starting at $99/month). Cloudinary is by far the most expensive CDN I’ve tested so far. To put the $99/month in perspective: CloudFront only charges $0.08/GB, and Cloudinary has a free tier of 25 GB and premium tier of 225 GB. Run the numbers: 1) for the free tier, CloudFront would cost only 25 GB * $0.08/GB = $2.00. 2) for the premium tier, it’s 225 GB * 0.08/GB = $18. And…Cloudinary’s charging $99/month? Wow.&lt;/p&gt;

&lt;p&gt;On the plus side, if you’ve got a low or medium traffic website and you’re sure you’re transferring less than 25 GB a month…by all means go for Cloudinary. Since you’re staying in the free tier.&lt;/p&gt;

&lt;p&gt;Another limitation is you can’t host a static HTML page on Cloudinary like you can with CloudFront and CNAME Aliases. You can host static assets like CSS, JS, images, and videos…but not HTML. For example, this entire blog is hosted off CloudFront, even the initial HTML request. I can’t do that with Cloudinary…just offload the images/videos/CSS/JS, that’s it.&lt;/p&gt;

&lt;p&gt;As an aside: there’s a good reason why Cloudinary is so expensive…it is built on top of Fastly CDN. Cloudinary’s primary value-add are image and video transformations. And Fastly is already fairly expensive (minimum $50/month).&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Analysis: to use or not use Cloudinary?
&lt;/h1&gt;

&lt;p&gt;In the final analysis, what you’re paying Cloudinary for are the “on-the-fly” image and video transformations. Cloudinary contains some bells and whistles that makes it a powerful image &amp;amp; video CDN. Is this worth $99/month to you? i.e. $1188/year.&lt;/p&gt;

&lt;p&gt;Also remember Cloudinary is basically a reseller of the Fastly CDN. Cloudinary’s primary value-add is in the image and video transformations. Are you the kind of person or business that needs Cloudinary’s advanced features? It costs $99/month…&lt;/p&gt;

&lt;p&gt;What kind of person or business are you?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Hobby blog&lt;/strong&gt;: since you’re probably a low-traffic site, you could easily stay within Cloudinary’s free tier of 25 GB.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;High traffic blog&lt;/strong&gt;: in my opinion, you can easily compress the images yourself to get it as good as Cloudinary. Then for fast delivery, either use Fastly directly or use CloudFront. Since using Cloudinary would simply be using Fastly &lt;em&gt;indirectly&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Your website earns $1000/month&lt;/strong&gt;: well $99/month is 10% of your profits. Not really worth it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Software engineer building complex app&lt;/strong&gt;: Cloudinary has some complex image transformations like cartoonify, brightness, rotate. That’s neat. Using Cloudinary as a REST API could save you some time (and developer time is always the most expensive).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/" rel="noopener noreferrer"&gt;Python CDN Speed Test Script&lt;/a&gt;: I use this to automate the collection of metrics about CDNs.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;APPENDIX: Wanna reproduce our test results? Here’s how to setup Cloudinary&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;  Login or Sign up in &lt;a href="https://cloudinary.com/" rel="noopener noreferrer"&gt;Cloudinary&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Install&lt;/strong&gt; and &lt;strong&gt;Activate&lt;/strong&gt; Cloudinary Plugin in WordPress
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxpcvasrumver1k2nttw.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw9vszdnedm0d7pdf0t2.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8hejco0xsym0cj86iaig.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuy3rpjvjl9ggvuf133s.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9xej570ddhkp7apc3f2.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0ke68h2itp2j8985de1.png" alt="Alt Text"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4euwu903nygjjejacbaj.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloudinary</category>
      <category>cloudfront</category>
      <category>aws</category>
      <category>amazon</category>
    </item>
    <item>
      <title>CDN experiment shows Free CDN surprisingly faster than Amazon CloudFront in many cases (case study…</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Thu, 01 Jul 2021 06:20:24 +0000</pubDate>
      <link>https://dev.to/productivityhacks/cdn-experiment-shows-free-cdn-surprisingly-faster-than-amazon-cloudfront-in-many-cases-case-study-nf8</link>
      <guid>https://dev.to/productivityhacks/cdn-experiment-shows-free-cdn-surprisingly-faster-than-amazon-cloudfront-in-many-cases-case-study-nf8</guid>
      <description>&lt;p&gt;&lt;em&gt;(Note: I’m not affiliated with Jetpack CDN in anyway. And if you disagree with my analysis in any way, please cordially do so 😊. I’m on twitter at&lt;/em&gt; &lt;a href="https://twitter.com/SpeedTestDemon"&gt;&lt;em&gt;@SpeedTestDemon&lt;/em&gt;&lt;/a&gt;&lt;em&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ohh…so premium CDNs are NOT always faster than free CDNs. While testing many free CDNs and whether they performed better than a premium CDN like CloudFront, I discovered many free CDNs performing faster than Amazon CloudFront. One was Cloudinary, the other is WordPress’s Jetpack CDN. Cloudflare is starting to look good too. In this article, I go over my CDN experiment showing how Jetpack CDN was faster than Amazon CloudFront in nearly every case except for one.&lt;/p&gt;

&lt;p&gt;Before I present the simplified summary, here are some links relevant to this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;My testing approach to CDNs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;Python script for measuring CDNs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;On twitter, &lt;a href="https://twitter.com/SpeedTestDemon"&gt;I tweet analysis about software performance&lt;/a&gt; or &lt;a href="https://speedtestdemon.com/"&gt;email list&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;As a very simplified summary&lt;/strong&gt; , based only on hot cache results&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Jetpack CDN was faster than CloudFront by 25% (0.332 vs 0.245 seconds, or difference of 87 milliseconds)&lt;/li&gt;
&lt;li&gt;Even after controlling for image size, CloudFront was only faster by 6% (0.199 vs 0.214 seconds, or difference of only 15 milliseconds). Basically within margin of error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Jetpack CDN had better performance for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nice trick of compressing images 2–3x smaller (~700 KB image to ~236 KB).&lt;/li&gt;
&lt;li&gt;Much more common DNS (i0.wp.com vs d20zaq59cm4c4j.cloudfront.net), which allows for significantly faster DNS lookup. In one case, 0.11 vs 0.008 seconds.&lt;/li&gt;
&lt;li&gt;CloudFront typically degrades a file from hot cache to warm cache very rapidly, whereas Jetpack CDN doesn’t do this until at least several days.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What follows is a much more detailed technical analysis.&lt;/p&gt;

&lt;p&gt;I had to do 2 speed tests. The 1st speed test was not apples-to-apples because Jetpack CDN surprisingly compressed the image, leading to a crushing result. The 2nd speed test, I controlled for file size, and CloudFront came out ahead very slightly by 6%.&lt;/p&gt;

&lt;p&gt;In the first speed test, Jetpack CDN surprisingly crushed CloudFront.&lt;/p&gt;

&lt;p&gt;I was shocked. I investigated and found out &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_3_Jetpack_CDN_had_a_surprisingly_strong_image_compression_algorithm"&gt;Jetpack CDN magically compressed the ~700 KB image down to ~219 KB&lt;/a&gt;. Well…that explains a lot.&lt;/p&gt;

&lt;p&gt;I had to do a second speed test making sure CloudFront was delivering the same image as Jetpack CDN. CloudFront did a lot better in the hot cache. Still sucked at the other two metrics.&lt;/p&gt;

&lt;p&gt;There were several reasons for Jetpack CDN performing so well:&lt;/p&gt;

&lt;p&gt;Now one moment…you &lt;em&gt;do&lt;/em&gt; “get what you pay for”…while this free Jetpack CDN has great performance, it is limited in many other ways. You can’t host videos. You can’t host a whole website off Jetpack CDN (while this blog itself is entirely CloudFront). You can’t update a file on Jetpack CDN easily, unless you wholesale rename the file (very annoying). The amazing performance applies mainly to images. JS and CSS won’t have the same amazing image compression, although you &lt;em&gt;will&lt;/em&gt; see Jetpack CDN perform on par with CloudFront. See the conclusion for my thoughts on the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Which_CDN_is_better_Jetpack_CDN_aka_Photon_CDN_or_Cloudfront"&gt;Jetpack CDN vs CloudFront decision&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It should be noted that &lt;em&gt;not&lt;/em&gt; every free CDN performs as well as Jetpack CDN. I found 2 free CDNs that performed really poorly.&lt;/p&gt;

&lt;p&gt;By the way, I’ve been blogging a series of experiments on free CDNs and comparing them against CloudFront. You can get updates by following me on &lt;a href="https://twitter.com/SpeedTestDemon"&gt;twitter SpeedTestDemon&lt;/a&gt;, or via &lt;a href="https://speedtestdemon.com/"&gt;email list&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is it interesting to test Jetpack CDN (previously known as Photon CDN)?
&lt;/h3&gt;

&lt;p&gt;Because it’s an extremely popular CDN with millions of users. It was able to get so many users due to it being a first-class feature in WordPress’s Jetpack, which itself has 5 million users. If you’ve got Jetpack, it is basically 1 click to enable Jetpack CDN, and all your blog’s images get served from the Jetpack CDN.&lt;/p&gt;

&lt;p&gt;And not to mention free! Jetpack CDN is a free CDN. So for that reason, it’s popular.&lt;/p&gt;

&lt;p&gt;It used to be called Photon CDN before they did a name change.&lt;/p&gt;

&lt;p&gt;But how “good” is free? Is it as good as a CDN you have to pay for, like Amazon’s CloudFront?&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use CloudFront as the gold standard in CDN speed tests?
&lt;/h3&gt;

&lt;p&gt;Well Amazon AWS is in general the gold standard for anything in the cloud. Amazon AWS has the largest market share for cloud providers (32% with Azure at 19%). They were the first to market with cloud services, and they’ve had many years to develop CloudFront into a top-of-the-line service.&lt;/p&gt;

&lt;p&gt;AWS CloudFront has a generous free tier as well, along with only $0.08 / GB network-out. If you’re a normal website, you might incur a total aggregate cost of $0.50/month (which is nothing).&lt;/p&gt;

&lt;h3&gt;
  
  
  Brief Summary Of The Metrics Being Measured
&lt;/h3&gt;

&lt;p&gt;It’s not as simple as running a curl on the same file from the two CDNs. Most simplistically: CDNs are just a caching layer. And there are 3 states that a cache can be in: cold cache, hot cache, and warm cache. We are going to measure all 3 (because we have it automated so why not).&lt;/p&gt;

&lt;p&gt;If you are interested, you can read this much more detailed article about my &lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;CDN speed testing methodology&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you’re interested in trying to replicate our results, see the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#APPENDIX_Wanna_reproduce_our_test_results_Heres_how_we_set_up_CloudFront_and_Jetpack_CDN"&gt;Appendix&lt;/a&gt; where we discuss the exact steps we took.&lt;/p&gt;

&lt;p&gt;I didn’t expect any of this when I first started. There is actually quite a bit of nuance when analyzing the curl measurements between Jetpack CDN and CloudFront.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding #1: Jetpack CDN’s DNS lookup is significantly faster than CloudFront’s DNS lookup.
&lt;/h3&gt;

&lt;p&gt;To those new to measuring request latency, DNS is actually a VERY important detail that can seem minor. While DNS is normally very fast because it’s usually cached…if your DNS lookup is on a low-trafficked website, it’s highly unlikely to be cached in most routers.&lt;/p&gt;

&lt;p&gt;This analysis was done off of &lt;a href="http://Warm_cache_measurement_and_analysis_speed_test_2"&gt;speed test #2’s warm cache test&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I can only speculate why CloudFront took a whole 0.111 seconds compared to Jetpack CDN’s almost imperceptible 0.005 seconds. Compare these two DNS lookups: CloudFront “d20zaq59cm4c4j.cloudfront.net” and Jetpack CDN “i0.wp.com”. Jetpack CDN’s i0.wp.com looks like a shared domain that many other people are also using (there’s millions of JetPack users). Which means that it’s likely that nearby routers will have that DNS lookup cached. Unlike Jetpack CDN, CloudFront’s domain is highly unique and customized to this test instance. It’s highly unlikely nearby routers will have the DNS lookup cached, resulting in a significantly longer DNS lookup.&lt;/p&gt;

&lt;p&gt;As you can see, it’s fairly interesting that there are indeed cases where DNS lookups can take a very significant part of the time (0.111 seconds out of 0.445 seconds is nearly 25%!). So don’t discount DNS lookups in your measurement times.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding #2: Generally, the Data Transfer, TCP handshake and SSL handshake times were the same between CloudFront and Jetpack CDN
&lt;/h3&gt;

&lt;p&gt;In general, I found the “generic metrics” speeds were usually almost the same between CloudFront and Jetpack CDN. Probably because these operations “Data Transfer”, “SSL handshake”, “TCP handshake” are the same for every file regardless of file size or file types, no matter if you’re requesting a 10 GB video or just a 10 KB HTML file. I have an essay explaining what each of these metrics mean if you’re interested in learning more: &lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;guide to curl metrics&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The only time the “Data Transfer” was different was when Jetpack CDN compressed the image to a 2x lower size than CloudFront (see Finding #3).&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding #3: Jetpack CDN had a surprisingly strong image compression algorithm
&lt;/h3&gt;

&lt;p&gt;I found that uploading a 703 KB image was compressed to 219 KB on WordPress’s image CDN, while CloudFront compressed it to only around 300–400 KB.&lt;/p&gt;

&lt;p&gt;The bottom line is Jetpack CDN is able to have 2x to 3x faster Data Transfer times than CloudFront. Remember Data Transfer time is specifically regarding how long the download takes (once TCP, SSL, and server is prepared to start sending bytes).&lt;/p&gt;

&lt;p&gt;This is quite impressive. You’ll see Finding #3 referenced several times during analysis of Speed Test #1 when I didn’t account for this factor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding #4: Jetpack CDN’s warm cache times were significantly stronger than CloudFront’s warm cache.
&lt;/h3&gt;

&lt;p&gt;This analysis was done off of &lt;a href="http://Warm_cache_measurement_and_analysis_speed_test_2"&gt;speed test #2’s warm cache test&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Impressively, Jetpack CDN’s warm cache time was nearly the same as its hot cache time. This indicates that Jetpack CDN keeps the image in RAM for quite a long time. That’s good! For the user, that is, because it’s a faster response time. This is going to be more expensive for Jetpack CDN because RAM is the most expensive hardware resource by far (way more than SSD).&lt;/p&gt;

&lt;p&gt;CloudFront on the other hand…was nearly 2x slower than its hot cache time. Taking a closer look at where exactly CloudFront lost so much time, it was in two metrics: “Request Latency” and “DNS lookup”. With regards to “Request Latency” (0.135 seconds compared to 0.020 seconds), it seems clear that CloudFront degrades its hot cache rather quickly, where the image file probably got shunted over to NVMe or SSD. Well Amazon has a reputation among software engineers for being cheap ;), we really should not be surprised they are trying to save on hardware costs where they think they can get away with it.&lt;/p&gt;

&lt;p&gt;CloudFront beats out Jetpack CDN when it comes to the cold cache test. However for the 2nd download, Jetpack CDN is slightly faster (5%) than CloudFront.&lt;/p&gt;

&lt;p&gt;When we did the measurement again a couple other times, Jetpack CDN was beating out CloudFront handily on cached downloads. Sometimes it was 2x, sometimes 3x.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cold cache measurement and analysis (speed test #1)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WNYO4DEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlARUGKT3oFbAncGsZ8LXRg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WNYO4DEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlARUGKT3oFbAncGsZ8LXRg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CloudFront is 10% slower than Jetpack CDN for a new file.&lt;/p&gt;

&lt;p&gt;Note: I am aware there is no “Data Transfer” row. I had a mistake with this test run where I accidentally made curl not download the file. CloudFront’s Data Transfer is probably going to be slower than Jetpack CDN’s Data Transfer (see later sections). I don’t need to belabor this point.&lt;/p&gt;

&lt;p&gt;Yeah, CloudFront is 8% slower than Jetpack CDN for cold caches. I’m not really entirely certain why. The main deltas were in DNS lookup and SSL handshake.&lt;/p&gt;

&lt;p&gt;The DNS lookup delta (0.048 vs 0.002 seconds) might surprise some people who think DNS lookups are normally always very fast. No they are not always fast. The big exceptions are low-trafficked DNS names ( &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_1_Jetpack_CDNs_DNS_lookup_is_significantly_faster_than_CloudFronts_DNS_lookup"&gt;see more analysis in “finding #1”&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I’m really not certain why CloudFront took so much longer in SSL handshake. It’s kind of out of left-field, and perhaps is just randomness.&lt;/p&gt;

&lt;p&gt;Request Latency was the same for both CloudFront and Jetpack CDN. That’s good news because I would expect both CDNs to take the same amount of time for a file that’s not in cache at all. For some reason, re-running the cold cache test in “speed test #2” showed CloudFront much slower than Jetpack CDN in “Request Latency”.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hot cache measurement and analysis (speed test #1)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WDUCTMI5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8kdEkSzR-Pek0MQWO-dt7Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WDUCTMI5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8kdEkSzR-Pek0MQWO-dt7Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jetpack CDN is 25% faster than CloudFront! (0.332 vs 0.256 seconds)&lt;/p&gt;

&lt;p&gt;(Reminder: these times are an average of 10 curl calls).&lt;/p&gt;

&lt;p&gt;Where did Jetpack CDN save so much time?&lt;/p&gt;

&lt;p&gt;We can see CloudFront is neck-and-neck with Jetpack CDN for most of the metrics except for “Data Transfer” which is the download time. This makes sense as CloudFront is trying to send a 703 KB file while Jetpack CDN is only around ~250 KB. See analysis in section “Finding #3”.&lt;/p&gt;

&lt;p&gt;And Data Transfer was literally the only difference.&lt;/p&gt;

&lt;p&gt;What’s even more impressive is you could argue the “hot cache” times is one of the most important metrics for a CDN. If your site has a moderate amount of traffic, chances are pretty good the CDN will be in a hot cache state.&lt;/p&gt;

&lt;p&gt;So Jetpack CDN’s hot cache time is 25% better than CloudFront. Very impressive work from Automattic, the company behind WordPress!&lt;/p&gt;

&lt;p&gt;To even out the odds between Jetpack CDN and CloudFront, we will be conducting a second speed test. You can jump down to the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Speed_Test_2_CloudFront_performance_improved_but_not_clear_winner_over_Jetpack_CDN"&gt;second speed test section&lt;/a&gt; later on in the article.&lt;/p&gt;

&lt;h3&gt;
  
  
  Warm cache measurement (speed test #1)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GxVkKvFB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Atqj7nZcejajAvezHtnwXpw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GxVkKvFB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Atqj7nZcejajAvezHtnwXpw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jetpack CDN is nearly 2x faster than CloudFront.&lt;/p&gt;

&lt;p&gt;Reminder: the warm cache is a measurement time taken 30 minutes after the hot cache time.&lt;/p&gt;

&lt;p&gt;You should also see the 2nd speed test’s warm cache analysis, which differs slightly from the 1st speed test’s warm cache analysis.&lt;/p&gt;

&lt;p&gt;TCP handshake, SSL handshake were the same. See &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_2_Generally_the_Data_Transfer_TCP_handshake_and_SSL_handshake_times_were_the_same_between_CloudFront_and_Jetpack_CDN"&gt;analysis in section “Finding #2”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Request Latency was also nearly the same. This differs from the 2nd speed test where I’m seeing CloudFront’s Request Latency spike for some reason. At any rate, it makes sense Request Latency should be the same as both CDNs probably have the file in RAM and that’s pretty much the best you can do, no matter who you are.&lt;/p&gt;

&lt;p&gt;The big difference in time went to “Data Transfer” where Jetpack CDN was…nearly 3x faster than CloudFront? 0.089 seconds vs 0.228 seconds. Already touched on this earlier. Jetpack CDN did a great job of compressing the image down to around 219 KB while CloudFront is still trying to transfer ~700 KB image. See &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_3_Jetpack_CDN_had_a_surprisingly_strong_image_compression_algorithm"&gt;analysis in section “Finding #3”&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Speed Test #1 conclusion and analysis
&lt;/h3&gt;

&lt;p&gt;Jetpack CDN beat out CloudFront in hot cache, cold cache, and warm cache, due mainly to the image automatically compressed to 219 KB and CloudFront still trying to transfer a 720 KB PNG.&lt;/p&gt;

&lt;p&gt;What if we even the odds and make CloudFront and Jetpack CDN transfer the same file? Surely CloudFront should beat out Jetpack CDN now? It’s not that simple. See the next section for Speed Test #2.&lt;/p&gt;

&lt;p&gt;In brief: CloudFront’s Data Transfer metric improved to be on par with Jetpack CDN. This was expected because CloudFront and Jetpack CDN are now transferring the same file (previously, was transferring ~700 KB compared to ~200 KB image).&lt;/p&gt;

&lt;p&gt;CloudFront’s Hot Cache times also improved from -25% to +7% speed over Jetpack CDN (due to improved Data Transfer).&lt;/p&gt;

&lt;p&gt;However, CloudFront’s Cold Cache and Warm Cache still lags behind Jetpack CDN. Impressively, Jetpack CDN is still 2x faster in warm cache time, due to DNS lookup and Request Latency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cold cache measurement (speed test #2)
&lt;/h3&gt;

&lt;p&gt;Seems Cloudfront is still slower than Jetpack CDN when downloading a new file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xkhfoRh0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Aq6Lfn4b8lnVzFOjGXieWYQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xkhfoRh0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Aq6Lfn4b8lnVzFOjGXieWYQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: I am aware there is no “Data Transfer” row. I had a mistake with this test run where I accidentally made curl not download the file. In my opinion, not worth re-running the test since I don’t expect Data Transfer numbers to be extremely different.&lt;/p&gt;

&lt;p&gt;It’s interesting…I had run the cold cache test a few times and CloudFront is still slower than Jetpack CDN for new files. Even after ensuring the images downloaded the same size. That’s unfortunate.&lt;/p&gt;

&lt;p&gt;The main reason for the large time discrepancy was in Request Latency — all the other metrics were close enough (except for DNS lookup — see &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_2_Generally_the_Data_Transfer_TCP_handshake_and_SSL_handshake_times_were_the_same_between_CloudFront_and_Jetpack_CDN"&gt;finding #2 section&lt;/a&gt;). I honestly have no clue why CloudFront should take much longer (about 50%) than Jetpack CDN for fetching the image from the origin server — the images are the same size in both cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hot cache measurement and analysis (speed test #2)
&lt;/h3&gt;

&lt;p&gt;CloudFront and Jetpack CDN neck-to-neck in almost all the individual metrics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8vyX6Q3q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AaUOoq0mgGBuepW7grXfDyA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8vyX6Q3q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AaUOoq0mgGBuepW7grXfDyA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Reminder: these times are an average of 10 curl calls). CloudFront beats out Jetpack CDN by 7%. Oh good, so the premium CDN is finally outperforming the free CDN. But in absolute difference, only about 16 milliseconds.&lt;/p&gt;

&lt;p&gt;Every single metric here shows CloudFront and Jetpack CDN spending approximately the same time. Some metrics CloudFront was faster, and vice versa for some other metrics. CloudFront just ended up edging out overall. The relative difference was only 7%, not much of a big deal. And possibly within margin of error.&lt;/p&gt;

&lt;p&gt;See “ &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_2_Generally_the_Data_Transfer_TCP_handshake_and_SSL_handshake_times_were_the_same_between_CloudFront_and_Jetpack_CDN"&gt;Finding #2&lt;/a&gt; “ explaining why “Data Transfer”, “TCP handshake”, and “SSL handshake” times were similar between CloudFront and Jetpack CDN.&lt;/p&gt;

&lt;h3&gt;
  
  
  Warm cache measurement and analysis (speed test #2)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CA2opQlj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Aej_PGxoj9X6O64XdHtPbDw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CA2opQlj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Aej_PGxoj9X6O64XdHtPbDw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reminder: the warm cache is a measurement time taken 30 minutes after the hot cache time.&lt;/p&gt;

&lt;p&gt;This was an extremely interesting test. Jetpack CDN is 2x faster than CloudFront. That’s not a small difference. How? Where did the time go?&lt;/p&gt;

&lt;p&gt;The first interesting bit was that Jetpack CDN DNS lookup was way faster than CloudFront. In fact, CloudFront’s 0.111 seconds is nearly 25% of the overall time of 0.445 seconds. There’s a good reason why Jetpack CDN’s DNS lookup was way faster: see &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_1_Jetpack_CDNs_DNS_lookup_is_significantly_faster_than_CloudFronts_DNS_lookup"&gt;analysis in “Finding #1”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Secondly, CloudFront’s Request Latency was way longer at 0.135 seconds compared to 0.020 seconds. I write about this in the &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/#Finding_4_Jetpack_CDNs_warm_cache_times_were_significantly_stronger_than_CloudFronts_warm_cache"&gt;analysis for “Finding #4”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The rest of the metrics did not make much difference in absolute time. Yes CloudFront was “2x faster” TCP handshake (0.025 vs 0.052 seconds) but the absolute difference is only 0.027 seconds. The bigger rocks were in DNS lookup and Request Latency.&lt;/p&gt;

&lt;p&gt;TL;DR — Jetpack CDN holds files in hot cache for longer than CloudFront. Evidence is Jetpack CDN’s warm cache is nearly the same as its hot cache time. CloudFront degraded about 2x due to slow non-cached DNS lookup and likely non-cached at the point of presence.&lt;/p&gt;

&lt;p&gt;My initial stance going into this was CloudFront was going to be the outright winner (even after accounting for cost). As it turns out, Jetpack CDN has acquitted itself remarkably well. Based purely on the performance benchmark, I’ve come to the conclusion that Jetpack CDN is better than CloudFront (and yes, Jetpack CDN is free).&lt;/p&gt;

&lt;p&gt;There two main scenarios for evaluation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Jetpack CDN compresses image better (i.e. smaller) than Cloudfront,&lt;/li&gt;
&lt;li&gt;Cloudfront and Jetpack CDN deliver the same image.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In scenario 1: Jetpack CDN is significantly faster than CloudFront for cold, hot, and warm cache. Even for the hot cache case, Jetpack CDN was 25% faster.&lt;/p&gt;

&lt;p&gt;In scenario 2: Jetpack CDN maintains a significant edge over CloudFront in cold and warm cache times (50–100%), while CloudFront has a slight edge in hot cache times (6%).&lt;/p&gt;

&lt;p&gt;Summary of Jetpack CDN’s superiority over CloudFront:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;image_downsizing&lt;/em&gt; feature works well. It shrunk a 721 KB image to 225 KB. This basically doubles or triples Jetpack CDN’s download speed. This is a big advantage.&lt;/li&gt;
&lt;li&gt;Jetpack CDN keeps images in hot cache for significantly longer than CloudFront. At one point I even tested Jetpack CDN a full day after the hot cache test, and it was still nearly as quick as hot cache. I know it’s still cached because I’m getting back this header “x-nc: HIT dfw 6” from Jetpack CDN. The warm cache is some fairly impressive stuff from Jetpack CDN.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Extraordinarily simple to set up on a wordpress instance. Basically 1-click install from the Jetpack plugin (which itself has millions of installs).&lt;/p&gt;

&lt;p&gt;If you’ve ever used CloudFront, you’d know it is very confusing. Take a look at this screenshot, it’s dizzying. Even for a software engineer like me, I had a moment of confusion and minor agony when staring down the options (I thought: Why isn’t it simpler?).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UcVlKRPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/592/0%2Ac-tkvw3E5NTBhTYe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UcVlKRPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/592/0%2Ac-tkvw3E5NTBhTYe.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There &lt;em&gt;are&lt;/em&gt; good reasons to use another CDN besides Jetpack CDN despite its great performance, cost, and ease of use. The main thing is that Jetpack CDN is fairly limited. For one thing, Jetpack CDN can only do images, JS, and CSS…yeah that’s fairly limited lol. If your website is totally static, you should put HTML on Jetpack CDN too. And also videos and audio if you’ve got them.&lt;/p&gt;

&lt;p&gt;Here’s a full list of (important) Jetpack CDN limitations. There are other minor limitations but I don’t deem them important.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doesn’t serve video or audio&lt;/li&gt;
&lt;li&gt;Doesn’t serve HTML.&lt;/li&gt;
&lt;li&gt;No cache invalidations — this means it’s much more annoying to update an image. You need to rename the image in order to force CDN to load the new image.&lt;/li&gt;
&lt;li&gt;Limited to WordPress instances. Need Jetpack installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So at the time of writing I would recommend Jetpack CDN if: 1) you’re using wordpress, 2) for images only. You still need to get a CDN like CloudFront to handle all the other stuff like HTML, video, and audio. Things may change in the future that may change my mind, such as Jetpack CDN’s warm cache times.&lt;/p&gt;

&lt;p&gt;In general though I would recommend getting a premium CDN. See my analysis here on why a &lt;a href="https://speedtestdemon.com/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn/"&gt;premium CDN is worth it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This section is specifically for Jetpack CDN and CloudFront. Here is the article about my &lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;general testing methodology&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We used a python script that used cURL. We used cURL because of its ability to be flexible and complete complex tasks. You can use curl for things like user authentication, HTTP post, SSL connections, proxy support, and FTP uploads. You can also do simple things with curl, such as download web pages and web images, which we used cURL for in this scenario.&lt;/p&gt;

&lt;p&gt;Tests are conducted on a Macbook Air 13" 2020 using macOS Catalina v. 10.15.7. This uses an Dual-Core Intel Core i3 processor clocked at 1.1 GHz alongside 8 GB 3733 MHz LPDDR4X RAM and an SSD.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZYWa_42W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A5TiY9gG3-SI0E4po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZYWa_42W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A5TiY9gG3-SI0E4po.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c-EmfgQx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AJJjFR_fly9fsuGLL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c-EmfgQx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AJJjFR_fly9fsuGLL.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TASuSNxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AYG3367w_2JTNpTmm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TASuSNxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AYG3367w_2JTNpTmm.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UWh3xg1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AqIQKYuqmRBSCQj9N.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UWh3xg1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AqIQKYuqmRBSCQj9N.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating python file “test.py”&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clone this repository. Free speed test!
git clone &lt;a href="https://github.com/speedtestdemon/speed-tests.git"&gt;https://github.com/speedtestdemon/speed-tests.git&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;cd speed-tests&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install pycurl
pip3 install pycurl&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;If you encountered an error, try first
sudo apt install libcurl4-openssl-dev libssl-dev&lt;/li&gt;
&lt;li&gt;Then run pip3 install pycurl again&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Now that installation is complete, try to run speed test&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;python3 test.py "&lt;a href="https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024x576.png"&gt;https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024x576.png&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup and Testing — Cloudfront&lt;/strong&gt;  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a distribution in CloudFront&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iKl8_fbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AqqSrgHmJCfQjPvMY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iKl8_fbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AqqSrgHmJCfQjPvMY.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jePN1wWi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AGD40FiNVUGyAlRUV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jePN1wWi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AGD40FiNVUGyAlRUV.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a behavior with a Path pattern “/wp-content/”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JuCEp-Ra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ApFnBFBchLq3r-_nm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JuCEp-Ra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ApFnBFBchLq3r-_nm.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install CDN Enabler plugin on WordPress&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the Settings of CDN Enabler, input the &lt;strong&gt;Domain Name&lt;/strong&gt; provided by CloudFront from the setup above&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--USskY5LJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A_cFomaZtQsU0mxM4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--USskY5LJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A_cFomaZtQsU0mxM4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add new Post in wordpress, upload the image provided above&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View Post and right click on the Image, Right click and Inspect&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZNJrfHm5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AtRXra6kvsexVT2av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZNJrfHm5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AtRXra6kvsexVT2av.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the link from the Image Source&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6hI9yQLC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/616/0%2AmknhWoj6jvdhLmxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6hI9yQLC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/616/0%2AmknhWoj6jvdhLmxp.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the image using the command, open Terminal, go to the same folder as &lt;strong&gt;test.py&lt;/strong&gt; and paste the command below&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;8.a For the different size but same image — due to downsizing capabilities of each CDN&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;python3 test.py “&lt;a href="https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024%C3%97576.png"&gt;https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024×576.png&lt;/a&gt;"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;8.b For the same size, same image&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;python3 test.py “&lt;a href="http://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/shoeb-jetpack.png"&gt;http://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/shoeb-jetpack.png&lt;/a&gt;"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup and Testing — Jetpack CDN&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
1 &lt;strong&gt;.&lt;/strong&gt; Install Jetpack plugin on WordPress site&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to Settings of Jetpack, enable the Site Accelerator feature under Performance tab&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pFN5K29u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A4hu_iCUZkqDNxUo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pFN5K29u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A4hu_iCUZkqDNxUo2.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add new Post in wordpress, upload the image above&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View Post and right click on the Image, Right click and Inspect&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lNRW1zuu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AZ3IEXlGs1QpRoLJB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lNRW1zuu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AZ3IEXlGs1QpRoLJB.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the link from the Image Source&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gASbkjWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/544/0%2ARcQueXCoNJj8dMZH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gASbkjWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/544/0%2ARcQueXCoNJj8dMZH.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the same folder as &lt;strong&gt;test.py&lt;/strong&gt; and download the image using cURL with the command below
&lt;strong&gt;python3 test.py “&lt;/strong&gt; &lt;a href="https://i0.wp.com/comparecdns.com/wp-content/uploads/2021/05/shoeb.png?resize=1024%2C576&amp;amp;ssl=1"&gt;&lt;strong&gt;https://i0.wp.com/comparecdns.com/wp-content/uploads/2021/05/shoeb.png?resize=1024%2C576&amp;amp;ssl=1&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;"&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Related Essays
&lt;/h3&gt;

&lt;p&gt;That’s the end of the Appendix. Here are related essays:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn/"&gt;Is a premium CDN like CloudFront worth it, instead of a free CDN?&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;CDN Speed Tests (Testing Methodology)&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;Python CDN Speed Test Script&lt;/a&gt;: I use this to automate the collection of metrics about CDNs.&lt;/p&gt;

</description>
      <category>jetpack</category>
      <category>cdn</category>
      <category>aws</category>
      <category>cloudfront</category>
    </item>
    <item>
      <title>Is a premium CDN like CloudFront worth it, instead of a free CDN? — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Thu, 01 Jul 2021 05:54:45 +0000</pubDate>
      <link>https://dev.to/productivityhacks/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn-speed-test-demon-g48</link>
      <guid>https://dev.to/productivityhacks/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn-speed-test-demon-g48</guid>
      <description>&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt; : 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.&lt;/p&gt;

&lt;p&gt;I’m on &lt;a href="https://twitter.com/SpeedTestDemon"&gt;Twitter @SpeedTestDemon&lt;/a&gt; and &lt;a href="https://speedtestdemon.com/"&gt;email list is here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;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 &lt;em&gt;know&lt;/em&gt; CDNs cost you close to nothing. If you actually have a lot of traffic, it &lt;em&gt;might&lt;/em&gt; end up getting to $100/month — hardly more expensive than whatever you’re already paying for hosting. Apologies for the mini-rant.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Longer answer&lt;/strong&gt; : rest of this essay.&lt;/p&gt;

&lt;p&gt;The main focus of the rest of this essay is going to be discussing the pricing advantage of free CDNs over premium CDNs.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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!).&lt;/p&gt;

&lt;p&gt;Let’s estimate how much data you’re going to be using if you’re in either one of these two buckets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You already have a working website&lt;/li&gt;
&lt;li&gt;You’re still building out your website&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to find how much a CDN would cost you if you already have a working website
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OYL177BE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AjyRXgtFIyGrILKhL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OYL177BE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AjyRXgtFIyGrILKhL.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;OK once you’ve got the number, jump down to the section &lt;a href="https://speedtestdemon.com/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn/#So_how_much_does_a_premium_CDN_really_cost_you"&gt;analyzing the cost of the premium CDNs&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to find how much a CDN would cost you if you are planning to build a website
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Note: case studies are conducted with an adblocker, which means data transferred could be much smaller than without an adblocker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a Shopify store use?
&lt;/h3&gt;

&lt;p&gt;Example: &lt;a href="https://seloolive.com/"&gt;https://seloolive.com/&lt;/a&gt; (they have awesome olive oil, you should buy from them)&lt;/p&gt;

&lt;p&gt;Data transferred: 1.2 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a minimal wordpress website use?
&lt;/h3&gt;

&lt;p&gt;Example: &lt;a href="https://speedtestdemon.com/"&gt;https://speedtestdemon.com/&lt;/a&gt; (my own website, haha, which runs on WordPress)&lt;/p&gt;

&lt;p&gt;Data transferred: 203 KB (wow that’s small!)&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a complicated custom ecommerce solution on WooCommerce use?
&lt;/h3&gt;

&lt;p&gt;Example: the product page of an ecommerce store doing 7 figures in revenue per year.&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://www.solioswatches.com/product/solar-black-black-mesh?caseColor=matte-black&amp;amp;dialSize=36mm&amp;amp;gender=men"&gt;https://www.solioswatches.com/product/solar-black-black-mesh?caseColor=matte-black&amp;amp;dialSize=36mm&amp;amp;gender=men&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 4.6 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a simple sports betting web app use?
&lt;/h3&gt;

&lt;p&gt;Example: this is a simple web app that does optimizing.&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://www.topflightfantasysports.com/pga/pga-fd-optimizer/"&gt;https://www.topflightfantasysports.com/pga/pga-fd-optimizer/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 4.4 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a big complicated web app like Facebook use?
&lt;/h3&gt;

&lt;p&gt;Example: facebook.com&lt;/p&gt;

&lt;p&gt;Data transferred: 3.8 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a simple landing page use?
&lt;/h3&gt;

&lt;p&gt;Example: &lt;a href="https://sizzy.co/"&gt;https://sizzy.co/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 516 KB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a portfolio website use?
&lt;/h3&gt;

&lt;p&gt;Example: &lt;a href="http://www.baileyritchiephoto.com/"&gt;http://www.baileyritchiephoto.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 1.8 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Study: How much data does a magazine website use?
&lt;/h3&gt;

&lt;p&gt;Example 1: typical techcrunch.com article&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://techcrunch.com/2018/09/11/comma-ais-george-hotz-ousts-george-hotz-as-ceo/"&gt;https://techcrunch.com/2018/09/11/comma-ais-george-hotz-ousts-george-hotz-as-ceo/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 2.4 MB&lt;/p&gt;

&lt;p&gt;Example 2: oil price news site&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://oilprice.com/Geopolitics/Middle-East/Could-Energy-Ties-Bring-Saudi-Arabias-Conflict-With-Iran-To-An-End.html"&gt;https://oilprice.com/Geopolitics/Middle-East/Could-Energy-Ties-Bring-Saudi-Arabias-Conflict-With-Iran-To-An-End.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 650 KB (oh interesting, MUCH smaller than techcrunch)&lt;/p&gt;

&lt;p&gt;Example 3: bitcoin news site (because who doesn’t love bitcoin??)&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://news.bitcoin.com/latin-american-countries-bitcoin-adoption-el-salvador-bitcoin-law/"&gt;https://news.bitcoin.com/latin-american-countries-bitcoin-adoption-el-salvador-bitcoin-law/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data transferred: 3.6 MB&lt;/p&gt;

&lt;h3&gt;
  
  
  So how much does a premium CDN really cost you?
&lt;/h3&gt;

&lt;p&gt;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).&lt;/p&gt;

&lt;p&gt;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).&lt;/p&gt;

&lt;p&gt;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).&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Are there exceptions where a Free CDN is as good as a premium CDN?
&lt;/h3&gt;

&lt;p&gt;Actually, yes. I’m currently doing an investigation on free CDNs and I’ve been impressed with some Free CDNs so far.&lt;/p&gt;

&lt;p&gt;The best one I’ve seen so far is &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN (a.k.a. Photon CDN)&lt;/a&gt;, 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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  So the answer is yes, premium CDNs are worth it
&lt;/h3&gt;

&lt;p&gt;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 &lt;a href="https://twitter.com/SpeedTestDemon"&gt;Twitter&lt;/a&gt; or in email (hello at speedtestdemon dot com). I’m willing to change my mind if your argument’s good.&lt;/p&gt;

&lt;h3&gt;
  
  
  Related Essays
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront/"&gt;Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;CDN Speed Tests (Testing Methodology)&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;Python CDN Speed Test Script&lt;/a&gt;: I use this to automate the collection of metrics about CDNs.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>cdn</category>
      <category>architecture</category>
      <category>wordpresswebdevelopm</category>
    </item>
    <item>
      <title>Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Thu, 01 Jul 2021 05:48:08 +0000</pubDate>
      <link>https://dev.to/productivityhacks/cheat-sheet-on-curl-performance-metrics-how-to-benchmark-server-latency-with-curl-speed-test-1ddi</link>
      <guid>https://dev.to/productivityhacks/cheat-sheet-on-curl-performance-metrics-how-to-benchmark-server-latency-with-curl-speed-test-1ddi</guid>
      <description>&lt;h3&gt;
  
  
  Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl — Speed Test Demon
&lt;/h3&gt;

&lt;p&gt;I wrote this cheatsheet mainly because I was mildly frustrated googling for 10+ minutes trying to figure out what in the world does time_pretransfer mean??? Try googling it. I'll wait. It's abstruse! Ugh!&lt;/p&gt;

&lt;p&gt;The top Google result for “ curl time_pretransfer meaning" is this StackOverflow post, where they quote the curl man page and are still &lt;em&gt;very&lt;/em&gt; confused (as was I): What is the meaning of time_pretransfer, I checked man page of curl, it says "it took from the start until the file transfer is just about to begin"，I don't understand very well&lt;/p&gt;

&lt;p&gt;That’s right-even if you “RTFM” (Read the &lt;em&gt;Fine&lt;/em&gt; Manual), the curl man page itself is totally unhelpful about the meaning of time_pretransfer.&lt;/p&gt;

&lt;p&gt;You’d think somebody would’ve written a good article on the curl metrics by now!&lt;/p&gt;

&lt;p&gt;I finally figured out what time_pretransfer meant...after using my &lt;em&gt;brrrr-rrrrain&lt;/em&gt; and the speed of light (0.186 miles/microsecond). But nobody had the right answer for it. And I do. Hence this article.&lt;/p&gt;

&lt;p&gt;While here’s the full cheatsheet, there is also an explainer section I wrote on each of the metrics. If you’re interested in learning how I solve the meaning of time_pretransfer, jump down to the section " &lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/#What_does_curls_time_pretransfer_mean"&gt;What does&lt;/a&gt;&lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/#What_does_curls_time_pretransfer_mean"&gt;time_pretransfer mean?&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;(by the way, you can follow me on &lt;a href="https://twitter.com/SpeedTestDemon"&gt;twitter, Analyzing Software Performance&lt;/a&gt; for new posts like these, or &lt;a href="https://speedtestdemon.com/"&gt;email subscribe&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;time_namelookup&lt;/strong&gt; : how long DNS lookup took (translating domain name to IP address)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;time_connect&lt;/strong&gt; : how long TCP handshake took (done by both HTTP and HTTPS)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;time_appconnect&lt;/strong&gt; : how long SSL handshake took (only for HTTPS)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;time_redirect&lt;/strong&gt; : how long the redirect took. It is 0 if there is no redirect. Need "-L" flag in curl to redirect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;time_pretransfer&lt;/strong&gt; : This is essentially an alias for either time_appconnect or time_connect (depending on HTTP or HTTPS). It is only useful as a delineator of when the specific request to the server has begun.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;time_starttransfer&lt;/strong&gt; : This is when the server is ready to deliver bytes. Same as TTFB (Time To First Byte). It includes time_pretransfer, just subtract time_pretransfer from the time_starttransfer to get the amount of time spent in this phase&lt;/li&gt;
&lt;li&gt;: The total time of the entire curl call. Calculate time_total - time_starttransfer to get the data transfer (a.k.a. download) time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are also all the available metrics to be printed out, according to &lt;a href="https://man7.org/linux/man-pages/man1/curl.1.html"&gt;curl’s Linux man page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also have a section for each metric with more in-depth analysis. See sections with title “What does…”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V6uE3eeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AkZ6XSS6uABFSAwfE.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V6uE3eeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AkZ6XSS6uABFSAwfE.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Curl speed test example
&lt;/h3&gt;

&lt;p&gt;Here is a typical curl speed test output. Important to note: it is to an HTTPS URL. That factor is relevant to time_appconnect and time_pretransfer.&lt;/p&gt;

&lt;p&gt;Get the &lt;a href="https://github.com/speedtestdemon/speed-tests/blob/master/curl-format.txt"&gt;&lt;code&gt;curl-format.txt&lt;/code&gt; from github&lt;/a&gt; and then run this curl command in order to get the output&lt;/p&gt;

&lt;p&gt;$ curl -L -w "@curl-format.txt" -o tmp -s $YOUR_URL&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_namelookup&lt;/strong&gt; : 0.001654s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_connect&lt;/strong&gt; : 0.054957s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_appconnect&lt;/strong&gt; : 0.156267s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_pretransfer&lt;/strong&gt; : 0.156494s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_redirect&lt;/strong&gt; : 0.000000s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_starttransfer&lt;/strong&gt; : 0.219013s&lt;/p&gt;

&lt;p&gt;All time numbers are cumulative since the start of the curl. They are all in seconds.&lt;/p&gt;

&lt;p&gt;Couple important notes about the curl command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The -o tmp is actually really important in order to actually download the file. If you tried to be smart and pass -o /dev/null , what curl does is it skips the download of the file because it interprets /dev/null to mean you're not download the file. And it would mean you get a download time of nearly 0 seconds (the delta between time_total and time_starttransfer.&lt;/li&gt;
&lt;li&gt;The -L flag is actually important in order to make curl follow redirections.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What does curl’s time_namelookup mean?
&lt;/h3&gt;

&lt;p&gt;Thankfully this is an easy one to analyze. It is just DNS lookup time. The end result of this is just an IP address of the destination server that the curl program should talk to. No connection to the destination server has been made yet.&lt;/p&gt;

&lt;p&gt;Note that this metric is actually important to factor in a speed test! You might be surprised if you think this is something as banal as DNS lookup.&lt;/p&gt;

&lt;p&gt;Usually the DNS lookup goes by extremely quickly because the computer has probably cached the result. The computer caches because the results rarely change. For example, if there’s an A record for a domain that resolves to an IP, the computer can easily cache it — it’s maximum 32 bytes for the whole entry (and most computers have gigabytes of memory).&lt;/p&gt;

&lt;p&gt;However, the DNS lookup time can take a while if the computer hasn’t cached it, especially if the destination website doesn’t have a lot of traffic, because it means the routers in-between doesn’t have the DNS lookup cached so they can’t return the result quickly. I’ve had one speed test where it was as much as 56% of the total download time (0.122108 seconds / 0.217073 seconds). Actually, wow, that’s an incredibly high percentage. I’m surprised it got that high. That was on a newbie website of mine, so it was a very low traffic website. The next DNS lookup took only 0.001408s seconds. It definitely got cached.&lt;/p&gt;

&lt;p&gt;It is crucially important for CDN speed tests that the DNS operation is performed by curl. DNS lookups are how the CDN finds the IP address of the server closest to you. So for the same domain path, the IP address is going to be wildly different depending on your location. Although there is a way to exclude DNS lookup from the curl operation by giving curl an IP address as part of the input, you shouldn’t do it. DNS lookups are &lt;em&gt;very&lt;/em&gt; important to how CDNs function!&lt;/p&gt;

&lt;p&gt;That was rather interesting to write about. I am probably going to be doing DNS performance testing at some point, although this seems to be much harder to test than just plain CDN performance tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_connect mean?
&lt;/h3&gt;

&lt;p&gt;Time_connect is how long it takes to establish a TCP connection to the destination server. In the previous step, the DNS lookup, all we got back was an IP address. Now, at this step, there are actual sockets created, and data is ready to transfer between the client and server.&lt;/p&gt;

&lt;p&gt;Note that this procedure is done for &lt;em&gt;every&lt;/em&gt; request, for both HTTP and HTTPS and no matter which server you’re getting your request from (Google, Facebook, Microsoft, or any random guy’s WordPress server).&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_appconnect mean?
&lt;/h3&gt;

&lt;p&gt;This is how long the SSL handshake takes, only measured for HTTPS requests. If you make a curl to an HTTP URL, curl will report a 0.000… for time_appconnect.&lt;/p&gt;

&lt;p&gt;Note that this procedure is done for &lt;em&gt;every&lt;/em&gt; HTTPS request, regardless of purpose or which server is responding, even if it’s Google.&lt;/p&gt;

&lt;p&gt;Also, no idea why it’s called time_appconnect. That seems like a misnomer. Maybe better is “time_sslconnect”.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_pretransfer mean?
&lt;/h3&gt;

&lt;p&gt;time_pretransfer is essentially equal to either time_appconnect (HTTPS) or time_connect (HTTP) - depending on whether the request is HTTPS or HTTP. That's all it is. Nothing happens between time_pretransfer and the previous stage.&lt;/p&gt;

&lt;p&gt;This was the one that really confused me. I was having a hard time understanding, until I realized something…the time lapse from the previous stage is far too short for there to be any network activity.&lt;/p&gt;

&lt;p&gt;Why am I so confident that there is only CPU involved? Because the time lapse between time_pretransfer and time_appconnect is so small, even if data was traveling in a straight line between two points at the speed of light, there could not &lt;em&gt;possibly&lt;/em&gt; be round-trip network transfer.&lt;/p&gt;

&lt;p&gt;Here’s the math breakdown. First note that in the example curl output, the time difference between time_pretransfer and time_appconnect is only 227 microseconds. If you try it yourself, it could even be as low as 27 microseconds (as seen on a curl output on a curl’s github issue).&lt;/p&gt;

&lt;p&gt;Second thing to note, what is the speed of light per &lt;strong&gt;&lt;em&gt;microsecond&lt;/em&gt;&lt;/strong&gt;? The speed of light is 186,000 miles per . Converting that to microseconds….there’s 1 million microseconds in a second, so 186,000 miles/sec * 1 sec / 1,000,000 microseconds = 0.186 miles per microsecond.&lt;/p&gt;

&lt;p&gt;Finally, multiply the numbers we get 227 microseconds * 0.186 miles/microsecond = 42 miles.&lt;/p&gt;

&lt;p&gt;Wait, 42 miles??&lt;/p&gt;

&lt;p&gt;And that time is roundtrip, so one-way is only 21 miles.&lt;/p&gt;

&lt;p&gt;Yeah…I seriously doubt there’s a server or datacenter that close to where I live. I’m in a major US city but not the usual suspects SF, NYC, LA, Chicago or Dallas.&lt;/p&gt;

&lt;p&gt;What is probably going on here is curl is getting itself ready to receive bytes — and that’s it. There can’t possibly be any bytes exchanged as part of the time between time_pretransfer and time_appconnect.&lt;/p&gt;

&lt;p&gt;So, time_pretransfer is really just the same as either time_connect or time_appconnect depending on whether the call was HTTP or HTTPS. As such, it seems the only purpose of time_pretransfer is to make it easier to clearly analyze how long it took for the server to begin transferring bytes. This is calculated by “time_starttransfer — time_pretransfer”….which brings us to the next metric, “time_starttransfer”.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_starttransfer mean?
&lt;/h3&gt;

&lt;p&gt;The time duration “time_starttransfer — time_pretransfer” is basically latency. It specifically measures how quickly the server can respond to this particular curl request. If you’re a backend engineer, this is the one metric you’ll pay a lot of attention to. All the other metrics are just normal TCP or SSL stuff for every server, and as a backend engineer, there’s not a lot you can do to affect the performance of those aside from renting more expensive servers.&lt;/p&gt;

&lt;p&gt;Time_starttransfer is essentially the same as Time To First Byte (TTFB), which means how long it took for the server to prepare the response. If you’re a backend engineer, you’ll be familiar with that term too. Look, it’s just latency OK. And very important to get latency down.&lt;/p&gt;

&lt;p&gt;OK lets walk through an example of what time_starttransfer metric would mean for CDNs. If you were requesting a file from a CDN, then this phase is how long it took for the CDN to prepare that file for you. Either the CDN has cached the file in memory so it can return it quickly to you. Or it has cached it in the SSD layer so it needs a little more time. Or maybe it doesn’t have it cached at all, so it has to make a HTTP/HTTPS request of its own to the origin server where the file is supposed to be located. So, this step is &lt;em&gt;very&lt;/em&gt; crucial to analyze the difference between CDNs — everything else is going to be more or less the same.&lt;/p&gt;

&lt;p&gt;One more example. Let’s say you were making an API request to Google Translate API to get back the French translation of an English sentence. Then this particular step (time_starttransfer — time_pretransfer) is how long it took for Google to translate. All previous steps are just normal TCP connection setup common to every other request.&lt;/p&gt;

&lt;p&gt;Mkay? Time_starttransfer is just the latency of the server. We’re almost done going through every metric. Last two are time_redirect and time_total which are straightforward.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_redirect mean?
&lt;/h3&gt;

&lt;p&gt;If there was no redirect, this value is 0.000.&lt;/p&gt;

&lt;p&gt;If there was a redirect, then you will see the amount of time that redirecting took.&lt;/p&gt;

&lt;p&gt;Here’s a simple input to curl you can use to see how long a redirect might take: “google.com”, which gets redirected to &lt;a href="http://www.google.com"&gt;www.google.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For our purpose of speed testing CDNs, it’s important that time_redirect is 0 because redirecting is not really a relevant factor for a CDN’s download speed.&lt;/p&gt;

&lt;p&gt;An important thing to note: if you’re interested in measuring redirect time, you want to make sure the redirect is happening at the right step. When I ran curl on google.com, time_redirect should've been on step 2 (right after time_namelookup). Here was the output I got:&lt;/p&gt;

&lt;p&gt;curl -L -w "@curl-format.txt" -o /dev/null -s google.com&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_namelookup&lt;/strong&gt; : 0.006038s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_connect&lt;/strong&gt; : 0.069728s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_appconnect&lt;/strong&gt; : 0.000000s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_pretransfer&lt;/strong&gt; : 0.069885s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_redirect&lt;/strong&gt; : 0.069052s&lt;br&gt;&lt;br&gt;
&lt;strong&gt;time_starttransfer&lt;/strong&gt; : 0.161169s&lt;/p&gt;

&lt;p&gt;Another important thing — you need -L flag to curl in order for it to follow redirects, or else it won't redirect. It's an easy mistake to make, because curl won't complain loudly it got a redirect but didn't follow. Your only clue is if 0.000 is in time_redirect but you expected it to be non-zero.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does curl’s time_total mean?
&lt;/h3&gt;

&lt;p&gt;Thankfully this one’s a really simple one to understand. This is just how long the entire download took — starting from the DNS lookup request all the way until the client has sent a FIN connection tear down since all the bytes have been downloaded.&lt;/p&gt;

&lt;p&gt;By the way, if you are using curl to test CDN speeds, you should know that doing just one curl is by far not enough to measure a CDN’s delivery speed. The two metrics you should measure are “1st download speed” vs “cached downloads speed”, which means doing about 11 curl calls to the same URL. I have a more in-depth article explaining &lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;my testing methodology&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;If you want a quick summary of each metric, refer to the cheat sheet at the top of the page.&lt;/p&gt;

&lt;p&gt;If you have any questions, send me an email (hello /at/ speedtestdemon \dot/ com )or hit me up on &lt;a href="https://twitter.com/SpeedTestDemon"&gt;Twitter&lt;/a&gt; (I love Twitter and I use it actively):&lt;/p&gt;

&lt;p&gt;If you wanna get email notifications of new posts, you can subscribe&lt;/p&gt;

&lt;h3&gt;
  
  
  Related Essays
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn/"&gt;Is a premium CDN like CloudFront worth it, instead of a free CDN?&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/testing-methodology/"&gt;CDN Speed Tests (Testing Methodology)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront/"&gt;Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;Python CDN Speed Test Script&lt;/a&gt;: I use this to automate the collection of metrics about CDNs.&lt;/p&gt;

</description>
      <category>cloudfront</category>
      <category>cloudinary</category>
      <category>aws</category>
      <category>cdn</category>
    </item>
    <item>
      <title>How To Speed Test a CDN (Testing Methodology) — Speed Test Demon</title>
      <dc:creator>Productivity Hacks &amp; Software Performance Analysis</dc:creator>
      <pubDate>Tue, 15 Jun 2021 05:02:59 +0000</pubDate>
      <link>https://dev.to/productivityhacks/how-to-speed-test-a-cdn-testing-methodology-speed-test-demon-1h89</link>
      <guid>https://dev.to/productivityhacks/how-to-speed-test-a-cdn-testing-methodology-speed-test-demon-1h89</guid>
      <description>&lt;h3&gt;
  
  
  How To Speed Test a CDN (Testing Methodology) — Speed Test Demon
&lt;/h3&gt;

&lt;p&gt;Since I’m going to be writing a whole bunch of articles about CDN speeds, I wanna consolidate my testing methodology into a single article. I’m going to be linking back to this article a lot.&lt;/p&gt;

&lt;p&gt;Questions to be answered in this article:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What numbers are measured for CDN download speed? (it is not just one number)&lt;/li&gt;
&lt;li&gt;Why were those numbers selected?&lt;/li&gt;
&lt;li&gt;How are the numbers measured?&lt;/li&gt;
&lt;li&gt;Where is the measurement done? Cloud server or home computer?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m on &lt;a href="https://twitter.com/SpeedTestDemon"&gt;Twitter @SpeedTestDemon&lt;/a&gt; and &lt;a href="https://speedtestdemon.com/"&gt;email list is here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The three important measurements to make
&lt;/h3&gt;

&lt;p&gt;At the end of the day, the CDN is really just a caching layer. All it is, is just a massively distributed caching layer. That’s it. That’s all it is.&lt;/p&gt;

&lt;p&gt;And if you’re familiar at all with how caching layers work, there are 3 all-important metrics to measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cold cache latency — item is not in cache at all&lt;/li&gt;
&lt;li&gt;Hot cache latency — item is in fastest response layer of cache&lt;/li&gt;
&lt;li&gt;Warm cache latency — item is at a slower response layer of cache.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To illustrate this in hardware terms: server responding from RAM is the fastest possible latency. That’s hot cache. Getting it from disk (SSD) is the second fastest possible latency. And you can add more layers (HDD). Finally, cold cache is if the server doesn’t have the item at all.&lt;/p&gt;

&lt;p&gt;With regards to a CDN, how do we measure hot, cold, and warm cache?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cold cache latency&lt;/strong&gt; : is simple, you just fetch a file that the CDN has never seen before. This is going to take the longest time. On CloudFront for example, I’m seeing a drop from 1.2 seconds to 0.232 seconds in the hot cache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hot cache latency&lt;/strong&gt; : also simple, you can fetch the same file 10 times in a row and take the average.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Warm cache latency&lt;/strong&gt; : trickier. Much trickier. We must wait some amount of time to wait for the file to leave the hot cache. For now we are sticking with 30 minutes but we may adjust this as we learn how CDNs are moving items from hot cache to warm cache. The result of the warm cache is also much more ambiguous as it must be fetched at some time away from the cold and hot cache tests.&lt;/p&gt;

&lt;p&gt;You can see the cold cache is much slower than hot cache by running this curl: &lt;code&gt;curl -w “@curl-format.txt” -o tmp -s “ [https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024×576.png](https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024x576.png) “&lt;/code&gt;. This example uses CloudFront. There is a massive jump from 1+ seconds to 0.1–0.2 seconds.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to measure the 3 measurements: my open sourced Python script (check github)
&lt;/h3&gt;

&lt;p&gt;I used a python script to automate the measurements. This is important so that the measurements are very consistent between CDNs. Also important to remove human error.&lt;/p&gt;

&lt;p&gt;It is open sourced here: &lt;a href="https://github.com/speedtestdemon/speed-tests/blob/master/test.py"&gt;https://github.com/speedtestdemon/speed-tests/blob/master/test.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a &lt;strong&gt;massive&lt;/strong&gt; drop in CDN download time from cold cache to hot cache. CloudFront gave me 1.09 seconds for cold cache, then 0.112 seconds for hot cache, then 0.226 for warm cache.&lt;/p&gt;

&lt;p&gt;Here is the full python output. The cool thing is that it prints out the headers it got for the cold cache and for warm cache. The headers are used to sanity check that the test is doing the correct thing regarding cold cache and warm cache test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;------------------------------------------------------------------ Testing " **Cold cache speed**" ------------------------------------------------------------- Got headers: HTTP/2 200 **content-type** : image/png **content-length** : 719983 **date** : Sun, 20 Jun 2021 21:47:06 GMT **last-modified** : Mon, 07 Jun 2021 00:16:21 GMT **etag** : "52ae2ff2354d4a68e680b77b4da58985" **accept-ranges** : bytes **server** : AmazonS3 **x-cache** : Miss from cloudfront **via** : 1.1 c39432c353feb02b03735f3850e19107.cloudfront.net (CloudFront) **x-amz-cf-pop** : IAH50-C1 **x-amz-cf-id** : NgkCqcrwb3K65LeGu7uhebFNODrNI9s8wVeHZ93lq2XKrE3q9PMm-A== **time\_namelookup** : 0.06327399999999999691 **time\_connect** : 0.01762099999999999778 **time\_appconnect** : 0.05910300000000001663 **time\_pretransfer** : 0.00010199999999999099 **time\_redirect** : 0.00000000000000000000 **time\_starttransfer** : 0.95064099999999995827 **time to download** : 0.00008300000000005525 **time\_total** : 1.09082400000000001583 ------------------------------------------------------------- Testing " **Hot cache speed**" ------------------------------------------------------------- 10 requests done. Average: **time\_namelookup** : 0.00190460000000000000 **time\_connect** : 0.02373660000000000006 **time\_appconnect** : 0.06306589999999999419 **time\_pretransfer** : 0.00019590000000000024 **time\_redirect** : 0.00000000000000000000 **time\_starttransfer** : 0.02317680000000000434 **time to download** : 0.00007860000000000089 **time\_total** : 0.11215840000000001919 ------------------------------------------------------------- Testing " **Warm cache speed**" ------------------------------------------------------------- Sleeping for 0.5 hr to move cache from hot to warm Got headers: HTTP/2 200 **content-type** : image/png **content-length** : 719983 **last-modified** : Mon, 07 Jun 2021 00:16:21 GMT a **ccept-ranges** : bytes **server** : AmazonS3 **date** : Mon, 21 Jun 2021 00:09:46 GMT **etag** : "52ae2ff2354d4a68e680b77b4da58985" **x-cache** : Hit from cloudfront **via** : 1.1 9b59bfec44582f64d3d8dac9fb7d27b7.cloudfront.net (CloudFront) **x-amz-cf-pop** : DFW50-C1 **x-amz-cf-id** : hzwVoHfaHen2TR3cCNRsnwniXMc3_BaOWk7oa2DiQaWkioXqwSGRrg== **time\_namelookup** : 0.11359600000000000253 **time\_connect** : 0.01640300000000000091 **time\_appconnect** : 0.07292699999999999183 **time\_pretransfer** : 0.00030900000000000372 **time\_redirect** : 0.00000000000000000000 **time\_starttransfer** : 0.02220300000000000051 **time to download** : 0.00011099999999999999 **time\_total** : 0.22554899999999999949
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please note these metrics like time_namelookup do correspond to the same meaning curl's time_namelookup. 'Curl' shows a cumulative time measure, so it is always increasing. However I want to look at the time each stage took separately from each other, so curl's cumulative increasing timestamp was not helpful to me.&lt;/p&gt;

&lt;p&gt;If you’re curious about what each of those metrics mean, such as time_appconnect (which is a complete misnomer and doesn't make sense), read this &lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;writeup that explains each curl metric&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common pitfalls of speed testing CDNs
&lt;/h3&gt;

&lt;p&gt;These are some mistakes I made while speed testing CDNs. These are easy mistakes to make so I decided to write about it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mistake #1: cold cache tests should be done where the CDN does not have the file cached.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Why it’s an easy mistake to make&lt;/strong&gt; : most people think files are cached for only 24 hours. That’s not necessarily true. Some CDNs like &lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN&lt;/a&gt; evidently cache it for more than 1 day (based on my tests). Additionally, most people’s curl calls do not include the headers which have the warning sign that the file could be cached.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to fix&lt;/strong&gt; : check the headers returned. You should see the keyword “MISS” somewhere in there. If you see a “HIT”, that’s a warning sign. This is also why the python script prints out the headers for cold cache test and warm cache test.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mistake #2: you need to actually download the file.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Why it’s an easy mistake to make&lt;/strong&gt; : for some reason, it is extremely easy to accidentally make curl skip the download of the actual file. There are at least 3 ways of doing this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you set the “NOBODY” option to curl via pycurl, it does not download the file. I made this mistake in my python script.&lt;/li&gt;
&lt;li&gt;If you set the “-O /dev/null” flag via the curl in the command line, it does not download the file. You think it would just download the file and dump it to /dev/null. No. curl is “smarter” than that and just skips the download altogether.&lt;/li&gt;
&lt;li&gt;If you set the “-I” flag via curl in the command line, it does not download the file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why this is an important mistake to avoid&lt;/strong&gt; : CloudFront does not cache the file if you do not download the file! And since CloudFront is an industry-standard CDN, it is likely other CDNs have the same behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How you can detect this mistake&lt;/strong&gt; : look at the download time (time_total — time_starttransfer). If it is in the hundreds of microseconds, that’s a problem. The speed of light is only 0.184 mile/microsecond. If you got only 200 microseconds, then that is 37 miles…roundtrip. Or 18 miles one way. It is highly unlikely there’s a datacenter that close to where you are. It means that there was no network transfer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to fix&lt;/strong&gt; : in pycurl, write the downloaded contents to a BytesIO or StringsIO variable. To see how it’s done, see my &lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;python CDN speed test script&lt;/a&gt;. Or if you’re using curl from command line, avoid “-O /dev/null” and “-I” flag and make sure download time is at least several milliseconds.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mistake #3: The input URL is invalid.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Why it’s an easy mistake to make&lt;/strong&gt; : your curl speed test doesn’t report any 404 error. So you get back the speed test results without realizing there’s an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to catch mistake&lt;/strong&gt; : one red flag you wanna look at is the “download” time. If it’s less than 1 millisecond, that’s way too fast. Do the math. Speed of light is .184 per microsecond. There are 1000 microseconds in a millisecond. If you’re getting, lets say 200 microseconds, that’s only 36 miles…. &lt;em&gt;roundtrip&lt;/em&gt;. One way, it’s only 18 miles. So 200 microseconds is way too fast, and indicates there’s probably no network transfer (i.e. no download) happening at all.&lt;/p&gt;

&lt;p&gt;Of course, the other thing you could do is actually download the file…use wget. You’ll see an error message pretty easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to fix the mistake&lt;/strong&gt; : use the right URL.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mistake #4: The input URL is HTTP not HTTPS.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Why it’s an easy mistake to make&lt;/strong&gt; : people are careless or perhaps not technical enough. This is actually an important thing to ensure as I’m noticing the SSL exchange normally takes 50 milliseconds. Given a fast curl time is only around 120 milliseconds (from a home computer not cloud provider).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to fix the mistake&lt;/strong&gt; : be consistent in your testing. Use HTTPS for all or HTTP for all. And you should probably use HTTPS since that’s the standard (everybody uses HTTPS).&lt;/p&gt;

&lt;h3&gt;
  
  
  Why I chose not to test on a normal web server like DigitalOcean
&lt;/h3&gt;

&lt;p&gt;Turns out it’s not a good idea to use DigitalOcean to run these CDN speed tests.&lt;/p&gt;

&lt;p&gt;I initially thought it would be a good idea to run these CDN speed tests on a standardized server location like DigitalOcean. Since I travel a lot, I can’t guarantee my internet is always going to be the same quality, or the location could be drastically different, such as different countries.&lt;/p&gt;

&lt;p&gt;So that’s what I did. I tried it out…and noticed DigitalOcean’s internet speed is fast — REALLY fast. Like, way faster than my home internet speed. I was a little shocked. I didn’t think download speeds could ever get that fast. Makes me wonder what I need to do to make my home internet as good as that, because I really thought I had the best possible internet that money could pay for (I basically use my computer 100 hours a week, OK. It’s important to me).&lt;/p&gt;

&lt;p&gt;If you wanna see an example of the drastic difference in CDN speed…well here’s one. It’s using the CloudFront example that we’re using in the “Free CDN” blog series. When I ran my speed test python script with: &lt;code&gt;python3 test.py [https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024×576.png](https://d3va53q3li7xt1.cloudfront.net/wp-content/uploads/2021/05/shoeb-1024x576.png)&lt;/code&gt;, I got back a download time of a blazing fast 0.0225 seconds, or 23 milliseconds. Holy cow. And then doing the same thing on my home internet, I only get 0.2315 seconds, or 232 milliseconds. What the hell.&lt;/p&gt;

&lt;p&gt;Out of curiosity, I ran an internet speed test on the DigitalOcean server. Like how the hell is it that much faster. That’s gotta get anybody’s interest up. And would you believe the numbers???&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# speedtest-cli Retrieving speedtest.net configuration... Testing from DigitalOcean (128.199.187.118)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by NewMedia Express (Singapore) [13.17 km]: 2.16 ms Testing download speed................................................................................ Download: 1740.52 Mbit/s Testing upload speed...................................................................................................... Upload: 1420.29 Mbit/s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;LOL holy crap Download speeds of 1740.52 Mbit/s and Upload speeds of 1420.29 Mbit/s? How much money did DigitalOcean pay for that? I wanna buy it.&lt;/p&gt;

&lt;p&gt;That is literally 10x as fast as my internet, which tops out at 160 Mbit/s (using fast.com).&lt;/p&gt;

&lt;p&gt;So there are several reasons why I decided not to run these speed tests on DigitalOcean after all:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s hard to tell the difference between good or bad CDNs.&lt;/li&gt;
&lt;li&gt;It’s not a real-world usage of how CDNs actually get used. Almost nobody is going to have internet speeds that fast, where it’s nearly 10x faster than the most premium internet you can get.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;BTW: relevant article that also talks about the distorted internet speeds of cloud providers: how accurate are CDNPerf’s numbers? Answer: not very accurate. TODO: I will link to this essay (rant) once I’ve written it!&lt;/p&gt;

&lt;h3&gt;
  
  
  Why the CDN speed tests need to be done almost at the same time
&lt;/h3&gt;

&lt;p&gt;This is probably obvious to most internet users but because I’m trying to measure CDNs as methodically as possible, I might as well explain it briefly.&lt;/p&gt;

&lt;p&gt;Internet speeds usually vary greatly depending on the time of the day. For example, during the evenings, there is typically massive internet congestion as people get off work and get leisure time. Video bandwidth is particularly notorious for hogging a lot of bandwidth. For example, did you know Netflix alone hogs 40% of the internet traffic during the evenings? Google it. And that’s just Netflix. Imagine if you added Youtube too. The evenings just get really congested with internet traffic.&lt;/p&gt;

&lt;p&gt;And since we are focused on CDNs as the variable, we should make internet conditions an invariant. This means running the CDN speed test for 2 CDNs at basically the same time (let’s say within 1 minute is fine).&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary (TL;DR)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I measure three CDN download speeds: cold, hot, and warm cache.&lt;/li&gt;
&lt;li&gt;The measurement is automated with a python script (it’s open sourced, see it here: &lt;a href="https://github.com/speedtestdemon/speed-tests/blob/master/test.py"&gt;https://github.com/speedtestdemon/speed-tests/blob/master/test.py&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;CDN speed measurements on 2 or more CDNs are to be conducted within the space of a few minutes.&lt;/li&gt;
&lt;li&gt;CDN speed measurement is conducted on a home computer with home internet, not on the cloud where internet speeds are 10x home internet speeds (easily).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions? You can ask me on social media &lt;a href="https://twitter.com/SpeedTestDemon"&gt;https://twitter.com/SpeedTestDemon&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Related Essays
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://speedtestdemon.com/is-a-premium-cdn-like-cloudfront-worth-it-instead-of-a-free-cdn/"&gt;Is a premium CDN like CloudFront worth it, instead of a free CDN?&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/a-guide-to-curls-performance-metrics-how-to-analyze-a-speed-test-result/"&gt;Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://speedtestdemon.com/wordpress-free-jetpack-cdn-faster-than-amazon-aws-cdn-cloudfront/"&gt;Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/cloudinary-cdn-totally-smokes-amazon-aws-cdn-cloudfront/"&gt;Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
 &lt;a href="https://speedtestdemon.com/python-cdn-speed-test-script/"&gt;Python CDN Speed Test Script&lt;/a&gt;: I use this to automate the collection of metrics about CDNs.&lt;/p&gt;

</description>
      <category>cache</category>
      <category>softwaredevelopment</category>
      <category>cdn</category>
      <category>softwaretesting</category>
    </item>
  </channel>
</rss>
