Warming Up Cache Geographically Using Webpagetest

caching

#1

As a page speed addict, I thought I’d share pagespeed tool I wrote called gitools.sh. It’s a shell script which will allow you to run via SSH command line or cronjob API queries to 3 page speed tool services listed below:

And send results optionally to custom Slack channel.

  • As Cloudflare’s edge caches are geographically dependent on being populated by local visitors respectively, it means you need have visitors to each of the geographic locations.
  • Using gitools.sh Webpagetest.org API comes in handy for this task for a select few geographic WPT locations you can test. I usually setup a cronjob and send results to my custom slack channel once a week. It will then populate the caches for each of the corresponding Cloudflare edge servers for those regions.

example running WPT API cable 5mbps tests against domain.com

./gitools.sh wpt https://domain.com dulles cable
./gitools.sh wpt https://domain.com california cable
./gitools.sh wpt https://domain.com frankfurt cable
./gitools.sh wpt https://domain.com singapore cable
./gitools.sh wpt https://domain.com sydney cable
./gitools.sh wpt https://domain.com dallas cable
./gitools.sh wpt https://domain.com london cable
./gitools.sh wpt https://domain.com tokyo cable
./gitools.sh wpt https://domain.com mumbia cable
./gitools.sh wpt https://domain.com brazil cable

Test against google site in dulles region using cable 5mbps profile

./gitools.sh wpt https://www.google.com dulles cable

--------------------------------------------------------------------------------
Dulles:Chrome.Cable WPT Results
--------------------------------------------------------------------------------
Test ID: 180923_4R_EHE
https://www.webpagetest.org/result/180923_4R_EHE/
https://www.webpagetest.org/lighthouse.php?test=180923_4R_EHE
https://www.webpagetest.org/testlog.php?days=1&filter=www.google.com&all=on&video=on
/home/wptresults/wpt-dulles.chrome.cable.230918-053128.log
Test Started 28 seconds ago
Test Started 28 seconds ago (100)
waiting on results...
Test Complete
Test Complete (200)
waiting on results...
Test Complete
Test Complete (200)
----
bytesIn-fully-loaded 502457 
bytesInDoc-document-complete 483416 
chromeUserTiming.domComplete-time 1452 
chromeUserTiming.firstContentfulPaint 390 
chromeUserTiming.firstMeaningfulPaint 465 
chromeUserTiming.firstMeaningfulPaintCandidate 465 
domComplete-time 1453 
domContentLoadedEventEnd 537 
domContentLoadedEventStart 523 
domElements 419 
domInteractive 523 
firstPaint 390.2 
fullyLoaded-time 3396 
lighthouse.Accessibility 0.8 
lighthouse.BestPractices 0.87 
lighthouse.Performance 0.96 
lighthouse.Performance.estimated-input-latency 16 
lighthouse.Performance.first-contentful-paint 1054.097 
lighthouse.Performance.first-cpu-idle 3440.068 
lighthouse.Performance.first-meaningful-paint 1054.097 
lighthouse.Performance.speed-index 1535 
lighthouse.ProgressiveWebApp 0.5 
lighthouse.SEO 0.7 
loadTime 1453 
start-render 500 
requestsDoc 14 
requestsFull 19 
score_cache 96 
score_cdn 100 
score_compress 100 
score_gzip 100 
score_keep-alive 100 
SpeedIndex 780 
TTFB 279 
visualComplete 5400 
https://www.webpagetest.org/results/18/09/23/4R/EHE/1_waterfall.png
ok----
--------------------------------------------------------------------------------

Slack channel sent results

If folks have other ways to pre-warm the Cloudflare geographic caches, you can share you tools and know how in this thread too :slight_smile:


Question on Cache Everything
How to preheat CDN
Cache all pages after deploy
#2

Some speed tests have the ‘Number of Tests’ and ‘Repeat View’ options. I think it would have the same effect.

08%20AM


#3

Indeed it would when done manually via webpagetest. Though the first visit would of populated the cache if not cached usually.

The above gitools.sh script just automates this on command line so you can setup a cronjob schedule i.e. run once a week etc


#4

Good stuff!