SlideShare a Scribd company logo
1	
  
Varnish	
  –	
  More	
  than	
  a	
  cache	
  
Bernd Löffeld
Head of Platform Development
Magic Internet GmbH
Email: Bernd.Loeffeld@magicinternet.de
Magic Internet entwickelt und betreut
www.myvideo.de
Deutschlands großes Videoportal!
Varnish	
  Features	
  
2	
  
o  Caching	
  
o  Loadbalancing	
  and	
  Backend-­‐Selec3on	
  
o  Header	
  analysis	
  and	
  manipula3on	
  
o  DSL	
  for	
  handling	
  all	
  that	
  
o  Edge	
  Side	
  Includes	
  
Varnish	
  Subrou5nes	
  
3	
  
Varnish	
  Configura5on	
  Language	
  in	
  example	
  
4	
  
sub vcl_recv {!
if (req.restarts == 0) {!
if (req.http.x-forwarded-for) {!
set req.http.X-Forwarded-For =!
req.http.X-Forwarded-For + ", " + client.ip;!
} else {!
set req.http.X-Forwarded-For = client.ip;!
}!
}!
if (req.request != "GET" &&!
req.request != "HEAD" &&!
req.request != "PUT" &&!
req.request != "POST" &&!
req.request != "TRACE" &&!
req.request != "OPTIONS" &&!
req.request != "DELETE") {!
return (pipe);!
}!
if (req.request != "GET" && req.request != "HEAD") {!
/* We only deal with GET and HEAD by default */!
return (pass);!
}!
if (req.http.Authorization || req.http.Cookie) {!
return (pass);!
}!
return (lookup);!
}!
The	
  Setup	
  –	
  A	
  vision	
  by	
  now	
  
5	
  
Start:	
  Just	
  a	
  simple	
  Web	
  Applica5on	
  
6	
  
Start:	
  Just	
  a	
  simple	
  Web	
  Applica5on	
  
7	
  
Step	
  1:	
  Ac5vate	
  the	
  cache	
  
8	
  
Step	
  1:	
  Ac5vate	
  the	
  cache	
  
9	
  
include "bwb/backends.vcl“;
Varnish à /etc/varnish/main.vcl
backend default {
.host = "nginx-1";
.port = "80";
}
Varnish à /etc/varnish/bwb/backends.vcl
server {
expires 1m;
}
nginx-1 à /etc/nginx/sites-available/bwb
Step	
  1:	
  Ac5vate	
  the	
  cache	
  
10	
  
Step	
  2:	
  Introduce	
  new	
  Backend	
  
11	
  
Step	
  2:	
  Introduce	
  new	
  Backend	
  
12	
  
include "bwb/backends.vcl";
sub vcl_recv {
if (req.url ~ "/fancy/") {
set req.backend = fancy;
}
}
Varnish à /etc/varnish/main.vcl
backend default {
.host = "nginx-1";
.port = "80";
}
backend fancy {
.host = "nginx-2";
.port = "80";
}
Varnish à /etc/varnish/bwb/backends.vcl
Step	
  2:	
  Introduce	
  new	
  Backend	
  
13	
  
<html>
<head>
<title>Legacy Web Application</title>
<link href="/fancy/css/default.css" rel="stylesheet"
type="text/css" media="all" />
</head>
...
nginx-1 à /srv/www/bwb/page1.html
Step	
  2:	
  Introduce	
  new	
  Backend	
  
14	
  
Step	
  2:	
  Introduce	
  new	
  Backend	
  
15	
  
Step	
  3:	
  Connect	
  the	
  Applica5ons	
  with	
  ESI	
  
16	
  
Step	
  3:	
  Connect	
  the	
  Applica5ons	
  with	
  ESI	
  
17	
  
<body>
<!-- Old Navigation HTML was removed!-->
<esi:include src="/fancy/nav/navigation.html" />
<h1>Just a robust and experienced application</h1>
<div>Page 1 is mostly empty.</div>
<esi:include src="/fancy/news/abox.html" />
</body>
nginx-1 à /srv/www/bwb/page1.html
include "bwb/backends.vcl";
sub vcl_recv {
if (req.url ~ "/fancy/") { set req.backend = fancy; }
}
sub vcl_fetch {
set beresp.do_esi = true;
}
Varnish à /etc/varnish/main.vcl
Step	
  3:	
  Connect	
  the	
  Applica5ons	
  with	
  ESI	
  
