SlideShare una empresa de Scribd logo
1 de 58
Varnish BOF!
What's this talk about? A basic intro to Varnish and reverse proxies Some cool ESI stuff How to setup, implement + configure Varnish/ESI in Drupal Teh Awesomeness of speed
Why Varnish?
Drupal performs…just…
How much faster? Drupal 20 reqs/sec? Varnish 200 reqs/sec?
When personalisation goes wrong
Dries logs in
Drupal creates a personalised page Logged in as dries
The page gets cached Varnish
When webchick hits the site
The page is fetched from the cache Varnish
The personalisation is incorrect Logged in as dries
WTF? WTF?
No-cache headers can prevent this Varnish
But now it's slow :-(
EdgeSideIncludes
ESI: Tales from the past The idea originated in SSI SSI, but moved to the edge ESI is a W3C standard ESI is a bunch of xml tags/attributes. Supported by: Varnish (partial support – no ESI variables) Akamai Some Nginx support ???
Dries is visiting the site
The page is requested Varnish http://example.com/node/1
The page includes an ESI tag <esisrc=  "http://example.com/esi/user/0"  />
The proxy sends a second request http://example.com/esi/user/0 Varnish http://example.com/node/1
The ESI URL sends a HTML snip <div id="userinfo">   <a title="View &amp; edit your user profile">Logged in as dries</a>   <a href="/logout">Logout</a> </div>
The ESI code is merged with the page
Proxy forwards the page on http://example.com/esi/user/0 Varnish http://example.com/node/1
This doesn’t sound quicker
The Importance of Tests It's important to measure the results(I'll come to measuring tools later!) The ESI snippets can be cached too
Cached ESIs
1st Page = 2 Requests http://example.com/esi/user/0 Varnish http://example.com/node/1
2nd Page = 1 request Varnish http://example.com/node/2
1 request for each new page 10 pages = 11 requests Each page is cached The ESI tag is cached
The next visitor gets the page for free Varnish Page fetched from cachehttp://example.com/node/1
1st page = 1 request (for the ESI) http://example.com/esi/user/0 Varnish Page fetched from cachehttp://example.com/node/1
Following pages all served from cache Varnish
1 request for each new page 10 pages = 11 requests The ESI tag is cached Each page is cached Subsequent requests have 1 request for the ESI tag 20 pages = 12 requests (10 pages + 2 ESI tags)
Fast enough yet? Warm the cache
A modern infrastructure Varnish HA Proxy TehIntertubes Service webheadadmin/cron/emails/??
Spidering the site Varnish HA Proxy TehIntertubes Link-checker /spider app. Service webheadadmin/cron/emails/??
Dries is back for more
Each user generates 1 request http://example.com/esi/user/0 Varnish Page fetched from cachehttp://example.com/node/1
5 users, 40 pages 5 backend requests!
Theory Over
Basics Varnish+Drupal
Installing Varnish sudo apt-get install varnishsudo yum install varnish Edit /etc/default/varnish Edit /etc/varnish/default.vcl Usual config: Varnish listens on port 80 Apache listens on port 8080 (or any available port) SSL is more complex – sometimes Pound is used for SSL decryption
VCLs are awesome! Varnish configuration is controlled by VCL: Varnish Configuration Language. Documented athttp://www.varnish-cache.org/trac/wiki/VCL Drupal VCL examples can be found in: Mercury (Amazon AMI) ESI module You can write C code in VCLs. Oh my.
Keeping the cache current Varnish admin port Varnish
Varnish Management Port The Varnish admin port uses a plain-text protocol to command Varnish Test by:telnet localhost 6093 List commands by typing help Purge cached pages: url.purge <regexp>E.g. url.purge .* The Varnish module provides an API.
Use with caution! The default behaviour of the Varnish module is toclear the entire cachewhen you edit a node.
Enter…the Expires module Came from the Boost module Clears specific cache pages – not the entire cache Supports path-alias URLs as well as node/1 paths. Provides hook_expire_cache_alterto add URLs (e.g. nodes displayed in a page-view) Supports other cache modules, not just Varnish.
I can haz ESI? The ESI module provides block integration
Configuring ESI Download the module Configure the blocks to serve via ESI, and their TTL Modify the Varnish VCL (the ESI module comes with example VCLs to use Coming soon: D7 Panels integration
Benchmarking Some tools: J-meter ab (apache-benchmark) Seige Approaches: Hammer your URL(s)ab –n 100 –c5 http://example.com/ Replay your log files
Pitfalls await VCLs are complex Per-user cache rules are even scarier! Varnish may be slower Risk exposing private data
Alternatives Boost module No need to install a new service on the server Static file cache Advanced cache module Authcache module Other proxies: Squid Nginx Akamai?
Summary
How hard?
Varnish Varnish module Expire module ESI module Teh Awesomeness
Thanks! Marcus Deglos e: marcus@deglos.com t: @manarth irc: manarth
Picture credits Thanks to these CC-licencedflickr users Mac Book Pro - http://www.flickr.com/photos/wicho/ F1 car       - http://www.flickr.com/photos/w3i_yu/ Banger car   - http://www.flickr.com/photos/photoplod Dries        - http://www.flickr.com/photos/boris Dries+laptop - http://www.flickr.com/photos/azugaldia Webchick     - http://www.flickr.com/photos/mortendk Webchick     - http://www.flickr.com/photos/puregin Fire         - http://www.flickr.com/photos/benwatts Hourglass    - http://www.flickr.com/photos/opendemocracy Stopwatch    - http://www.flickr.com/photos/purplemattfish

Más contenido relacionado

La actualidad más candente

Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupaldigital006
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)Venugopal Gummadala
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkBryan Ollendyke
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...OVHcloud
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansiblesriram_rajan
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuis Rodríguez Castromil
 
