Information for: DEVELOPERS   PARTNERS

Using Varnish

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

Serving pages from memory is much faster than serving them from the Drupal/Apache/MySQL/PHP stack, and also frees up resources on the server 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.

Varnish logs are not available for log streaming in the Cloud Platform interface, but 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.

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

You cannot configure Varnish yourself. Acquia has configured the shared Varnish installation in a way we believe is optimal for most applications. If you are a Cloud Platform Enterprise customer, and you have dedicated load balancers, custom Varnish configurations may be available through an Acquia Professional Services engagement. See Custom Varnish configuration for Cloud Platform Enterprise applications Cloud Platform Enterprise and contact your Acquia account manager for more information.

Do not install the Varnish Drupal module on applications hosted on Cloud Platform. The module requires connections to the load balancers which Acquia does not provide, and the module will not work properly.

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 instances 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 Varnish cache

You can clear (flush or purge) the Varnish cache using the Cloud Platform interface:

  1. Sign in to Cloud Platform as a user with the clear Varnish permission for the environment you want to clear.
  2. Select your application and environment.
  3. On the Overview page for the environment, click Clear Varnish.
  4. In the Clear caches dialog box, select the domains for which you want to clear the Varnish caches. You can click All to clear the Varnish caches for all domains in this environment. Then click Clear to confirm. All check boxes are selected by default, and your selections are maintained.

You can also purge individual pages from Varnish cache with 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.