18	
  
<div class="container newsbox">
<h1>News</h1>
<div>really hot new stuff to read</div>
</div>
nginx-2 à /srv/www/bwb-fancy/fancy/news/abox.html
server {
...
location /fancy/news/ {
expires 10s;
}
}
nginx-2 à /etc/nginx/sites-available/bwb-fancy
Step	
  3:	
  Connect	
  the	
  Applica5ons	
  with	
  ESI	
  
19	
  
Step	
  3:	
  Connect	
  the	
  Applica5ons	
  with	
  ESI	
  
20	
  
Step	
  4:	
  Simple	
  balancing	
  between	
  two	
  backends	
  
21	
  
Step	
  4:	
  Simple	
  balancing	
  between	
  two	
  backends	
  
22	
  
backend default { … }
backend fancy_1 {
.host = "nginx-2";
.port = "80";
}
backend fancy_2 {
.host = "nginx-3";
.port = "80";
}
varnish à /etc/varnish/bwb/backends.vcl
director fancy_round round-robin {
{
.backend = fancy_1;
}
{
.backend = fancy_2;
}
}
Varnish à /etc/varnish/bwb/director.vcl
Step	
  4:	
  Simple	
  balancing	
  between	
  two	
  backends	
  
23	
  
include "bwb/backends.vcl";
include "bwb/director.vcl";
sub vcl_recv {
if(req.url ~ "/fancy/") {
set req.backend = fancy_round;
}
}
varnish à /etc/varnish/main.vcl
Step	
  4:	
  Simple	
  balancing	
  between	
  two	
  backends	
  
24	
  