HBaseConEast2016: HBase on Docker with Clusterdock
HBaseConEast2016: HBase on Docker with ClusterdockHBaseConEast2016: HBase on Docker with Clusterdock
HBaseConEast2016: HBase on Docker with ClusterdockMichael Stack
 
Setting up a local WordPress development environment
Setting up a local WordPress development environmentSetting up a local WordPress development environment
Setting up a local WordPress development environmentZero Point Development
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 cachingShih-yi Wei
 
Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Brian Moon
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAshokkumar T A
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceAshok Modi
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPressMikel King
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemAcquia
 
Drupal on your laptop
Drupal on your laptopDrupal on your laptop
Drupal on your laptopSam Moore
 

La actualidad más candente (20)

Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupal
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talk
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
HBaseConEast2016: HBase on Docker with Clusterdock
HBaseConEast2016: HBase on Docker with ClusterdockHBaseConEast2016: HBase on Docker with Clusterdock
HBaseConEast2016: HBase on Docker with Clusterdock
 
Setting up a local WordPress development environment
Setting up a local WordPress development environmentSetting up a local WordPress development environment
Setting up a local WordPress development environment
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
Apache
ApacheApache
Apache
 
Apache
ApacheApache
Apache
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 caching
 
Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricks
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPress
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid Them
 
Drupal on your laptop
Drupal on your laptopDrupal on your laptop
Drupal on your laptop
 

Similar a Varnish bof

High Performance Sites with Drupal and Cache Control Module
High Performance Sites with Drupal and Cache Control ModuleHigh Performance Sites with Drupal and Cache Control Module
High Performance Sites with Drupal and Cache Control ModuleExove
 
Performance on Rails
Performance on RailsPerformance on Rails
Performance on RailsPedro Sousa
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESIKit Chan
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesExove
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 
Advantages of cPanel-based LiteSpeed Hosting
Advantages of cPanel-based LiteSpeed HostingAdvantages of cPanel-based LiteSpeed Hosting
Advantages of cPanel-based LiteSpeed HostingLisa Clarke
 
Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017Alexandre Morgaut
 
WordPress Performance
WordPress PerformanceWordPress Performance
WordPress Performancedsero
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourWim Godden
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonChris Olbekson
 
Scalable Web Architectures and Infrastructure
Scalable Web Architectures and InfrastructureScalable Web Architectures and Infrastructure
Scalable Web Architectures and Infrastructuregeorge.james
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat ClientPaul Klipp
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01Vivek chan
 

