Varnish high availability

Post on 16-Apr-2017

131 views 0 download

Transcript of Varnish high availability

LA 2016

Varnish High AvailabilityClustered cache replication

Reza Naghibi

What is VHA?

● A replication daemon

● Asynchronous (shared memory)

● Small and safe

Benefits

● Higher hit ratio

● Less backend traffic

● Constant backend traffic

● Cache consistency

Safety

● No replication complexity

● On failure, cache miss

● Lean on RFC semantics (TTL/Age)

Traditional cluster

● Shared nothing

● More nodes, more misses, more backend traffic

Traditional cluster exampleBackend

Client

VarnishVarnish

GET /foo HTTP1.1

GET /foo HTTP1.1

Traditional cluster exampleBackend

Client

VarnishVarnish

GET /foo HTTP1.1

GET /foo HTTP1.1

VHA example

VHA

Backend

VarnishVarnish

GET /foo HTTP1.1

Client

VHA example

VHA

Backend

Client

VarnishVarnish

GET /foo HTTP1.1

VHA example

VHA

Backend

Client

VarnishVarnish

HTTP1.1 200 OK

VHA example

VHA

Backend

Client

VarnishVarnish

HTTP1.1 200 OK

VHA example

VHA

Backend

Client

VarnishVarnish

HEAD /foo HTTP1.1

VHA example

VHA

Backend

Client

VarnishVarnishGET /foo HTTP1.1

VHA example

VHA

Backend

Client

VarnishVarnish

HTTP1.1 200 OK

VHA example

VHA

Backend

Client

VarnishVarnish

HTTP1.1 200 OK

Configuration

● nodes.conf

● VCL snippet

Live Demo

Worth noting

● Same configuration file

● HTTPS support

● ESI support

● Conditional requests

Advanced configuration

● Varnish in front of Varnish

● Multi region replication

● CDN architecture

Future features

● Dynamic backends, no more VCL

Thank you!Thank you!