SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
Varnish Cache
Step by step
Ins
e

rt

bu
sin
es

sl
og
ic
he
re
About Varnish Cache
● Web app accelerator	

● Fast	

● Flexible
VCL
•
•

Varnish Configuration Language	


•
•

Hook custom logic into the flow	


Applies to transactions that flow through the
cache	

Main hooks used: vcl_recv and vcl_fetch
About Varnish Software
● The company behind Varnish Cache	

● Offers “Varnish Plus” - consisting of:	

○

Additional software	


○

24/7 support	


○

Professional services
Goal
Knowing what to do to speed up your website.

Designing a web app for
Varnish
● Build apps from the ground up for Varnish	

● Intelligent cache usage	

● Proper cache invalidation	

● Monitoring
Incremental
implementations
● Deploy Varnish on existing apps	

● Gradually increase caching	

● “Low hanging fruits” first
Requirements
● Linux or FreeBSD	

● Virtualization is OK, not awesome	

● Tuning is only for high traffic
Step 1: Installing
Varnish
Difficulty level: Easy



Payoff: Minor
Step 1: Pass through only
● Passive Varnish	

○

return(pass) in vcl_recv	


● Powerful load balancing	

● Health checks built in	

● Excellent for debugging webapps
Step 2: Cache static
assets
Difficulty level: Trivial



Payoff: Minor
Step 2: Cache static
assets
● Cache images, CSS, Javascript	

● Backend concurrency decrease	

● Backend bandwidth decrease	

● Minor CPU usage decrease
Step 3: Compression
Difficulty level: Trivial



Payoff: Medium
Step 3: Compression
● GZip compress CSS/Javascript	

○

JQuery standard: 263KB	


○

JQuery minified: 91KB	


○

JQuery gzipped: 32KB	


● Compress in one place only	

● Reuse compression	

● Move CPU load from backend
Step 4: Semi-static
caching
Difficulty level: Medium



Payoff: High
Step 4: Semi-static
content caching
● Dynamically rendered content	

● Expensive to render	

● Almost never changes	

● Set short TTL (10-120 seconds)	

● Mitigates traffic peaks
Step 4: Semi static (2/2)
● Manual cache expiry	

● Magic URLs	

● Shift-refresh from special IP-range	

● Web interface for ban or purge
Step 5: Autopurge
Difficulty level: Medium

Payoff: High
Step 5: Autopurge
● Backend generates purge requests	

● Set TTL to ~forever	

● Invalidate on change	

● Can be difficult for composite pages	

○

Map relationships between data and pages
Step 6: Grace mode
Difficulty level: Easy



Payoff: High
Step 6: Grace mode
•

Originally developed to mitigate pile-ups


•

Can serve “graced” content when fresh content
is unavailable


•

Unavailable means 	


•
•

backend down	

object busy
Grace mode (2)
•

Both req.grace and beresp.grace must accept
the old object	


•

Tip: Set req.grace to 10s normally and 1 hour
when backend is down

Step 7: Content
composition with ESI
Difficulty level: Hard	



Payoff: High
Edge Side Includes (ESI)
Horrible Designed News Site Blah

Article	

snippet 1

Welcome, Foobar (logout)

Article	

snippet 2
Top 10 popular news items

Article	

snippet 3

Article	

snippet 4
Edge Side Includes (ESI)
TTL: 1800minutes

TTL: 30min

TTL: 60min, user specific

TTL: 30min
TTL: 1min

TTL: 30min

TTL: 30min
Step 7: Content
composition
● Edge Side Includes (ESI)	

● Split web pages into pieces	

○

Individual caching policies	


○

One piece = one URL	


● Live stitching of content	

● Works with compressed content as well
<html><body>	

... <esi:include src="/frontpage/
breaking" />	

... <esi:include src="/frontpage/latest"
/>	

... <!-- Do we like the cache to meddle
with content? -->	

</body><html>
Step 8: Advanced cache
invalidation
Difficulty level: Hard

Payoff: High
Step 8: Advanced cache
invalidation
● Sometimes a page relies on multiple “objects” for
invalidation	

● Finding out what object need to expire what pages can
be hard	

● Typically a problem in e-commerce and media
Advanced cache
invalidation (2/2)
● Tag pages with custom headers	

○

X-Skus: 49834, 34321, 4343	


● Execute with bans or hashninja 	

● Possible database driven expiry (triggers)
Conclusions
● High rewards with little work	

● 3 - 15 days to reach “high” payoff	

● Requires backend knowledge to do significant
changes	

● We talked about what to do - if you want to learn
more about how please read the book or sign up
for training.
Q &A