Similar a Varnish bof (20)

High Performance Sites with Drupal and Cache Control Module
High Performance Sites with Drupal and Cache Control ModuleHigh Performance Sites with Drupal and Cache Control Module
High Performance Sites with Drupal and Cache Control Module
 
Performance on Rails
Performance on RailsPerformance on Rails
Performance on Rails
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESI
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Advantages of cPanel-based LiteSpeed Hosting
Advantages of cPanel-based LiteSpeed HostingAdvantages of cPanel-based LiteSpeed Hosting
Advantages of cPanel-based LiteSpeed Hosting
 
Scaling 101 test
Scaling 101 testScaling 101 test
Scaling 101 test
 
Scaling 101
Scaling 101Scaling 101
Scaling 101
 
Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017
 
WordPress Performance
WordPress PerformanceWordPress Performance
WordPress Performance
 
Jsp Comparison
 Jsp Comparison Jsp Comparison
Jsp Comparison
 
Varnish intro
Varnish introVarnish intro
Varnish intro
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
JS Module Server
JS Module ServerJS Module Server
JS Module Server
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp Houston
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Scalable Web Architectures and Infrastructure
Scalable Web Architectures and InfrastructureScalable Web Architectures and Infrastructure
Scalable Web Architectures and Infrastructure
 
Caching 101
Caching 101Caching 101
Caching 101
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat Client
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 

Más de Marcus Deglos

Más de Marcus Deglos (6)

Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Drupal haters gonna hate
Drupal haters gonna hateDrupal haters gonna hate
Drupal haters gonna hate
 
With one click
With one clickWith one click
With one click
 
Panels rocks!
Panels rocks!Panels rocks!
Panels rocks!
 
SSO To go
SSO To goSSO To go
SSO To go
 
Where in the world
Where in the worldWhere in the world
Where in the world
 

