Your SlideShare is downloading. ×
Cache all the things #DCLondon
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

Cache all the things #DCLondon


Published on

Cut down presentation for DrupalCamp London 2013

Cut down presentation for DrupalCamp London 2013

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Cache All The Things Mike Bell - @mikebell_
  • 2. About MeMike BellLead Drupal Developer @ Ixis@mikebell_
  • 3. Exactly what things?well errr...everything!
  • 4. No really...Frontend:- HTML- CSS- Images- JavascriptBackend:- PHP- MySQLSo pretty much everything then!
  • 5. Where to start?Ask yourself: Why is my site slow?a) Bad codeb) Bad serverc) Its not!
  • 6. Bad Code?Stop.Caching will help... but it wont solve yourbigger issues.There are tools to help - xhprof
  • 7. Bad Server?So hows £5.99 a month working out for you?Caching will help... but again you still havebigger issues.Scale horizontally/vertically for a quick fix thenwork on additional caching.
  • 8. Its not!I like you!Caching is always a good thing, except whenyou have to debug it...
  • 9. Caching in Drupal- Code Level (cache_get/cache_set)- APC (not covered here)- Resource caching (this gets tricky!)- DB Layer- CDNs (related to resource caching)
  • 10. Code LevelDrupal has its own caching api.Module Developers use it!cache_set - store data in Drupals cache tablecache_get - get data from Drupals cache tableYou can even define your own cache tables!
  • 11. Resource CachingMany different types of resourcesEach can be cached by different toolsExample:- Drupals CSS/JS Cache- Drupals Page Cache- Boost- Varnish
  • 12. Resource CachingDrupal default: CSS/JS and Page(taken from - ooppss!)
  • 13. Resource Caching - BoostBoost - caching for all Drupal AssetsAnonymous users onlyIdeal for shared hosting environmentsPotentially the easiest to setup
  • 14. Resource Caching - VarnishApplication AcceleratorLinux OnlyCaches resources based on initial viewAnonymous only - very picky with sessions and cookiesInsanely Powerful
  • 15. Resource Caching - VarnishAdvanced setup - requires additional moduleand VCL for Drupal- ttls (time to live)Specific resource (image/css) and pageelement! All available through VCL config.
  • 16. Resource Caching - VarnishCache Stores- RAM- DiskRam - super fast - requires a lot of ramDisk - fast - disk space is rarely an issue
  • 17. Data Caching - memcachedData and Database caching layerCaches cache... (and things!)
  • 18. Data Caching - memcachedExample:Core cache - core cache tables (cache_*)Moved into memcached and shared between multipleinstances across multiple serversSimple api makes getting and setting easyDrupal requires - andpecl extension
  • 19. 3rd Party Caching - AkamaiOne of the biggest caching providersA high chance youve experienced Akamaitoday without realising it.Static cache of resourcesContent Distribution Network100+ Edge servers all over the world
  • 20. 3rd Party Caching - AkamaiCoverage for DDOS attacks- Active monitoring and defenseAdvanced redirection rules through control panelIts not cheap!Its also pretty magical.
  • 21. 3rd Party Caching - CloudflareSimilar to AkamaiSmaller scaleEmphasis on security and DDOS protection
  • 22. Content Distribution NetworkCDNs for shortOffload resource handling to external provider- Images- Video- Audio- Large filesSyndicate content around the world
  • 23. Content Distribution NetworkWhy use a CDN?- Content is delivered quicker-- Latency cut downPricing is granular - pay as you go type dealAmazon + Rackspace Cloud Files
  • 24. How does it all fit together?
  • 25. What happens when it all goes wrong?
  • 26. Caching to the rescue!Each layer provides protection3rd Party - shield 99% of anon trafficVarnish - the restAnonymous users should never know your sitehas issues.
  • 27. Debugging TipsConfigure different urls for different platforms- Easier to identify what cache layer has an issueDont be afraid to flush caches- Your backend should be able to cope with itAnalyse headers! Drupal and Varnish provide a lot of infoAkamai information can be gleaned from additional httpheaders.
  • 28. Debugging TipsMonitor each layer- Icinga- Pingdom
  • 29. Any Questions? Slide designs by Ritch Partridge (@ritchpartridge)