Simple python script I use to speed test CDNs. It’s open sourced under MIT license. The repository is: https://github.com/speedtestdemon/speed-tests and the python script is “test.py”.
The script takes a single input “URL”. Example usage: `python3 test.py https://d20zaq59cm4c4j.cloudfront.net/wp-content/uploads/2021/05/cf.png`.
The script outputs these things:
- Cold cache, hot cache, and warm cache tests (in that order).
- 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.
- The hot cache times are averages of 10 curls.
Unique notes about the CDN Speed Test Script:
- The script will sleep for 30 minutes between hot cache and warm cache test, in order to move the CDN from hot cache state to warm cache state.
Here is an example output of the python script:
Test Methodology: how I test CDNs. I use this python script to test CDNs.
Cheat Sheet on Curl Performance Metrics: how to benchmark server latency with curl: explains the curl metrics outputted by the python script.
Jetpack CDN vs Amazon Web Services CloudFront: Jetpack surprisingly faster!, where I analyze Jetpack CDN using the python script.
Cloudinary vs CloudFront: Cloudinary crushes Amazon Web Services!, where I analyze Cloudinary using the python script.