
Website Hosting
Touchstone Energy® Achieves WebOps Excellence to Better Serve Their Members
Learn how Touchstone Energy migrated 500+ sites to Pantheon in just five months to provide a better digital experience to their members.
Discover how to balance speed and freshness in CDNs. Learn about performance, caching, and smart cache keys to optimize your site's content delivery.
To build a website today, there’s a lot to get right: performance, scalability, security (including HTTPS), functionality, search-engine rankings, and more. These come down to getting fresh content into the hands of site visitors—and doing it fast. CDN-based edge caching goes a long way to helping here, but it’s only as effective as the cache hit rate.
“When the cache hits” matters enormously, especially as site traffic climbs. Clearly, a site with no caching can cut existing origin traffic in half by achieving a 50% hit rate. But, the same is true for a move from 50% to 75% and even 98% to 99%. Refining the hit rate for a site—even one that already has an excellent rate—never stops delivering (proportionally) major benefits to the origin. That benefit can manifest as lower costs, better tolerance for traffic spikes, and better resilience when under attack.
Yet, requests can only hit the cache effectively if everything below is a “yes”:
Traditionally, these goals have competed. You could prefer fast and stale (long lifetimes) or fresh and slow (less cacheable content and shorter lifetimes). This is because, for a given URL, a cache likes to hang onto that content until it’s lived out its lifetime (“Cache-Control: max-age”); only then does it check to see if there’s fresher content available. In terms of business value, this raises a question: “How stale am I willing to tolerate this page being in order to improve hit rates?”
To be fair, there are a couple workarounds. They just have trade offs or limited applicability:
Both workarounds try to twist basic aspects of HTTP caching to get control that it was never designed to provide, and it shows. There has to be a better way!
Rather than serving up stale content or convoluted URLs, there’s a way to mark a response delivered from the web server according to what ingredients went into it. It’s sort of like putting a lot number on the responses—except you can add more than one. To invalidate the cache, the CMS specifies the “keys” that have changed.
The technology works like this (using Drupal in this case):
Getting this working traditionally required a lot of steps:
And, because of all the services and integrations, this approach only gets us to fast, fresh, simple (pick two). This is better than just fast vs. fresh, but what if we could automate the complexity away and get the best of all worlds?
To make this a reality, we’ve built a plugin (for WordPress) and a module (for Drupal) that—when used on the Pantheon platform—handle everything above:
This approach works by using the built-in cache keying in WordPress/Drupal and integrating it with Pantheon’s container grid and Global CDN.
Unfortunately, there’s limited standardization in the world of HTTP for explicitly invalidating cached content. But, the situation isn’t too divergent; the Varnish Surrogate-Key approach is functionally identical to other implementations (where they exist).
So, this functionality on Pantheon’s Global CDN is similar to alternative services and open-source tools, but it’s not something a site owner can simply expect on every CDN or proxy cache. Using those other tools also requires manual setup and integration.
Mostly, we’ve talked about the benefits of Surrogate-Key in terms of achieving fast, fresh content, but the approach also helps boost uptime. The internet is a noisy place, and backbones, peering relationships, and origins can all have issues from time to time. By storing content for a long time in a site’s CDN (and explicitly invalidating or purging it only when necessary), the CDN will happily “hit” far more often—including when a deeper level of infrastructure is having issues. When there’s a problem, this can make the difference between having a read-only site available to visitors versus nothing at all.
Edge optimizations tend to stack well. Faster HTTPS negotiation, higher hit rates, and optimized protocols (like HTTP/2) all work together to get pages displayed faster (time to first paint, or TTFP) on the devices of site visitors.
But, it’s easy to over-focus on particular optimizations. Using granular cache keys is a way to take a site from “good” to “great,” but it’s always a good idea to run a fresh analysis every time a site has major changes (both for optimizations and other changes). This will ensure that, at every step, you’re focused on the biggest possible improvement—or at least the lowest-hanging fruit.

Website Hosting
Learn how Touchstone Energy migrated 500+ sites to Pantheon in just five months to provide a better digital experience to their members.

Website Optimization
Customers using decoupled frameworks on Pantheon can now opt in to a faster build pipeline to cut build times by upwards of 80%

Developer Tools
Pantheon increases the PHP memory limit for Performance and Elite plans to help websites handle more complex tasks, process data faster and provide better UX.