Where to start?Ask yourself: Why is my site slow?a) Bad codeb) Bad serverc) Its not!
Bad Code?Stop.Caching will help... but it wont solve yourbigger issues.There are tools to help - xhprof
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.
Its not!I like you!Caching is always a good thing, except whenyou have to debug it...
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)
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!
Resource CachingMany different types of resourcesEach can be cached by different toolsExample:- Drupals CSS/JS Cache- Drupals Page Cache- Boost- Varnish
Resource CachingDrupal default: CSS/JS and Page(taken from mikebell.io - ooppss!)
Resource Caching - BoostBoost - http://drupal.org/project/boostStatic caching for all Drupal AssetsAnonymous users onlyIdeal for shared hosting environmentsPotentially the easiest to setup
Resource Caching - VarnishApplication AcceleratorLinux OnlyCaches resources based on initial viewAnonymous only - very picky with sessions and cookiesInsanely Powerful
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.
Resource Caching - VarnishCache Stores- RAM- DiskRam - super fast - requires a lot of ramDisk - fast - disk space is rarely an issue
Data Caching - memcachedData and Database caching layerCaches cache... (and things!)
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
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
3rd Party Caching - AkamaiCoverage for DDOS attacks- Active monitoring and defenseAdvanced redirection rules through control panelIts not cheap!Its also pretty magical.
3rd Party Caching - CloudflareSimilar to AkamaiSmaller scaleEmphasis on security and DDOS protection
Content Distribution NetworkCDNs for shortOffload resource handling to external provider- Images- Video- Audio- Large filesSyndicate content around the world
Content Distribution NetworkWhy use a CDN?- Content is delivered quicker-- Latency cut downPricing is granular - pay as you go type dealAmazon + Rackspace Cloud Files
Caching to the rescue!Each layer provides protection3rd Party - shield 99% of anon trafficVarnish - the restAnonymous users should never know your sitehas issues.
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.
Debugging TipsMonitor each layer- Icinga- Pingdom
Any Questions? Slide designs by Ritch Partridge (@ritchpartridge)
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.