Your SlideShare is downloading. ×
0
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Drupal, varnish, esi - Toulouse November 2

6,625

Published on

Introduction to the role Varnish plays, and how it speeds up sites and how it integrates with Drupal.

Introduction to the role Varnish plays, and how it speeds up sites and how it integrates with Drupal.

Published in: Technology
1 Comment
7 Likes
Statistics
Notes
No Downloads
Views
Total Views
6,625
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
84
Comments
1
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Back, to the dawn of the internet, when email was in fidonet and 56k modems were all the rage.
  • Add animation through the tubes.Dries makes requestGoes through internetHits serverHanded to apacheApache looks up from diskMight add some headersReturns the fileDodges the lolcat on the way back
  • Add animation through the tubes.Dries makes requestGoes through internetHits serverHanded to apacheApache recognises it's .php and passes to ModPHP straight awayModPHP looks up from diskHands to lexical parserProcessesReturns the file to apacheDodges the lolcat on the way back
  • Add animation through the tubes.Dries makes requestGoes through internetHits serverHanded to apacheApache processes .htaccess rulesEvery URL is index.phpPassed to ModPHP straight awayModPHP looks up from diskHands to lexical parserProcesses, invokes Drupal bootstrapReturns the file to apacheDodges the lolcat on the way back
  • Benchmark:ApachePlain old PHP handler (no processing)Drupal
  • Benchmark:ApachePlain old PHP handler (no processing)DrupalPHP parser adds 20%
  • Refer to concepts such as baked vs fried
  • Baked or fried?
  • Prepared in advance No personalisation (more choc chips) Ready to eat
  • One serving cooked at a time Wait a bit longer to eat Cooked freshPersonalised to taste
  • - Looks at the hook_block information and uses appropriate cache rules – per user, etc.
  • Transcript

    • 1. Marcus Deglos@manarth#cdl2011
    • 2. > Old faithful, serving sites since 1996. > Quick > SimpleApache
    • 3. Apaches model Web server
    • 4. Apaches model with PHP Web server PHP engine
    • 5. Do it with Drupal Web server DB index.php PHP engine
    • 6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html Example HTMLxmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
 xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
 xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

<headprofile="http://www.w3.org/1999/xhtml/vocab">
 <meta http-equiv="Content-Type"content="text/html; charset=utf-8" />
<link rel="shortcut icon"href="http://testbed.local/misc/favicon.ico" type="image/vnd.microsoft.icon" />
<metaname="Generator" content="Drupal 7 (http://drupal.org)" />
 <title>Welcome to Site-Install |Site-Install</title> HTML from homepage after running drushsi
    • 7. Drag race results
    • 8. > Prepared in advance > Typically uses a build-script > Produces static pages > Quick > No complex behaviour > Boost module is anBaked example
    • 9. > Pages created on the fly> CMS or other complex dynamic system> Allows complex behaviour> Drupal does this> Slow Fried
    • 10. > Software package (daemon) for linux > Reverse proxy, such as Squid, Nginx and ZeusWhat is Varnish? > Cache
    • 11. How Varnish works GET /blog Host deglos.com User-AgentMozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1 Accept text/html,application/xhtml+xml,applic ation/xml;q=0.9,*/*;q=0.8 Varnish Drupal Accept-Language en-us,en;q=0.5 Accept-Encoding gzip, deflate Accept-Charset ISO-8859-1,utf- 8;q=0.7,*;q=0.7 Connectionkeep-alive
    • 12. Varnish is slower If Varnish passes every request to Drupal – and acts just as a MITM – your site will be slower. Varnish Drupal
    • 13. Varnish needs to cache Varnish Drupal Cache
    • 14. Varnish + cache is quicker 10x faster (or more) Varnish Drupal Cache
    • 15. Personalisation is a problem Varnish Drupal Cache
    • 16. The Uncacheable Varnish Drupal Cache
    • 17. Example VCL:#This is a basic VCL configuration file for varnish.backend default { .host = "127.0.0.1"; .port = "80";}sub vcl_fetch { unset obj.http.Cache-Control; unset obj.http.Expires; set obj.ttl = 86400s;}
    • 18. vcl.listtelnet localhost6082Trying ::1...Connected to localhost.Escape character is ^].vcl.list200 23active 1 boot
    • 19. helptelnet localhost6082Trying ::1...Connected to localhost.Escape character is ^].help200 376help [command]ping [timestamp]statusstartstopstats...
    • 20. url.purgetelnet localhost6082Trying ::1...Connected to localhost.Escape character is ^].url.purge .*200 0
    • 21. Setting up Varnish> Download varnish daemon debian: apt-get install varnish redhat:yum install varnish> Re-configure Apache to listen on port 8080 (or other non-standard port)> Configure Varnish to listen on port 80> Configure Varnish VCL to connect to Apache> VCL tweaks (default does not cache Drupal)
    • 22. Serving ESIsVarnish Drupal Cache
    • 23. Serving ESIsVarnish Drupal Cache
    • 24. Serving ESIs<div id="nav-masthead" class="grid-12"><ul><li class="homepage active first active"><a href="/home" class="active active">Drupal Homepage</a></li><li class="dashboard last"><a href="/user/dashboard">Your Dashboard</a></li></ul> Varnish Drupal<div id="userinfo"><a href="/user" title="View &amp; edit your user profile">Logged in asmanarth</a><a href="/logout">Log out</a></div></div><!-- /#nav-masthead --> Cache
    • 25. Serving ESIs<div id="nav-masthead" class="grid-12"><ul><li class="homepage active first active"><a href="/home" class="active active">Drupal Homepage</a></li><li class="dashboard last"><a href="/user/dashboard">Your Dashboard</a></li></ul> Varnish Drupal<esisrc="http://example.com/esi/userinfo" /></div><!-- /#nav-masthead --> Cache
    • 26. Serving ESIs<div id="userinfo"><a href="/user" title="View &amp; edit your user profile">Logged inas manarth</a><a href="/logout">Log out</a></div> Varnish Drupal Cache
    • 27. What do you need in order to do ESIs?> Replace personalisationwith ESI tags Theme-alters?> Provide backend hook_menuhandlers for each ESI tag> Ensure that Varnish is caching> Rule 35 applies
    • 28. Configuring ESI Blocks
    • 29. Flickr Credits> Babbage engine http://www.flickr.com/photos/melgart/4444251 225> Cookies http://www.flickr.com/photos/sabine01/24855 02578> Frying wok http://www.flickr.com/photos/18403292@N00/ 3048993> Varnish http://www.flickr.com/photos/dawniecakes/46 86467791

    ×