Skip to main content

Varnish on Drupal - The Benefits of Reverse Proxy Caching

Lots of Drupal and Varnish information is available already, such as https://drupal.org/node/1054886. I don’t wish to cover old ground but thought I’d post some bench test results I’d gathered as part of an enterprise site I’ve recently been working on.

While all things are relative and each site faces it’s own challenges, these benchtests are fairly illustrative of the benefits of reverse proxy caching.

In this case Varnish was the reverse proxy (we use the Nginx webserver in our Edge Cache) and the site exclusively serves anonymous user requests.

NOTES: Tests ran across a private internal network with Apache Benchmark. Each test was run 3 or more times to get a roughly mean figure. A delay was enforced between tests to account for network bursting/limiting at the DC switch, etc.

 

Drupal Cache / No Varnish

AB results:

 

Drupal and no Varnish Apache Bench

 

Graphed:

 

Drupal without Varnish bench test graph

 

We can see in this graph that Drupal Cache alone on this site was only able to handle around 20 simulations requests with sensible response times. Given this enterprise site receives millions of visits per month with revenue to match, Apache and Drupal Cache alone just don’t cut it.

Drupal Cache / With Varnish in front

AB results:

 

 

Graphed:

 

 

Here, Varnish is stable up to some large concurrent numbers (250) with minimal error responses and response times remain at a very credible 100ms up to 100 simultaneous requests with over 900 request being served per second.

Summery

If you look at this test in comparison to other benchmarks out there, the numbers don’t actually look that great, but each app is different. What we try to do as developers is find the right solution to the particular edge cases and business requirements of each application.

This very large enterprise Drupal site requires features, static assets (images, css, images, etc) and sophisticated backend integrations that inherently carry the cost of high page payload. So the question here is how do we deliver real business value by serving the high traffic volumes and ensuring flexibility and ease of maintenance.

The answer in this case is to tuck the site behind the Varnish reverse proxy server and allow the developers to focus on building cool features.