Benchmarking CDN Download Speeds
Fast CDN claims are easy to make and hard to verify. This guide covers measuring real download speed across CDNs, spotting regressions, and using sample files of varying sizes for meaningful benchmarks.
What speed actually means
- Throughput — bytes per second once download is steady
- Time to first byte (TTFB) — latency to start streaming
- Total time — TTFB + throughput for the full file
A CDN with 50ms TTFB and 100MB/s throughput wins on small files. A CDN with 200ms TTFB and 500MB/s throughput wins on large files. Measure both.
curl one-liner for quick checks
curl -o /dev/null -w \
"TTFB: %{time_starttransfer}s\nTotal: %{time_total}s\nSpeed: %{speed_download} B/s\n" \
https://example.com/100mb.bin
Multi-region benchmark script (Node.js)
import { performance } from 'perf_hooks';
async function bench(url) {
const start = performance.now();
const res = await fetch(url);
const firstByte = performance.now();
const bytes = (await res.arrayBuffer()).byteLength;
const end = performance.now();
return {
ttfbMs: firstByte - start,
totalMs: end - start,
throughputMBps: bytes / 1024 / 1024 / ((end - start) / 1000),
};
}
const urls = [
'https://cdn-a.example.com/100mb.bin',
'https://cdn-b.example.com/100mb.bin',
];
for (const url of urls) {
console.log(url, await bench(url));
}
Use the right test file size
TTFB dominates for files under 1MB. Throughput dominates above 10MB. Test both:
- 1MB — TTFB and early-byte characterization
- 10MB — steady-state throughput begins
- 100MB — realistic large-file benchmark
- 1GB — long-duration throughput, thermal throttling
Geography matters
Run benchmarks from multiple regions — ideally from your user distribution. Services like AWS Lambda in N. Virginia, Frankfurt, and Singapore give you 3-region coverage for free. Or use dedicated tools like Catchpoint or ThousandEyes.
Cold cache vs warm cache
# Cold: request a unique URL so cache can't hit
curl "https://cdn.example.com/100mb.bin?cb=${RANDOM}"
# Warm: hit the same URL twice, measure second run
curl -s -o /dev/null "https://cdn.example.com/100mb.bin"
curl -o /dev/null -w "%{speed_download}\n" "https://cdn.example.com/100mb.bin"
Cold-cache numbers tell you CDN origin performance. Warm-cache tells you edge performance. Both matter.
Benchmarks to track over time
- p50 / p95 / p99 throughput from each region
- TTFB trend week over week — regressions are almost always network changes
- Error rate (5xx, timeouts) as a percentage
- Bandwidth cost per GB served
Tools worth knowing
- ab (Apache Bench) — simple concurrent load test
- k6 — modern load testing in JavaScript
- wrk — high-concurrency HTTP benchmarking
- cdnperf.com — third-party CDN comparison
Related
For upload-side performance, see resumable uploads with tus. For general large file handling, read large file upload guide.