Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Steam Learn : Varnish or How to reduce the load of your web server
1. 22th of January, 2015
How to reduce the load of
your web server
With Varnish
by Clément Beudot
2. 22th of January, 2015
Introduction
● What is Varnish
● Purpose of Varnish
● Varnish Request Life Cycle
● Performances : Apache vs Varnish
● Strength & Limitations
● Advanced features
3. 22th of January, 2015
Quick Quiz !
Calculate, without using your smartphone
45 x 12
4. 22th of January, 2015
Quick Quiz !
Calculate, without using your smartphone
45 x 12 = 540
6. 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
7. 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
8. 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)
9. 22th of January, 2015
Varnish Request Life Cycle
Cache Miss
RECV
HASH PIPE
HIT MISS
PASS
FETCH
DELIVER
WEB SERVER
10. 22th of January, 2015
Varnish Request Life Cycle
Cache Hit
RECV
HASH PIPE
HIT MISS
PASS
FETCH
DELIVER
WEB SERVER
11. 22th of January, 2015
Varnish Request Life Cycle
Cache Pass
RECV
HASH PIPE
HIT MISS
PASS
FETCH
DELIVER
WEB SERVER
12. 22th of January, 2015
Varnish Request Life Cycle
Cache Pipe
RECV
HASH PIPE
HIT MISS
PASS
FETCH
DELIVER
WEB SERVER
15. 22th of January, 2015
Performances :
Apache vs Varnish
Really easy for Varnish !
16. 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
17. 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
19. 22th of January, 2015
Varnish :
Advanced Features & Assets
● E.S.I. Support
● Control varnish via CLI or dedicated modules
● “Always online”
20. 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.
21. 22th of January, 2015
How to reduce
the load of your web server
with varnish
Thank You
22. 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 of
RAM ?
How I can change the
TTL for a page ?
What if all my
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 ?
23. 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/