Varnish and Drupal- Accelerating Website Performance and Flexibility with Varnish Cache
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Varnish and Drupal- Accelerating Website Performance and Flexibility with Varnish Cache

on

  • 5,348 views

As enterprises continue to adopt Drupal for building and deploying high performance web applications, the need for high-performance caching becomes integral to their implementation strategy. Acquia ...

As enterprises continue to adopt Drupal for building and deploying high performance web applications, the need for high-performance caching becomes integral to their implementation strategy. Acquia and Varnish partner to deliver the ideal caching solution for optimizing web performance allowing developers to focus on creating great websites.

Acquia will discuss how we've implemented Varnish in Acquia Hosting to improve performance for our customers, as well as the best practices that can help improve performance of any Drupal website. Join us for this complimentary webinar where we'll discuss:

- Considerations for managing a high-performance site
- How to manage caching behaviors in Drupal
- Tools and tips for improving site performance

Statistics

Views

Total Views
5,348
Views on SlideShare
4,788
Embed Views
560

Actions

Likes
4
Downloads
43
Comments
0

4 Embeds 560

http://www.acquia.com 348
https://www.acquia.com 125
http://acquia.com 80
https://acquia.com 7

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Varnish and Drupal- Accelerating Website Performance and Flexibility with Varnish Cache Presentation Transcript

  • 1. Webinar Audio Options
    • Listen to streaming audio via your computer’s audio
      • WebEx Audio Broadcast pop-up
    • Unable to listen via your computer’s audio
      • Request phone access
    • Technical support
      • US & Canada 866-229-3239
      • International support 408-435-7088
    • International phone access numbers:
      • http://support.webex.com/support/phone-numbers.html
  • 2. Introduction
    • Matt Ackley
      • Marketing Team
      • @mbackley
  • 3. Varnish + Drupal Accelerating Drupal Performance and Flexibility with Varnish Cache Kurt Gray Hosting Engineer Acquia Inc. @kurt Kristian Lyngstøl Software Engineer Varnish Software @kristian Matt Ackley Marketing Acquia Inc. @mbackley
  • 4. Webinar Audio Options
    • Listen to streaming audio via your computer’s audio
    • WebEx Audio Broadcast pop-up
    • Unable to listen via your computer’s audio
    • Request phone access
    • Technical support
    • US & Canada 866-229-3239
    • International support 408-435-7088
    • International phone access numbers: http://support.webex.com/support/phone-numbers.html
  • 5. Housekeeping
    • Today’s webinar is being recorded. Slides and recording will be posted in next 48 hours at:
      • http://acquia.com/resources/recorded_webinars
    • Submit questions via Q&A Tab in WebEx, we’ll answer as many as we can
      • Give it a try & tell us where you joining from today
  • 6. Upcoming Events
    • Cities
      • New York City, November 9th
      • Washington DC, November 18th
      • Chicago, November 30th
      • San Francisco, December 2nd
    • Target Audience
      • Senior IT & Marketing professionals
    • Companies Speaking
    • New York Stock Exchange
    • tmg-emedia (Time Out)
    • New York State Senate
    • The 451 Group
    • Gilbane Group
    • VML
    • Taunton Press
    • Zagat Survey
    • Examiner.com
    Register at: http://revolution2010.acquia.com/
  • 7. Recently Recorded Webinars
    • Client Advisor Webinar - Drupal Staging and Deployment Best Practices
    • Going from Zero to 60 in Drupal with Acquia
    • Watch Today at –
    • http://acquia.com/resources/recorded_webinars
  • 8. Introduction
    • Kristian Lyngstol
      • Varnish Software
      • @ kristian
  • 9. What is Varnish? © 2010 Acquia, Inc.
      • Reverse proxy cache server
      • ... and more (load balancer, filter, director, ...)
      • Open Source (BSD), commercially supported
      • Typically in front of a LAMP stack:
  • 10. Example Benchmarks: pages/second © 2010 Acquia, Inc.
      • Typical HA Drupal stack: 200 Drupal pages/ minute
      • ... with Varnish: 2500 Drupal pages/ second
      • ... using smaller backend hardware!
  • 11. Example Benchmarks: Page latency © 2010 Acquia, Inc.
      • Varnish also improves response times:
  • 12. Use cases for Varnish © 2010 Acquia, Inc.
      • Typical: Reverse proxy cache in front LAMP stack
      • As a web request load balancer
      • ... or behind a load balancer
      • Behind a CDN
      • Next to a CDN
      • As a CDN
      • With other proxy caches
      • ...and more!
  • 13. What does Varnish do? © 2010 Acquia, Inc.
      • Caches backend responses, delivers from cache
  • 14. How does it work? © 2010 Acquia, Inc.
      • Varnish stores a cache entry for each Host + URL
  • 15. What can be cached in Varnish? © 2010 Acquia, Inc.
      • Drupal pages for anonymous users
      • Static content: images, js, css
      • Other types of static or generated content
    What should NOT be cached in Varnish?
      • Responses to POST requests
      • Responses with a Set-Cookie : header
      • User-specific content (logged-in page requests)
      • Very large media files (> 100MB)
      • Has a Cache-Control: no-cache header
    •  
    •  
    All cache policies can be tuned using VCL
  • 16. How long will it be cached in Varnish? © 2010 Acquia, Inc.
      • Response header: Cache-Control: max-age= 300
      • If no Cache-Control specified then Varnish uses the Expires date, if specified
      • If no Cache-Control or Expires header then uses Varnish's default TTL, 2 minutes (adjustable)
    All cache policies can be tuned using VCL ...
  • 17. VCL: Varnish Configuration Language © 2010 Acquia, Inc.
      • Extend and modify Varnish cache policies
      • Add behaviors during each phase of delivery: recv, hash, fetch, hit, miss, deliver, ...
    sub vcl_recv {    # direct image requests to image servers    if (req.url ~ "(jpg|gif|png)") {       set req.backend = image_servers;    }   }
  • 18. VCL: Varnish Configuration Language © 2010 Acquia, Inc.
      • Add/remove/change request or response headers
    sub vcl_deliver {    # Add a HIT/MISS header to the response    if (obj.hits > 0) {      set resp.http.X-Cache = "HIT";      set resp.http.X-Cache-Hits = obj.hits;    } else {      set resp.http.X-Cache = "MISS";    }   }
  • 19. Other VCL capabilities © 2010 Acquia, Inc.
      • Add/remove/change HTTP headers
      • Redirects based on request parameters
      • Rewrite requests
      • Retry failed requests
      • Synthesize direct responses
      • Saint and Grace: Deliver cached content when backend is unresponsive
      • ACLs: Network-address filtering
      • Request filtering
      • ESI: Separate cache entries and separate cache policies for each part of a document
      • Inline C code (eg. redirects based on GeoIP) 
  • 20. Varnish realtime tools © 2010 Acquia, Inc.
      • varnishstat: realtime status and performance metrics
  • 21. Varnish realtime tools © 2010 Acquia, Inc.
      • varnishhist: live frequency plot of response times
  • 22. Varnish realtime tools © 2010 Acquia, Inc.
      • Varnish CLI: live admin capabilities
  • 23. Varnish realtime tools © 2010 Acquia, Inc.
      • varnishtop: live list of hottest files
  • 24. Varnish realtime tools © 2010 Acquia, Inc.
      • varnishtop: analyze incoming HTTP headers
  • 25. Introduction
    • Kurt Gray
      • Hosting Engineer
      • @kurt
  • 26. Varnish and Drupal: Cache variances © 2010 Acquia, Inc.
      • Drupal emits Vary: Cookie,Accept-Encoding
      • Cookie : Avoids cache collisions between users
      • Accept-Encoding : maintain separate cache entries for compressed content (gzip, deflate) vs. uncompressed content
  • 27. Varnish and Drupal: VCL snippets © 2010 Acquia, Inc. sub vcl_recv {    # Normalize the Accept-Encoding header     if (req.http.Accept-Encoding) {       if (req.http.Accept-Encoding ~ "gzip") {         set req.http.Accept-Encoding = "gzip";       } elsif (req.http.Accept-Encoding ~ "deflate") {         set req.http.Accept-Encoding = "deflate";       } else {         # unkown algorithm         remove req.http.Accept-Encoding;       }     }   }
  • 28. Varnish and Drupal: VCL snippets © 2010 Acquia, Inc. sub vcl_recv {      # Don't check cache for logged-in users     if(req.http.cookie ~ "SESS") {       return(pass);     }     # Cookie Bypass module: Don't check cache for anon     # user who POSTed content less than 10 minutes ago.     if(req.http.cookie ~ "NO_CACHE") {       return(pass);     }   }
  • 29. Varnish and Drupal: VCL snippets © 2010 Acquia, Inc. sub vcl_recv {     # Don't check cache for GET /cron.php     if(req.url ~ "^/cron.php") {       return(pass);     }   }
  • 30. Varnish and Drupal: VCL snippets © 2010 Acquia, Inc. sub vcl_fetch {     # Don't cache if response has explicit no-cache headers     if (beresp.http.Pragma ~ "no-cache" ||        beresp.http.Cache-Control ~ "no-cache" ||        beresp.http.Cache-Control ~ "private") {          return(pass);     }   }
  • 31. Varnish and Pressflow Drupal, D7 © 2010 Acquia, Inc.
      • Pressflow = Drupal w/ many performance tweaks
      • Allows Varnish to cache and deliver Drupal page requests for anonymous visitors
      • ...because Pressflow doesn't emit "lazy sessions" 
      • No SESS cookies for anonymous visitors
      • Drupal 7 has same key features
  • 32. Controlling cache expiration times © 2010 Acquia, Inc.
      • Drupal Admin > Performance page
        • Agressive or External caching
        • Minimum Page Lifetime = max-age
      • Active purging: use Drupal Varnish module
      • Static content: See the mod_expires directives in Drupal's .htaccess file
      • If no Cache-Control or Expires headers: Uses Varnish's default TTL (2 minutes)
  • 33. Varnish and Acquia Hosting © 2010 Acquia, Inc.
      • All Acquia-hosted sites benefit from Varnish
      • Pressflow sites on Acquia-hosting get most benefit
      • Fully managed HA environment: No setup, no fuss
      • Reduces backend server size requirments
      • Excellent load test results
  • 34.
    • Do you love working with Drupal?
    • If so, Acquia is hiring in North America & Europe :
      • Engineering & design
      • Client advisors and consulting
      • Inside sales
    • Check out openings at
    • http://acquia.com/careers
  • 35. Questions
    • For more information, visit:
      • http://acquia.com
      • http://twitter.com/acquia
      • http://twitter.com/drupalgardens
      • http://twitter.com/drupalcommons
      • http://acquia.com/facebook
    • Contact us:
      • [email_address]
      • 888.9.ACQUIA
    • Try Drupal 7 today, for free
      • Sign up at http://drupalgardens.com
    • Sign up for the Drupal Business Summit
      • http://revolution2010.acquia.com/
    Recording of today’s event and slides will be posted at: http://acquia.com/resources/recorded_webinars