Drupal: Overview of Caching
On its own, Drupal produces a brand new copy of each webpage every time that page is viewed. Considering most of the time the content on a given page has not changed since the last time it was viewed, this behavior is inefficient. It is also very resource intensive.
To improve page loading speed, UMN Drupal sites use caching. Caching is a technique that stores copies of webpages and provides those to viewers. When Drupal detects an update to a web page, it often will update the "cached" version of that page to give to the next viewer.
UMN Drupal sites have three kinds of caching, Drupal Cache, Varnish cache, and Content Delivery Network (CDN) cache.
Drupal Cache is the caching layer that caches page and theme elements so they don't need to be re-created every time they need to be generated.
If you are a site administrator:
- You can clear the Drupal cache by going to Configuration > Development > Performance and clicking Clear all caches
Varnish is a caching layer that stores a fully generated copy of a site's page.
You can test if the varnish cache needs to be cleared by using a "cache-busting" url. If a page doesn't look as desired when you are logged out of the site, you can append /?anything to the end of the URL to bypass the varnish cache. If the page looks as desired with the cache-busting URL, then you should proceed to clear the varnish cache. If you are needing to manually clear the varnish cache regularly, please reach out to [email protected] so we can determine if caching is setup correctly on the site.
Note: Clearing the Varnish cache is only allowed once every 10 minutes. Clearing the varnish cache has temporary negative performance implications for site visitors while the cache is being rebuilt.
If you are a site owner in Drupal Management, to clear varnish cache:
Login to Drupal Management
Navigate to the page for the site in Drupal Management
Scroll to the bottom of the page for the site and click the "Clear Varnish" button
If you are a site administrator within the site, but not site owner in Drupal Management:
Fill out a Drupal Support Request form and provide the details in the additional information box.
Content Delivery Network (CDN) Cache
The CDN is a layer on top of varnish that serves the site from a location geographically close to the visitor. The CDN also provides protection from a various number of security and performance threats, most commonly DDoS attacks.
Overview of UMN Drupal Caching
- The CDN and Varnish caches only apply to anonymous visitors to your site.
- If you are authenticated, you bypass these layers.
- However, depending on the circumstances, there may still be elements cached by the Drupal cache.
- When a contributor updates a page on the site, the Varnish cache is invalidated and an updated copy of the page will be published within 1 minute.