Cloud Platform

Using Varnish


Varnish® cache is a caching reverse proxy installed in front of all Cloud Platform load balancing infrastructure. Varnish increases application performance by caching anonymous user connections and serving them from memory instead of making requests to the Apache web infrastructure.

Serving pages from memory is much faster than serving them from the Drupal/Apache/MySQL/PHP stack, and also frees up resources on the infrastructure and database to handle the dynamic requests Varnish cannot handle. If Varnish can’t fulfill a page request, Varnish passes the request through to the Drupal/Apache/MySQL/PHP stack. If the response from Apache is cacheable, Varnish stores the response for faster responses to future requests.

You cannot download Varnish logs through the Cloud Platform user interface. However, subscriptions with dedicated load balancers can forward Varnish logs to an external service.

For more information about using Varnish, see Introduction to Varnish.

What Varnish caches

Varnish caches responses to anonymous user requests. It also caches static assets, such as images, JavaScript, and CSS, both for anonymous and authenticated user requests, assuming the assets are not stored in the Drupal private file system. Certain file types will always be excluded from Varnish caching, and you can alter the caching behavior of other file types by creating a custom caching policy per file type.

404 and 301 caching

Cloud Platform Varnish enforces a minimum caching policy of 15 minutes on HTTP 404 and 301 responses unless the backend provides for a higher value. If this is an undesirable behavior, contact Acquia Support.

Learn more
Files larger than 10 MB are not cached

On Cloud Platform, Varnish can cache files smaller than 10 MB in size, but never caches any object greater than 10 MB in size.

Learn more

To determine how Varnish caching is working with your application, you can examine the Varnish caching headers sent with each page and asset request. For more information, see Varnish headers.

Configuring Varnish

Varnish configuration is a complicated task. Therefore, Acquia has configured the shared Varnish installation in a way that is optimal for most applications. For Cloud Platform Enterprise customers with dedicated load balancers, certain customizations of the Varnish configurations might be available. For more information, see Custom Varnish configuration and contact your Acquia account manager.

Do not install the Varnish Drupal module on applications hosted on Cloud Platform. The module does not work as expected because it requires connections to load balancers, which Acquia does not provide.

Configuring Drupal cache settings for Varnish

You must configure your Drupal application to take advantage of Varnish. For information on how to do so, see Configuring Drupal cache settings for Varnish.

Bypassing the Varnish cache

Sometimes you may have a few pages with random or dynamic content you do not want cached. You can selectively exclude certain paths from caching so dynamic content is actually dynamic. These requests will be routed round-robin to infrastructure in your web tier. For more information, see Bypassing the Varnish cache.

Varnish over SSL

Acquia provides Varnish for use with connections secured by SSL, which is enabled by default for subscribers of the following products:

  • Cloud Platform Professional
  • Cloud Platform Enterprise
  • Site Factory

For additional information about using Varnish over SSL to protect your website, see the Best practices for a fully SSL-protected site Acquia Knowledge Base article.

Clearing the cache

You can clear (flush or purge) the Varnish or CDN cache using the Cloud Platform user interface.

  1. Sign in to the Cloud Platform user interface as a user with the clear caches permission for the environment you want to clear.
  2. Select your application and environment.
  3. On the Overview page for the selected environment, click Actions and select Clear Caches.
  4. In the environment specific dialog box, select the domains for which you want to clear the caches. You can click All to clear the caches for all domains in this environment. By default, all checkboxes are selected.
  5. Click Clear to confirm.

You can also purge individual pages by using the Acquia Purge module user interface, or with command-line commands. For more information, see Purging Varnish cache on Cloud Platform.

Varnish is a registered trademark of Varnish Software AB and its affiliates.