Your SlideShare is downloading. ×
Cache all the things #DCLondon
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Cache all the things #DCLondon

288
views

Published on

Cut down presentation for DrupalCamp London 2013

Cut down presentation for DrupalCamp London 2013


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
288
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
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

Transcript

  • 1. Cache All The Things Mike Bell - @mikebell_
  • 2. About MeMike BellLead Drupal Developer @ Ixis@mikebell_http://drupal.org/user/189605
  • 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 mikebell.io - ooppss!)
  • 13. Resource Caching - BoostBoost - http://drupal.org/project/boostStatic 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- http://drupal.org/project/varnishGranular 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 - http://drupal.org/project/memcache 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)