Último

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Último (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

Varnish bof

  • 2. What's this talk about? A basic intro to Varnish and reverse proxies Some cool ESI stuff How to setup, implement + configure Varnish/ESI in Drupal Teh Awesomeness of speed
  • 5. How much faster? Drupal 20 reqs/sec? Varnish 200 reqs/sec?
  • 8. Drupal creates a personalised page Logged in as dries
  • 9. The page gets cached Varnish
  • 10. When webchick hits the site
  • 11. The page is fetched from the cache Varnish
  • 12. The personalisation is incorrect Logged in as dries
  • 14. No-cache headers can prevent this Varnish
  • 15. But now it's slow :-(
  • 17. ESI: Tales from the past The idea originated in SSI SSI, but moved to the edge ESI is a W3C standard ESI is a bunch of xml tags/attributes. Supported by: Varnish (partial support – no ESI variables) Akamai Some Nginx support ???
  • 18. Dries is visiting the site
  • 19. The page is requested Varnish http://example.com/node/1
  • 20. The page includes an ESI tag <esisrc= "http://example.com/esi/user/0" />
  • 21. The proxy sends a second request http://example.com/esi/user/0 Varnish http://example.com/node/1
  • 22. The ESI URL sends a HTML snip <div id="userinfo"> <a title="View &amp; edit your user profile">Logged in as dries</a> <a href="/logout">Logout</a> </div>
  • 23. The ESI code is merged with the page
  • 24. Proxy forwards the page on http://example.com/esi/user/0 Varnish http://example.com/node/1
  • 26. The Importance of Tests It's important to measure the results(I'll come to measuring tools later!) The ESI snippets can be cached too
  • 28. 1st Page = 2 Requests http://example.com/esi/user/0 Varnish http://example.com/node/1
  • 29. 2nd Page = 1 request Varnish http://example.com/node/2
  • 30. 1 request for each new page 10 pages = 11 requests Each page is cached The ESI tag is cached
  • 31. The next visitor gets the page for free Varnish Page fetched from cachehttp://example.com/node/1
  • 32. 1st page = 1 request (for the ESI) http://example.com/esi/user/0 Varnish Page fetched from cachehttp://example.com/node/1
  • 33. Following pages all served from cache Varnish
  • 34. 1 request for each new page 10 pages = 11 requests The ESI tag is cached Each page is cached Subsequent requests have 1 request for the ESI tag 20 pages = 12 requests (10 pages + 2 ESI tags)
  • 35. Fast enough yet? Warm the cache
  • 36. A modern infrastructure Varnish HA Proxy TehIntertubes Service webheadadmin/cron/emails/??
  • 37. Spidering the site Varnish HA Proxy TehIntertubes Link-checker /spider app. Service webheadadmin/cron/emails/??
  • 38. Dries is back for more
  • 39. Each user generates 1 request http://example.com/esi/user/0 Varnish Page fetched from cachehttp://example.com/node/1
  • 40. 5 users, 40 pages 5 backend requests!
  • 43. Installing Varnish sudo apt-get install varnishsudo yum install varnish Edit /etc/default/varnish Edit /etc/varnish/default.vcl Usual config: Varnish listens on port 80 Apache listens on port 8080 (or any available port) SSL is more complex – sometimes Pound is used for SSL decryption
  • 44. VCLs are awesome! Varnish configuration is controlled by VCL: Varnish Configuration Language. Documented athttp://www.varnish-cache.org/trac/wiki/VCL Drupal VCL examples can be found in: Mercury (Amazon AMI) ESI module You can write C code in VCLs. Oh my.
  • 45. Keeping the cache current Varnish admin port Varnish
  • 46. Varnish Management Port The Varnish admin port uses a plain-text protocol to command Varnish Test by:telnet localhost 6093 List commands by typing help Purge cached pages: url.purge <regexp>E.g. url.purge .* The Varnish module provides an API.
  • 47. Use with caution! The default behaviour of the Varnish module is toclear the entire cachewhen you edit a node.
  • 48. Enter…the Expires module Came from the Boost module Clears specific cache pages – not the entire cache Supports path-alias URLs as well as node/1 paths. Provides hook_expire_cache_alterto add URLs (e.g. nodes displayed in a page-view) Supports other cache modules, not just Varnish.
  • 49. I can haz ESI? The ESI module provides block integration
  • 50. Configuring ESI Download the module Configure the blocks to serve via ESI, and their TTL Modify the Varnish VCL (the ESI module comes with example VCLs to use Coming soon: D7 Panels integration
  • 51. Benchmarking Some tools: J-meter ab (apache-benchmark) Seige Approaches: Hammer your URL(s)ab –n 100 –c5 http://example.com/ Replay your log files
  • 52. Pitfalls await VCLs are complex Per-user cache rules are even scarier! Varnish may be slower Risk exposing private data
  • 53. Alternatives Boost module No need to install a new service on the server Static file cache Advanced cache module Authcache module Other proxies: Squid Nginx Akamai?
  • 56. Varnish Varnish module Expire module ESI module Teh Awesomeness
  • 57. Thanks! Marcus Deglos e: marcus@deglos.com t: @manarth irc: manarth
  • 58. Picture credits Thanks to these CC-licencedflickr users Mac Book Pro - http://www.flickr.com/photos/wicho/ F1 car - http://www.flickr.com/photos/w3i_yu/ Banger car - http://www.flickr.com/photos/photoplod Dries - http://www.flickr.com/photos/boris Dries+laptop - http://www.flickr.com/photos/azugaldia Webchick - http://www.flickr.com/photos/mortendk Webchick - http://www.flickr.com/photos/puregin Fire - http://www.flickr.com/photos/benwatts Hourglass - http://www.flickr.com/photos/opendemocracy Stopwatch - http://www.flickr.com/photos/purplemattfish

Notas del editor

  1. - Old hands: feel free to switch off for a while- New to Varnish? Welcome along
  2. You&apos;ve heard that varnish is *quicker* - so how is it quicker?
  3. - So what happens when you make a request?
  4. &gt; Pic of absurd personalisation
  5. What if it&apos;s *really* private info?This *does* happen!
  6. - Add EGGTIMER pic
  7. Page is requested,Gets a response
  8. - Add a pic of a page with an ESI TAG
  9. - Requests the ESI URL
  10. - More requests makes it slower!
  11. This shows how important *measurements* areI&apos;ll talk about measurements laterESIs can be cached
  12. - Warm the cache