Hosting:Pantheon Caching - cu-uis/cu-starterkit-project GitHub Wiki

There are many layers of caching for sites hosted on Pantheon. Most people are familiar with clearing their browser cache, but there is also a render cache and edge cache. All of these caches including the browser cache are designed to keep copies of parts of the site and use the copies until an update is needed. When everything is working correctly, these caches expire or are cleared when content is updated. When something goes wrong, it may be necessary to clear one or more of the caches.

Browser Cache

The UIS Service Desk has created step by step instructions explaining how to clear the cache on various supported browsers (PDF).

Global CDN

Pantheon calls this level of caching their Global CDN, but they are simply reselling a popular service from Fastly that provides reverse proxy cache functionality with Varnish servers. Fastly has large, fast varnish servers all over the world.

Map of Hundreds of Fastly Server Locations Worldwide

When a user requests a page from online.cu.edu, Fastly first checks if there is a valid cached version of the page on a server close to that user. If the Fastly version of page is valid (the date and time it was requested is before the cached version’s expiration) the user is given the cached version. The longer the cache expiration, the more likely the cached version of the page, image or asset is valid. The more requests served directly from Fastly, the faster the site seems to anonymous users around the world (including Google for Page Rank purposes).

If the Fastly copy of a page or asset has expired, it acts as a proxy for the user and asks Drupal for a new copy. If Drupal has a valid version of the page (or parts of the page) in the Render Cache, it quickly gives that to Fastly which then gives the page to the user who requested it.

Render Cache

This is Drupal’s copy of all of the HTML, CSS, JavaScript and image derivatives needed for to render the layout of Sections and Paragraphs used on that page. These blobs of content are stored in the database. When this cache is cleared or expired, Drupal has to recreate it. This process adds to the time it takes from when a user requests a page until it is fully loaded in their browser. When a user requests a page that doesn’t exist in Fastly or Drupal’s Render Cache, the response time is noticeably slower.

The Render Cache can be cleared by Site Owners using the Flush Admin Toolbar.

The Flush all caches option is located under the Tools menu in the Admin Toolbar

Image Derivatives

Drupal is configured to resize and convert images into different formats to improve performance. The correct format and size should be served based on the user's device. As of Drupal 9.2, mobile users and modern browsers are served a WebP version by default. Image derivatives do not need to be uploaded by the users creating content. They are created by the server from the image originally uploaded. Image derivates are not included in Pantheon backups. If you restore an instance of the site from a backup, regenerating the derivates will impact performance and is normally done as HTTP requests are made by users or bots for the resources. To avoid slower responses, it is best practice to use a site crawling tool to visit each public page and rebuild the image derivatives.