Comparing CDNs with a fresh Next.js app - quick look
Originally published: 4 January 2024
Last updated: 5 February 2024
The app may make a difference to the CDN, not just the CDN to the app!
CDN Performance Shootout: Vercel vs Cloudflare vs Cloudfront
I recently decided to test out the major CDN providers by deploying a fresh Next.js app on each one. I compared Vercel, Cloudflare, Cloudfront, and Netlify specifically. The results were interesting - different from what I see on my main site sureshkhirwadkar.dev.
On my current site, Cloudflare consistently benchmarks faster than Vercel. But with a brand new Next.js app, Vercel was 50% faster than Cloudflare in Time to First Byte (TTFB).
Clearly the CDN performance landscape is more complex than it first appears. Let’s look at the key results from each provider with a fresh Next.js build:
Netlify
Performance Grade: B
Performance Score: 74% Average TTFB: 308 ms
Netlify has the slowest TTFB of the providers tested. Still decent performance, but lagging behind the other CDNs.
CloudFront
Performance Grade: A
Performance Score: 93%
Average TTFB: 118 ms
CloudFront performs very well out of the box. Quick setup with SST makes it a solid contender.
Cloudflare
Performance Grade: B Performance Score: 86% Average TTFB: 224 ms
Cloudflare positions itself in the middle - faster TTFB than Netlify, but slower than Vercel and CloudFront.
Vercel
Performance Grade: A Performance Score: 96%
Average TTFB: 112 ms
Vercel tops the performance charts with the fastest TTFB overall. Very impressive for a fresh build.
Why Such Different Results?
So why did Vercel smoke the competition with a new Next.js app, when Cloudflare is faster for my current site?
A few potential factors:
- Caching - My current site has extensive caching setup already.
- Workers - I use Cloudflare Workers which boost performance.
- Images - My site uses many large images which impact caches.
- Codebase - My codebase has extra dependencies and configs.
Starting from a clean slate seems to favor Vercel’s CDN performance. But optimizations like caching and workers can shift results.
I plan to do much more in-depth testing comparing configurations. But these initial benchmarks show that CDN performance depends heavily on your specific codebase and settings. There is no one-size-fits-all “fastest” CDN!
Read more about hosts here and read more about CDNs here.
Read Count: 0