Port 80

Accelerating Your

Website with Varnish Cache


  • Squixa and section.io
  • Why you need a fast website
  • Problems making websites fast
  • How to make your website fast using Varnish
  • Implementing Varnish
  • Demo - View of Varnish from section.io

Squixa and section.io

  • We do web performance
  • Web optimisation platform (CDN, Site specific optimisations and metrics)
  • Performance consulting
  • section.io - New Varnish as a service platform

Why you need a fast site


Google study - 0.5 seconds slower = 20% less clicks

Amazon study - 100ms faster = 1% revenue

  • SEO (and Site speed)
    • Organic search 
    • Adwords (PPC performance - landing pages)

The Problem - Why sites are slow

  • 2 broad areas that make up page load (Frontend/Backend time)
  • What is a page load
    • A click through to completed page
    • A number of events happen end to end
    • Identifying which events are causing issues

Page Load Technical View

  • Backend time = HTML Document
  • Frontend time = Just about everything else

Why sites are slow

  • General industry best practice = 80% frontend
  • We have found ~50% of page load is spent in backend
  • Frontend performance issues are easier to solve
    • CDN's
    • Review javascript executing on your site
    • Optimise images

How to solve backend performance

  • HTML document performance issues are hard
  • HTML document generation is important to improve
    • Seeing nothing is ugly
    • Most of your hosting cost is spent making HTML documents (Server CPU)
  • Caching HTML documents in Varnish eliminates performance issues
    • Varnish - Introduction

Varnish Cache

A caching HTTP reverse proxy

Decide Cacheability

  • Must be a GET request, not a POST.
  • No cookies in the request.
  • Response Cache-Control header allows caching.
  • No cookies in the response.

Improve Caching

  1. Identify which resources are user-specific.
  2. Strip cookies from non-user specific requests and responses.
  3. Tune the Cache-Control response headers.
  4. Conditionally strip cookies by user workflow.

Install Varnish

apt-get install varnish


yum install varnish

Configure Varnish

Varnish Operations

  1. varnishlog
  2. varnishtop
  3. varnishstat
  4. varnishhist

Varnish and Development

  • Effective Varnish is tailored for your site
  • Changes to your site will be reflected in Varnish

Varnish High Availability

  1. Varnish exists between your users and your website.
  2. Varnish's state is mostly ephemeral.

Varnish at Squixa

Enter section.io


Thank you

  • www.section.io
  • Matt Johnson <matt@section.io>
  • Jason Stangroome @jstangroome