Information for: DEVELOPERS   PARTNERS

Using Varnish

Varnish® cache is a caching reverse proxy installed in front of all Acquia Cloud 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 Acquia Cloud 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 Acquia Cloud, 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 an Acquia Cloud 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 Acquia Cloud Enterprise applications Acquia Cloud Enterprise and contact your Acquia account manager for more information.

Do not install the Varnish Drupal module on applications hosted on Acquia Cloud. 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. To enable Varnish caching for your SSL-enabled website, complete the following steps:

  1. Sign in to Acquia Cloud, and then select your application and environment.
  2. On the Overview page for the environment, click the Configure gear icon.
  3. In the Varnish section, select the Varnish through SSL check box.
  4. Click Save.

The activity icon will display that the change is in progress. After the process completes, Varnish over SSL is enabled for the website.

Clearing the Varnish cache

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

  1. Sign in to Acquia Cloud, and then select your application and environment.
  2. On the Overview page for the environment, click Clear Varnish.
  3. 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 Acquia Cloud.

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