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.
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.
- Sign in to the Cloud Platform user interface as a user with the clear caches permission for the environment you want to clear.
- Select your application and environment.
- On the Overview page for the selected environment, click Actions and select Clear Caches.
- 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.
- 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.