34. 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)
41. Serving ESIs
<div id="userinfo">
<a href="/user" title="View & edit your user profile">Logged in
as manarth</a>
<a href="/logout">Log out</a>
</div>
Varnish Drupal
Cache
42. 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
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.