varnish #2

Supports: trusty
Add to new model


Varnish Cache is a state of the art web accelerator written with
performance and flexibility in mind. Varnish Cache stores web pages
in memory so web servers don't have to create the same web page over
and over again. Varnish serves pages much faster than any application
server; giving the website a significant speed up. Some of the
features include: * A modern design * VCL - a very flexible
configuration language * Load balancing with health checking of
backends * Partial support for ESI - Edge Side Includes * URL
rewriting * Graceful handling of "dead" backends

Juju Charm: varnish
Author: Nathan Williams


Varnish Cache is a "web application accelerator", or an HTTP reverse
proxy. By deploying varnish in front of an HTTP server, it can speed up
delivery by a factor of 300-1000x, depending on configuration.

What makes Varnish Cache so powerful is the Varnish Cache Language (VCL). By
using VCL to configure Varnish Cache for your site, you can see
remarkable performance improvements.

This varnish charm has also been set up to use a self-policing, round-
robin load-balancer (director) that distributes the load between your
HTTP backends. Any backends defined by related website relations will
be monitored, and in the event that they repeatedly fail to respond,
Varnish Cache will stop sending it requests until it is healthy.


Varnish Cache requires a backend that serves content with HTTP.

Getting started deploying Varnish

Bootstrap your juju environment:

juju bootstrap

Deploy a varnish (reverse-proxy) instance:

juju deploy varnish

Expose the service:

juju expose varnish

Connect varnish and wordpress:

juju add-relation varnish wordpress

Configuring Varnish

Configuration options:

The varnish charm allows you to configure varnish's listening port in
your own config.yaml.

Tune your Varnish Cache deployment:

It also includes some common-sense tuning tweaks in data/extra.vcl.

If you wish to add extra (application-specific?) configuration, feel
free to add your VCL changes to data/extra.vcl. It shouldn't interfere
with the charm deployment, and will retain the round-robin director as
as long as you keep the following line in your vcl_receive:

set req.backend = balance;

More Information

To verify Varnish Cache is delivering cached content, check the HTTP
headers by running the following command twice:

curl -I -H "Host: <backend address>" http://<varnish address>/

To verify the site content is delivered from the backend:

curl -H "Host:"

For more information about Varnish Cache, check out their official docs:

Improvements? Bugs?

If you find a bug, or know any optimization tricks that are application
agnostic, let us know!


(int) varnish listening port