steam learn : varnish or how to reduce the load of your web server

23
22th of January, 2015 How to reduce the load of your web server With Varnish by Clément Beudot

Upload: inovia

Post on 16-Jul-2015

136 views

Category:

Software


0 download

TRANSCRIPT

22th of January, 2015

How to reduce the load of your web server

With Varnish

by Clément Beudot

22th of January, 2015

Introduction

● What is Varnish

● Purpose of Varnish

● Varnish Request Life Cycle

● Performances : Apache vs Varnish

● Strength & Limitations

● Advanced features

22th of January, 2015

Quick Quiz !

Calculate, without using your smartphone

45 x 12

22th of January, 2015

Quick Quiz !

Calculate, without using your smartphone

45 x 12 = 540

22th of January, 2015

Recurring Content

22th of January, 2015

What is Varnish

● HTTP Reverse Proxy (HTTP Accelerator)● Varnish 1.0 released in 2006, now version 4.0.2● Varnish written in C

CLIENT VARNISH Web Server

22th of January, 2015

Purpose of Varnish

● Scaling at thousands of req/s

● Caching recurring content

● Caching static resources

● Reducing load of your web servers

22th of January, 2015

Varnish Request Life Cycle

Few words to know first before seeing it !

1. HIT : requested resource has been found in the cache

2. MISS : requested resource not found.

3. PASS : bypass of varnish

4. PIPE : direct passthrough to the backend (streams)

22th of January, 2015

Varnish Request Life Cycle

Cache Miss

RECV

HASH PIPE

HIT MISS

PASS

FETCH

DELIVER

WEB SERVER

22th of January, 2015

Varnish Request Life Cycle

Cache Hit

RECV

HASH PIPE

HIT MISS

PASS

FETCH

DELIVER

WEB SERVER

22th of January, 2015

Varnish Request Life Cycle

Cache Pass

RECV

HASH PIPE

HIT MISS

PASS

FETCH

DELIVER

WEB SERVER

22th of January, 2015

Varnish Request Life Cycle

Cache Pipe

RECV

HASH PIPE

HIT MISS

PASS

FETCH

DELIVER

WEB SERVER

22th of January, 2015

Performances : Apache vs VarnishUsing Varnish on a low complexity page

** SIEGE 2.70** Preparing 200 concurrent users.

Transactions: 2298 hitsAvailability: 100.00 %Elapsed time: 29.83 secsData transferred: 5.70 MBResponse time: 0.00 secsTransaction rate: 77.04 trans/secLongest transaction: 0.01 secsShortest transaction: 0.00 secs

** SIEGE 2.70** Preparing 200 concurrent users.

Transactions: 1763 hitsAvailability: 100.00 %Elapsed time: 29.99 secsData transferred: 4.36 MBResponse time: 0.76 secsTransaction rate: 58.79 trans/secLongest transaction: 1.88 secsShortest transaction: 0.07 secs

22th of January, 2015

Performances : Apache vs VarnishUsing Varnish on high complexity page

** SIEGE 2.70** Preparing 200 concurrent users.

Transactions: 2298 hitsAvailability: 100.00 %Elapsed time: 29.83 secsData transferred: 5.70 MBResponse time: 0.00 secsTransaction rate: 77.04 trans/secLongest transaction: 0.01Shortest transaction: 0.00

** SIEGE 2.70** Preparing 200 concurrent users.

Transactions: 65 hitsAvailability: 100.00 %Elapsed time: 29.59 secsData transferred: 1.35 MBResponse time: 14.97 secsTransaction rate: 2.20 trans/secLongest transaction: 28.22 secsShortest transaction: 1.39 secs

** SIEGE 2.70** Preparing 200 concurrent users.

Transactions: 2390 hitsAvailability: 100.00 %Elapsed time: 29.84 secsData transferred: 49.49 MBResponse time: 0.00 secsTransaction rate: 80.09 trans/secLongest transaction: 0.01 secsShortest transaction: 0.00 secs

22th of January, 2015

Performances : Apache vs VarnishReally easy for Varnish !

22th of January, 2015

Varnish Strengths

● Scaling to thousands of reqs/ s

● Load Balancing capability with Backend Health Check

● Ability to Manage the request life cycle

● Easy to partially integrate in your S.I

22th of January, 2015

Varnish Limitations

● HTTPS

● Only designed for GET & HEAD request

● Hates Cookies & HTTP Auth Headers

● Not recommended on 32 bits servers

● Using Varnish for a logged user on your website

22th of January, 2015

Varnish Limitations

22th of January, 2015

Varnish : Advanced Features & Assets

● E.S.I. Support

● Control varnish via CLI or dedicated modules

● “Always online”

22th of January, 2015

How to reduce the load of your web server with varnish - Summary

● HTTP Accelerator / HTTP Reverse Proxy

● Get rid of recurring content cost

● Scale at “nearly” zero cost

● And finally … reduce the load of your web server by

avoiding unnecessary calculation.

22th of January, 2015

How to reduce the load of your web server with varnish

Thank You

22th of January, 2015

How to reduce the load of your web server with varnish

Questions ?How to install it ?

Do I really need Varnish ?Can I cache in a file instead ofRAM ?

How I can change the

TTL for a page ?

What if all m

y

backends are dead ?Can I use varnish for my

logged users ?

Is Varnish really useful

for static content ?

Can I load balance on

multiple backends ?

How much RAM do I need ?

29th of January, 2015

Join the community !(in Paris)

Social networks :● Follow us on Twitter : https://twitter.com/steamlearn● Like us on Facebook : https://www.facebook.com/steamlearn

SteamLearn is an Inovia initiative : inovia.fr

You wish to be in the audience ? Join the meetup group! http://www.meetup.com/Steam-Learn/