Mais conteúdo relacionado

Mais procurados

WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale WebinarPantheon
 
How we build Videome
How we build VideomeHow we build Videome
How we build VideomeKane Zhu
 
Drupal 8 and NGINX
Drupal 8 and NGINX Drupal 8 and NGINX
Drupal 8 and NGINX NGINX, Inc.
 
Manage react state with MobX
Manage react state with MobXManage react state with MobX
Manage react state with MobXAsif Nawaz
 
Sơ lược kiến trúc hệ thống Zing Me
Sơ lược kiến trúc hệ thống Zing MeSơ lược kiến trúc hệ thống Zing Me
Sơ lược kiến trúc hệ thống Zing Mezingopen
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordPhil Pursglove
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSOpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSAlkacon Software GmbH & Co. KG
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsBrettTasker
 
Steam Learn : Varnish or How to reduce the load of your web server
Steam Learn : Varnish or How to reduce the load of your web serverSteam Learn : Varnish or How to reduce the load of your web server
Steam Learn : Varnish or How to reduce the load of your web serverinovia
 
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...Codit
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking VN
 
The Dawson Way of Doing Things
The Dawson Way of Doing ThingsThe Dawson Way of Doing Things
The Dawson Way of Doing ThingsJonathan Perlman
 
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...Al Arabiya News Channel - Publishing articles at the speed of light with Magn...
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...Tinext SA
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen OxfordPhil Pursglove
 
Magento Cloud - Introduction
Magento Cloud - IntroductionMagento Cloud - Introduction
Magento Cloud - IntroductionOleg Posyniak
 
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...NETWAYS
 
Proxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::StaticperlProxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::Staticperlnohuhu
 

Mais procurados (20)

WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
 
How we build Videome
How we build VideomeHow we build Videome
How we build Videome
 
Drupal 8 and NGINX
Drupal 8 and NGINX Drupal 8 and NGINX
Drupal 8 and NGINX
 
Manage react state with MobX
Manage react state with MobXManage react state with MobX
Manage react state with MobX
 
Sơ lược kiến trúc hệ thống Zing Me
Sơ lược kiến trúc hệ thống Zing MeSơ lược kiến trúc hệ thống Zing Me
Sơ lược kiến trúc hệ thống Zing Me
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TSOpenCms Days 2014 - OpenCms cloud setup with the FI-TS
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
 
Handling scale on AWS
Handling scale on AWSHandling scale on AWS
Handling scale on AWS
 
