Blogthedata.com is 1714% faster!!! Now people in Jakarta, Indonesia, can ping my site faster than a sip of coffee.

This site lives on a Linode server based in Dallas, TX because I guessed most site traffic would come from the US. Dallas is a midpoint, nearly equidistant from NYC and Los Angeles, the two most populous US cities.

Last December, I added likes and views to blog posts. I track views by counting unique IP addresses that visit at least one post. The logic gets confused by VPNs, but it's a good approximation. It shocked me to discover 776 IPs have visited blogthedata.com, spread across 46 countries and 203 cities!

Map of over 700 unique IPs. The top three  countries are the US, Canada, and France

 Now it was time to discover how blogthedata.com performs in other countries. I ran an online audit tool, Speed Vitals, to measure TTFB (Time to first byte) from 35 locations in the world. For cites in America, the speeds weren't too bad.

TTFB  for US states. Values are between 390ms and 1500ms with most under 1000ms

But for cities far from Dallas, it was slowwww. Most took over a second, some over 2 seconds!!!

TTFB for countires in Asia. Values range from 1,400ms to 2,300ms

To speed things up, I used CloudFlare's edge network to cache pages on different servers around the world. Instead of only being in Dallas, Blogthedata.com could be EVERYWHERE. Best of all, CloudFlare's edge network is free with up to three page rules.

CloudFlare's Edge network

Cloudfare Map of Edge Networks

There is a big drawback to using an edge network. CloudFlare does not guarantee each node will have the latest snapshot of your site. The smallest value possible is two hours. This means site changes can take up to two hours to propagate. For websites requiring up-to-date content, this is a deal breaker. Still, with page rules you can be smart and only cache the static portions of your site and leave out dynamic content.

For static sites, it's a non-issue. If it takes two hours to see new posts, I guess you'll just have to wait!

The way the caching works is that CloudFlare caches pages on the edge based on page rules

CloudFlare page rules page showing a single rule of */blogthedata.com/*

I cached every page on blogthedata.com using a wildcard matching all subpages. After applying the rule, I eagerly waited two hours for a TTFB re-test. I was delighted to see massive speed increases across the board. 5-10x increases in the US. 

TTFB for US states after making changes. Values range from 90ms to 300ms

The gains are even more apparent in Asia with 10-15x increases. In Jakarta, Indonesia, users went from a 1,200ms TTFB to 70ms.

TTFB for counrtries in Asia after making changes. Values range from 31ms to 300ms

You can see CloudFlare's edge network in play by checking HTTP response headers. If you see 'cf-cache-status HIT', that means CloudFlare served the resource instead of your hosting server.

Image of HTTP headers in chrome dev tools. cf-cache-status is highlighted as HIT.

Conclusion

Adding your website to a CDN edge network can improve page load dramatically for users accessing your site around the world. After adding my site to CloudFlare, some locations had a 17x faster TTFB (time to first byte). The drawback is that it can take up to two hours to see new content.

Add some (or all) of your site to a CDN edge network and reap the benefits of a faster TTFB for your users!

Comments

Back to Home
John Solly Profile Picture
John Solly Profile Picture

John Solly

Hi, I'm John, a Software Engineer with a decade of experience building, deploying, and maintaining cloud-native geospatial solutions. I currently serve as a senior software engineer at HazardHub (A Guidewire Offering), where I work on a variety of infrastructure and application development projects.

Throughout my career, I've built applications on platforms like Esri and Mapbox while also leveraging open-source GIS technologies such as OpenLayers, GeoServer, and GDAL. This blog is where I share useful articles with the GeoDev community. Check out my portfolio to see my latest work!