192.168.56.5 - -
[28/Sep/2013:19:51:57 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:52:28 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:52:51 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:53:17 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100
access-log nginx-1
192.168.56.5 - -
[28/Sep/2013:19:52:14 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:52:39 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:53:05 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100 “
192.168.56.5 - -
[28/Sep/2013:19:53:31 +0200]
"GET /fancy/news/abox.html
HTTP/1.1" 200 100
access-log nginx-2
Want	
  to	
  know	
  more?	
  
25	
  
Bernd.Loeffeld@magicinternet.de	
  
hCp://www.myvideo.de/karriere	
  
Work	
  with	
  us!	
  
o  Architect	
  
o  Developer	
  
o  Sysadmin	
  

More Related Content

What's hot

WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to EverythingWordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
topher1kenobe
 
Websockets in Node.js - Making them reliable and scalable
Websockets in Node.js - Making them reliable and scalableWebsockets in Node.js - Making them reliable and scalable
Websockets in Node.js - Making them reliable and scalableGareth Marland
 
The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2
Andy Davies
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossugclkao
 
The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015
Andy Davies
 
Front-End Performance Optimizing
Front-End Performance OptimizingFront-End Performance Optimizing
Front-End Performance Optimizing
Michael Pehl
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
Gerard Sychay
 
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offlineDevelop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Jan Jongboom
 
Blazor - An Introduction
Blazor - An IntroductionBlazor - An Introduction
Blazor - An Introduction
JamieTaylor112
 
The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix them
Otto Kekäläinen
 
PHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHPPHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHP
Jonathan Klein
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notes
Perrin Harkins
 
Web application intro
Web application introWeb application intro
Web application intro
Tobias Pfeiffer
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
Chris Love
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
Andy Davies
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello Blazor
Ed Charbeneau
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Perrin Harkins
 
.htaccess for SEOs - A presentation by Roxana Stingu
.htaccess for SEOs - A presentation by Roxana Stingu.htaccess for SEOs - A presentation by Roxana Stingu
.htaccess for SEOs - A presentation by Roxana Stingu
Roxana Stingu
 
Scaling my sql_in_3d
Scaling my sql_in_3dScaling my sql_in_3d
Scaling my sql_in_3d
sarahnovotny
 

What's hot (20)

WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to EverythingWordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
 
Websockets in Node.js - Making them reliable and scalable
Websockets in Node.js - Making them reliable and scalableWebsockets in Node.js - Making them reliable and scalable
Websockets in Node.js - Making them reliable and scalable
 
The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossug
 
The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015
 
Front-End Performance Optimizing
Front-End Performance OptimizingFront-End Performance Optimizing
Front-End Performance Optimizing
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offlineDevelop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
 
Blazor - An Introduction
Blazor - An IntroductionBlazor - An Introduction
Blazor - An Introduction
 
The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix them
 
PHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHPPHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHP
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notes
 
Web application intro
Web application introWeb application intro
Web application intro
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello Blazor
 
Metarefresh
MetarefreshMetarefresh
Metarefresh
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
 
.htaccess for SEOs - A presentation by Roxana Stingu
.htaccess for SEOs - A presentation by Roxana Stingu.htaccess for SEOs - A presentation by Roxana Stingu
.htaccess for SEOs - A presentation by Roxana Stingu
 
Scaling my sql_in_3d
Scaling my sql_in_3dScaling my sql_in_3d
Scaling my sql_in_3d
 

Similar to Varnish more than a cache

T3DD12 Caching with Varnish
T3DD12 Caching with VarnishT3DD12 Caching with Varnish
T3DD12 Caching with Varnish
AOE
 
Performance
PerformancePerformance
Performance
Varnish Software
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
ACCESS
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera Software
Cosimo Streppone
 
Going crazy with Varnish and Symfony
Going crazy with Varnish and SymfonyGoing crazy with Varnish and Symfony
Going crazy with Varnish and Symfony
David de Boer
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
Carsten Sandtner
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Marcus Deglos
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!
David Sanchez
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web Hosting
OVHcloud
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
Alfresco Software
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budget
David Lukac
 
June8 presentation
June8 presentationJune8 presentation
June8 presentationnicobn
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
Damilola Longe, CISSP, CCSP, MSc
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Ontico
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
FDConf
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
Jan Jongboom
 
My Opera meets Varnish, Dec 2009
My Opera meets Varnish, Dec 2009My Opera meets Varnish, Dec 2009
My Opera meets Varnish, Dec 2009
Cosimo Streppone
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loader
Sadayuki Furuhashi
 

Similar to Varnish more than a cache (20)

T3DD12 Caching with Varnish
T3DD12 Caching with VarnishT3DD12 Caching with Varnish
T3DD12 Caching with Varnish
 
Performance
PerformancePerformance
Performance
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera Software
 
Going crazy with Varnish and Symfony
Going crazy with Varnish and SymfonyGoing crazy with Varnish and Symfony
Going crazy with Varnish and Symfony
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web Hosting
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budget
 
June8 presentation
June8 presentationJune8 presentation
June8 presentation
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
My Opera meets Varnish, Dec 2009
My Opera meets Varnish, Dec 2009My Opera meets Varnish, Dec 2009
My Opera meets Varnish, Dec 2009
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loader
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Varnish more than a cache

  • 1. 1   Varnish  –  More  than  a  cache   Bernd Löffeld Head of Platform Development Magic Internet GmbH Email: Bernd.Loeffeld@magicinternet.de Magic Internet entwickelt und betreut www.myvideo.de Deutschlands großes Videoportal!
  • 2. Varnish  Features   2   o  Caching   o  Loadbalancing  and  Backend-­‐Selec3on   o  Header  analysis  and  manipula3on   o  DSL  for  handling  all  that   o  Edge  Side  Includes  
  • 4. Varnish  Configura5on  Language  in  example   4   sub vcl_recv {! if (req.restarts == 0) {! if (req.http.x-forwarded-for) {! set req.http.X-Forwarded-For =! req.http.X-Forwarded-For + ", " + client.ip;! } else {! set req.http.X-Forwarded-For = client.ip;! }! }! if (req.request != "GET" &&! req.request != "HEAD" &&! req.request != "PUT" &&! req.request != "POST" &&! req.request != "TRACE" &&! req.request != "OPTIONS" &&! req.request != "DELETE") {! return (pipe);! }! if (req.request != "GET" && req.request != "HEAD") {! /* We only deal with GET and HEAD by default */! return (pass);! }! if (req.http.Authorization || req.http.Cookie) {! return (pass);! }! return (lookup);! }!
  • 5. The  Setup  –  A  vision  by  now   5  
  • 6. Start:  Just  a  simple  Web  Applica5on   6  
  • 7. Start:  Just  a  simple  Web  Applica5on   7  
  • 8. Step  1:  Ac5vate  the  cache   8  
  • 9. Step  1:  Ac5vate  the  cache   9   include "bwb/backends.vcl“; Varnish à /etc/varnish/main.vcl backend default { .host = "nginx-1"; .port = "80"; } Varnish à /etc/varnish/bwb/backends.vcl server { expires 1m; } nginx-1 à /etc/nginx/sites-available/bwb
  • 10. Step  1:  Ac5vate  the  cache   10  
  • 11. Step  2:  Introduce  new  Backend   11  
  • 12. Step  2:  Introduce  new  Backend   12   include "bwb/backends.vcl"; sub vcl_recv { if (req.url ~ "/fancy/") { set req.backend = fancy; } } Varnish à /etc/varnish/main.vcl backend default { .host = "nginx-1"; .port = "80"; } backend fancy { .host = "nginx-2"; .port = "80"; } Varnish à /etc/varnish/bwb/backends.vcl
  • 13. Step  2:  Introduce  new  Backend   13   <html> <head> <title>Legacy Web Application</title> <link href="/fancy/css/default.css" rel="stylesheet" type="text/css" media="all" /> </head> ... nginx-1 à /srv/www/bwb/page1.html
  • 14. Step  2:  Introduce  new  Backend   14  
  • 15. Step  2:  Introduce  new  Backend   15  
  • 16. Step  3:  Connect  the  Applica5ons  with  ESI   16  
  • 17. Step  3:  Connect  the  Applica5ons  with  ESI   17   <body> <!-- Old Navigation HTML was removed!--> <esi:include src="/fancy/nav/navigation.html" /> <h1>Just a robust and experienced application</h1> <div>Page 1 is mostly empty.</div> <esi:include src="/fancy/news/abox.html" /> </body> nginx-1 à /srv/www/bwb/page1.html include "bwb/backends.vcl"; sub vcl_recv { if (req.url ~ "/fancy/") { set req.backend = fancy; } } sub vcl_fetch { set beresp.do_esi = true; } Varnish à /etc/varnish/main.vcl
  • 18. Step  3:  Connect  the  Applica5ons  with  ESI   18   <div class="container newsbox"> <h1>News</h1> <div>really hot new stuff to read</div> </div> nginx-2 à /srv/www/bwb-fancy/fancy/news/abox.html server { ... location /fancy/news/ { expires 10s; } } nginx-2 à /etc/nginx/sites-available/bwb-fancy
  • 19. Step  3:  Connect  the  Applica5ons  with  ESI   19  
  • 20. Step  3:  Connect  the  Applica5ons  with  ESI   20  
  • 21. Step  4:  Simple  balancing  between  two  backends   21  
  • 22. Step  4:  Simple  balancing  between  two  backends   22   backend default { … } backend fancy_1 { .host = "nginx-2"; .port = "80"; } backend fancy_2 { .host = "nginx-3"; .port = "80"; } varnish à /etc/varnish/bwb/backends.vcl director fancy_round round-robin { { .backend = fancy_1; } { .backend = fancy_2; } } Varnish à /etc/varnish/bwb/director.vcl
  • 23. Step  4:  Simple  balancing  between  two  backends   23   include "bwb/backends.vcl"; include "bwb/director.vcl"; sub vcl_recv { if(req.url ~ "/fancy/") { set req.backend = fancy_round; } } varnish à /etc/varnish/main.vcl
  • 24. Step  4:  Simple  balancing  between  two  backends   24   192.168.56.5 - - [28/Sep/2013:19:51:57 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:52:28 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:52:51 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:53:17 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 access-log nginx-1 192.168.56.5 - - [28/Sep/2013:19:52:14 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:52:39 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:53:05 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 “ 192.168.56.5 - - [28/Sep/2013:19:53:31 +0200] "GET /fancy/news/abox.html HTTP/1.1" 200 100 access-log nginx-2
  • 25. Want  to  know  more?   25   Bernd.Loeffeld@magicinternet.de   hCp://www.myvideo.de/karriere   Work  with  us!   o  Architect   o  Developer   o  Sysadmin