0
Webinar Audio Options <ul><li>Listen to streaming audio via your computer’s audio </li></ul><ul><ul><li>WebEx Audio Broadc...
Introduction <ul><li>Matt Ackley </li></ul><ul><ul><li>Marketing Team </li></ul></ul><ul><ul><li>@mbackley </li></ul></ul>
Varnish + Drupal Accelerating Drupal Performance  and Flexibility with Varnish Cache Kurt Gray Hosting Engineer Acquia Inc...
Webinar Audio Options <ul><li>Listen to streaming audio via your computer’s audio </li></ul><ul><li>WebEx Audio Broadcast ...
Housekeeping <ul><li>Today’s webinar is being recorded.  Slides  and  recording  will be posted in next 48 hours at: </li>...
Upcoming Events <ul><li>Cities </li></ul><ul><ul><li>New York City, November 9th </li></ul></ul><ul><ul><li>Washington DC,...
Recently Recorded Webinars <ul><li>Client Advisor Webinar - Drupal Staging and Deployment Best Practices </li></ul><ul><li...
Introduction <ul><li>Kristian Lyngstol </li></ul><ul><ul><li>Varnish Software </li></ul></ul><ul><ul><li>@ kristian </li><...
What is Varnish? © 2010 Acquia, Inc.  <ul><ul><li>Reverse proxy cache server </li></ul></ul><ul><ul><li>... and more (load...
Example Benchmarks: pages/second © 2010 Acquia, Inc.  <ul><ul><li>Typical HA Drupal stack: 200 Drupal pages/ minute </li><...
Example Benchmarks: Page latency © 2010 Acquia, Inc.  <ul><ul><li>Varnish also improves response times: </li></ul></ul>
Use cases for Varnish © 2010 Acquia, Inc.  <ul><ul><li>Typical: Reverse proxy cache in front LAMP stack </li></ul></ul><ul...
What does Varnish do? © 2010 Acquia, Inc.  <ul><ul><li>Caches backend responses, delivers from cache </li></ul></ul>
How does it work? © 2010 Acquia, Inc.  <ul><ul><li>Varnish stores a cache entry for each Host + URL </li></ul></ul>
What can be cached in Varnish? © 2010 Acquia, Inc.  <ul><ul><li>Drupal pages for anonymous users </li></ul></ul><ul><ul><l...
How long will it be cached in Varnish? © 2010 Acquia, Inc.  <ul><ul><li>Response header:  Cache-Control: max-age= 300 </li...
VCL: Varnish Configuration Language © 2010 Acquia, Inc.  <ul><ul><li>Extend and modify Varnish cache policies </li></ul></...
VCL: Varnish Configuration Language © 2010 Acquia, Inc.  <ul><ul><li>Add/remove/change request or response headers </li></...
Other VCL capabilities © 2010 Acquia, Inc.  <ul><ul><li>Add/remove/change HTTP headers </li></ul></ul><ul><ul><li>Redirect...
Varnish realtime tools © 2010 Acquia, Inc.  <ul><ul><li>varnishstat: realtime status and performance metrics </li></ul></ul>
Varnish realtime tools © 2010 Acquia, Inc.  <ul><ul><li>varnishhist: live frequency plot of response times </li></ul></ul>
Varnish realtime tools © 2010 Acquia, Inc.  <ul><ul><li>Varnish CLI: live admin capabilities  </li></ul></ul>
Varnish realtime tools © 2010 Acquia, Inc.  <ul><ul><li>varnishtop: live list of hottest files </li></ul></ul>
Varnish realtime tools © 2010 Acquia, Inc.  <ul><ul><li>varnishtop: analyze incoming HTTP headers </li></ul></ul>
Introduction <ul><li>Kurt Gray </li></ul><ul><ul><li>Hosting Engineer </li></ul></ul><ul><ul><li>@kurt </li></ul></ul>
Varnish and Drupal: Cache variances © 2010 Acquia, Inc.  <ul><ul><li>Drupal emits  Vary: Cookie,Accept-Encoding </li></ul>...
Varnish and Drupal: VCL snippets © 2010 Acquia, Inc.  sub vcl_recv {     # Normalize the Accept-Encoding header      if (r...
Varnish and Drupal: VCL snippets © 2010 Acquia, Inc.  sub vcl_recv {      # Don't check cache for logged-in users      if(...
Varnish and Drupal: VCL snippets © 2010 Acquia, Inc.  sub vcl_recv {      # Don't check cache for GET /cron.php     if(req...
Varnish and Drupal: VCL snippets © 2010 Acquia, Inc.  sub vcl_fetch {      # Don't cache if response has explicit no-cache...
Varnish and Pressflow Drupal, D7 © 2010 Acquia, Inc.  <ul><ul><li>Pressflow = Drupal w/ many performance tweaks </li></ul>...
Controlling cache expiration times © 2010 Acquia, Inc.  <ul><ul><li>Drupal Admin > Performance page </li></ul></ul><ul><ul...
Varnish and Acquia Hosting © 2010 Acquia, Inc.  <ul><ul><li>All Acquia-hosted sites benefit from Varnish </li></ul></ul><u...
<ul><li>Do you love working with Drupal? </li></ul><ul><li>If so, Acquia is hiring in  North America  &  Europe : </li></u...
Questions <ul><li>For more information, visit: </li></ul><ul><ul><li>http://acquia.com </li></ul></ul><ul><ul><li>http://t...
Upcoming SlideShare
Loading in...5
×

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

4,890

Published on

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

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,890
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
46
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "Varnish and Drupal- Accelerating Website Performance and Flexibility with Varnish Cache"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×