Steam Learn : Varnish or How to reduce the load of your web server
Steam Learn : Varnish or How to reduce the load of your web serverSteam Learn : Varnish or How to reduce the load of your web server
Steam Learn : Varnish or How to reduce the load of your web server
 
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...
Clustering versus Always On Support: the battle (Peter Borremans @ Codit's B...
 
Node.js at Nutonian
Node.js at NutonianNode.js at Nutonian
Node.js at Nutonian
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 
The Dawson Way of Doing Things
The Dawson Way of Doing ThingsThe Dawson Way of Doing Things
The Dawson Way of Doing Things
 
Xen in the Cloud
Xen in the CloudXen in the Cloud
Xen in the Cloud
 
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...Al Arabiya News Channel - Publishing articles at the speed of light with Magn...
Al Arabiya News Channel - Publishing articles at the speed of light with Magn...
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen Oxford
 
Magento Cloud - Introduction
Magento Cloud - IntroductionMagento Cloud - Introduction
Magento Cloud - Introduction
 
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...
OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian W...
 
Proxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::StaticperlProxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::Staticperl
 

Semelhante a Varnish Cache - step by step

getting started with varnish
getting started with varnishgetting started with varnish
getting started with varnishVarnish Software
 
What is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWhat is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWPSFO Meetup Group
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
Varnish at the BBC
Varnish at the BBCVarnish at the BBC
Varnish at the BBCgrahamlyons
 
Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPChau Thanh
 
Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPVõ Duy Tuấn
 
zingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphpzingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphphazzaz
 
01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with phpNguyen Duc Phu
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017ElifTech
 
Maximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINXMaximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINXNGINX, Inc.
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPDemin Yin
 
Progressive web applications
Progressive web applicationsProgressive web applications
Progressive web applicationsTom Martin
 
Disenchantment: Netflix Titus, Its Feisty Team, and Daemons
Disenchantment: Netflix Titus, Its Feisty Team, and DaemonsDisenchantment: Netflix Titus, Its Feisty Team, and Daemons
Disenchantment: Netflix Titus, Its Feisty Team, and DaemonsC4Media
 
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 offlineJan Jongboom
 
Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...boxuno
 
The road to enterprise ready open stack storage as service
The road to enterprise ready open stack storage as serviceThe road to enterprise ready open stack storage as service
The road to enterprise ready open stack storage as serviceSean Cohen
 
A Tale of 2 Systems
A Tale of 2 SystemsA Tale of 2 Systems
A Tale of 2 SystemsDavid Newman
 
#RADC4L16: An API-First Archives Approach at NPR
#RADC4L16: An API-First Archives Approach at NPR#RADC4L16: An API-First Archives Approach at NPR
#RADC4L16: An API-First Archives Approach at NPRCamille Salas
 

Semelhante a Varnish Cache - step by step (20)

getting started with varnish
getting started with varnishgetting started with varnish
getting started with varnish
 
What is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWhat is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress Hosting
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Varnish at the BBC
Varnish at the BBCVarnish at the BBC
Varnish at the BBC
 
Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHP
 
Zingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHPZingme practice for building scalable website with PHP
Zingme practice for building scalable website with PHP
 
zingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphpzingmepracticeforbuildingscalablewebsitewithphp
zingmepracticeforbuildingscalablewebsitewithphp
 
01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php01 zingme practice for building scalable website with php
01 zingme practice for building scalable website with php
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
 
Maximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINXMaximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINX
 
Background processing with hangfire
Background processing with hangfireBackground processing with hangfire
Background processing with hangfire
 
Advanced Drupal 8 Caching
Advanced Drupal 8 CachingAdvanced Drupal 8 Caching
Advanced Drupal 8 Caching
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHP
 
Progressive web applications
Progressive web applicationsProgressive web applications
Progressive web applications
 
Disenchantment: Netflix Titus, Its Feisty Team, and Daemons
Disenchantment: Netflix Titus, Its Feisty Team, and DaemonsDisenchantment: Netflix Titus, Its Feisty Team, and Daemons
Disenchantment: Netflix Titus, Its Feisty Team, and Daemons
 
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
 
Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...
 
The road to enterprise ready open stack storage as service
The road to enterprise ready open stack storage as serviceThe road to enterprise ready open stack storage as service
The road to enterprise ready open stack storage as service
 
A Tale of 2 Systems
A Tale of 2 SystemsA Tale of 2 Systems
A Tale of 2 Systems
 
#RADC4L16: An API-First Archives Approach at NPR
#RADC4L16: An API-First Archives Approach at NPR#RADC4L16: An API-First Archives Approach at NPR
#RADC4L16: An API-First Archives Approach at NPR
 

Mais de Per Buer

IncludeOS for ics 2018
IncludeOS for ics 2018IncludeOS for ics 2018
IncludeOS for ics 2018Per Buer
 
Include os @ flossuk 2018
Include os @ flossuk 2018Include os @ flossuk 2018
Include os @ flossuk 2018Per Buer
 
Tuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish CacheTuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish CachePer Buer
 
Varnish Cache 4.0 / Redpill Linpro breakfast in Oslo
Varnish Cache 4.0 / Redpill Linpro breakfast in OsloVarnish Cache 4.0 / Redpill Linpro breakfast in Oslo
Varnish Cache 4.0 / Redpill Linpro breakfast in OsloPer Buer
 
Advanced cache invalidation
Advanced cache invalidationAdvanced cache invalidation
Advanced cache invalidationPer Buer
 
Hard parts paywall - stup
Hard parts   paywall - stupHard parts   paywall - stup
Hard parts paywall - stupPer Buer
 

Mais de Per Buer (6)

IncludeOS for ics 2018
IncludeOS for ics 2018IncludeOS for ics 2018
IncludeOS for ics 2018
 
Include os @ flossuk 2018
Include os @ flossuk 2018Include os @ flossuk 2018
Include os @ flossuk 2018
 
Tuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish CacheTuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish Cache
 
Varnish Cache 4.0 / Redpill Linpro breakfast in Oslo
Varnish Cache 4.0 / Redpill Linpro breakfast in OsloVarnish Cache 4.0 / Redpill Linpro breakfast in Oslo
Varnish Cache 4.0 / Redpill Linpro breakfast in Oslo
 
Advanced cache invalidation
Advanced cache invalidationAdvanced cache invalidation
Advanced cache invalidation
 
Hard parts paywall - stup
Hard parts   paywall - stupHard parts   paywall - stup
Hard parts paywall - stup
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

Varnish Cache - step by step

  • 1.
  • 3.
  • 5. About Varnish Cache ● Web app accelerator ● Fast ● Flexible
  • 6. VCL • • Varnish Configuration Language • • Hook custom logic into the flow Applies to transactions that flow through the cache Main hooks used: vcl_recv and vcl_fetch
  • 7.
  • 8. About Varnish Software ● The company behind Varnish Cache ● Offers “Varnish Plus” - consisting of: ○ Additional software ○ 24/7 support ○ Professional services
  • 9. Goal Knowing what to do to speed up your website.

  • 10.
  • 11. Designing a web app for Varnish ● Build apps from the ground up for Varnish ● Intelligent cache usage ● Proper cache invalidation ● Monitoring
  • 12.
  • 13. Incremental implementations ● Deploy Varnish on existing apps ● Gradually increase caching ● “Low hanging fruits” first
  • 14. Requirements ● Linux or FreeBSD ● Virtualization is OK, not awesome ● Tuning is only for high traffic
  • 15. Step 1: Installing Varnish Difficulty level: Easy
 
 Payoff: Minor
  • 16. Step 1: Pass through only ● Passive Varnish ○ return(pass) in vcl_recv ● Powerful load balancing ● Health checks built in ● Excellent for debugging webapps
  • 17.
  • 18. Step 2: Cache static assets Difficulty level: Trivial
 
 Payoff: Minor
  • 19. Step 2: Cache static assets ● Cache images, CSS, Javascript ● Backend concurrency decrease ● Backend bandwidth decrease ● Minor CPU usage decrease
  • 20. Step 3: Compression Difficulty level: Trivial
 
 Payoff: Medium
  • 21.
  • 22. Step 3: Compression ● GZip compress CSS/Javascript ○ JQuery standard: 263KB ○ JQuery minified: 91KB ○ JQuery gzipped: 32KB ● Compress in one place only ● Reuse compression ● Move CPU load from backend
  • 23. Step 4: Semi-static caching Difficulty level: Medium
 
 Payoff: High
  • 24. Step 4: Semi-static content caching ● Dynamically rendered content ● Expensive to render ● Almost never changes ● Set short TTL (10-120 seconds) ● Mitigates traffic peaks
  • 25. Step 4: Semi static (2/2) ● Manual cache expiry ● Magic URLs ● Shift-refresh from special IP-range ● Web interface for ban or purge
  • 26. Step 5: Autopurge Difficulty level: Medium
 Payoff: High
  • 27. Step 5: Autopurge ● Backend generates purge requests ● Set TTL to ~forever ● Invalidate on change ● Can be difficult for composite pages ○ Map relationships between data and pages
  • 28. Step 6: Grace mode Difficulty level: Easy
 
 Payoff: High
  • 29.
  • 30. Step 6: Grace mode • Originally developed to mitigate pile-ups
 • Can serve “graced” content when fresh content is unavailable
 • Unavailable means • • backend down object busy
  • 31. Grace mode (2) • Both req.grace and beresp.grace must accept the old object • Tip: Set req.grace to 10s normally and 1 hour when backend is down

  • 32. Step 7: Content composition with ESI Difficulty level: Hard 
 Payoff: High
  • 33. Edge Side Includes (ESI) Horrible Designed News Site Blah Article snippet 1 Welcome, Foobar (logout) Article snippet 2 Top 10 popular news items Article snippet 3 Article snippet 4
  • 34. Edge Side Includes (ESI) TTL: 1800minutes TTL: 30min TTL: 60min, user specific TTL: 30min TTL: 1min TTL: 30min TTL: 30min
  • 35. Step 7: Content composition ● Edge Side Includes (ESI) ● Split web pages into pieces ○ Individual caching policies ○ One piece = one URL ● Live stitching of content ● Works with compressed content as well
  • 36. <html><body> ... <esi:include src="/frontpage/ breaking" /> ... <esi:include src="/frontpage/latest" /> ... <!-- Do we like the cache to meddle with content? --> </body><html>
  • 37. Step 8: Advanced cache invalidation Difficulty level: Hard
 Payoff: High
  • 38. Step 8: Advanced cache invalidation ● Sometimes a page relies on multiple “objects” for invalidation ● Finding out what object need to expire what pages can be hard ● Typically a problem in e-commerce and media
  • 39. Advanced cache invalidation (2/2) ● Tag pages with custom headers ○ X-Skus: 49834, 34321, 4343 ● Execute with bans or hashninja ● Possible database driven expiry (triggers)
  • 40. Conclusions ● High rewards with little work ● 3 - 15 days to reach “high” payoff ● Requires backend knowledge to do significant changes ● We talked about what to do - if you want to learn more about how please read the book or sign up for training.
  • 41. Q &A