SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
Cache All The Things
About Me
Mike Bell
Drupal Developer

@mikebell_
http://drupal.org/user/189605
Exactly what things?
erm...




everything!
No really...
Frontend:
- HTML
- CSS
- Images
- Javascript
Backend:
- PHP
- MySQL


So pretty much everything then!
Where to start?
Ask yourself:
                Why is my site slow?

a) Bad code
b) Bad server
c) It's not!
Bad Code
Stop.

Caching will help... but it won't solve your
bigger issues.

There are tools to help - xhprof (not covered
here)
Bad Server?
So how's £5.99 a month working out for you?

Caching will help... but you still have bigger
issues.

Scale horizontally/vertically for a quick fix then
work on additional caching.
It's not!
I like you!

Caching is always a good thing, except when
you have to debug it...
Caching in Drupal
- Code Level (cache_get/cache_set)
- APC (not covering)
- Resource caching (this get's tricky!)
- DB Layer
- CDNs (related to resource caching)
Code Level
Drupal has it's own caching api.

Module Developers use it!

cache_set - store data in Drupals cache table
cache_get - get data from Drupals cache table

You can even define your own cache tables!
Code Level (example)
<?php
function mymodule_cached_data($reset = FALSE) {
  global $language;
  $langcode = $language->language;

    $data = &drupal_static(__FUNCTION__, NULL, $reset);

    if (!isset($data)) {
            if (!$reset && $cache = cache_get("mymodule_cached_data:$langcode") && !empty($cache->data)) {
            $data = $cache->data;
            }
            else {
            $data = t('This would be an array or string generated using translated strings.');
            cache_set("mymodule_cached_data:$langcode", $data);
            }
    }
    return $data;
}
?>




(source - http://drupal.org/node/145279)
Resource Caching
Many different types of resources

Each can be cached by different tools

Example:
- Drupals CSS/JS Cache
- Drupals Page Cache
- Boost
- Varnish
Resource Caching
Drupal default: CSS/JS and Page




(taken from digital006.com - ooppss!)
Resource Caching - Boost
Boost - http://drupal.org/project/boost

Static caching for all Drupal Assets

Anonymous users only

Ideal for shared hosting environments

Potentially the easiest to setup
Resource Caching - Varnish
Application Accelerator

Linux Only

Caches resources based on initial view

Anonymous only - very picky with sessions and
cookies

Insanely Powerful
Resource Caching - Varnish
Advanced setup - requires additional module
and VCL for Drupal
- http://drupal.org/project/varnish

Granular ttls (time to live)

Specific resource (image/css) and page
element! All available through VCL config.
Resource Caching - Varnish
Anatomy of a varnish hit:
HTTP/1.1 200 OK
Server: Apache
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Tue, 08 Jan 2013 21:20:17 +0000
Cache-Control: public, max-age=900
ETag: "1357680017-1"
Content-Language: en
X-Generator: Drupal 7 (http://drupal.org)
Link: </node/5468>; rel="shortlink",<http://badgerfakedomain.com/>; rel="canonical"
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Date: Tue, 08 Jan 2013 21:20:22 GMT
X-Varnish: 979772308 979772303
Age: 3
Via: 1.1 varnish
Connection: keep-alive
X-Cache: HIT
Resource Caching - Varnish
Cache Stores
- RAM
- Disk

Ram - super fast - requires a lot of ram
Disk - fast - disk space is rarely an issue
Data Caching - memcached
Data and Database caching layer

Caches cache...
(and things!)
Data Caching - memcached
Example:
Core cache - core cache tables (cache_*)

Moved into memcached and shared between
multiple instances across multiple servers

Simple api makes getting and setting easy

Drupal requires - http://drupal.
org/project/memcache and pecl extension
3rd Party Caching - Akamai
One of the biggest caching providers

A high chance you've experienced Akamai 4-5
times today.

Static cache of resources
Content Distribution Network
100+ Edge servers all over the planet
3rd Party Caching - Akamai
Coverage for DDOS attacks
- Active monitoring and defense

Advanced redirection rules through control
panel

It's not cheap!

It's also pretty magical.
3rd Party Caching - Cloudflare
Similar to Akamai

Smaller scale

Emphasis on security and DDOS protection
Content Distribution Networks
CDNs for short

Offload resource handling to external provider
- Images
- Video
- Audio
- Large files

Syndicate content around the world
Content Distribution Network
Why use a CDN?
- Content is delivered quicker
-- Latency cut down

Pricing is granular - pay as you go type deal

Amazon + Rackspace Cloud Files
How does it all fit together?


                                       Apache /    Mysql /
                             Varnish    Nginx     memcache

                                       Apache /    Mysql /
                                        Nginx     memcache
    Akamai   Load Balancer
                                       Apache /    Mysql /
                                        Nginx     memcache
                             Varnish   Apache /    Mysql /
                                        Nginx     memcache
What happens when it all goes
wrong?
Caching to the rescue
Each layer provides protection

3rd Party - shield 99% of anon traffic
Varnish - the rest

Anonymous users should never know your site
has issues.
Debugging Tips
Configure different urls for different platforms
- Easier to identify what cache layer has an
issue

Don't be afraid to flush caches
- Your backend should be able to cope with it

Analyse headers! Drupal and Varnish provide a
lot of info
Debugging Tips
Monitor each layer
- Icinga
- Pingdom
Any Questions?

Contenu connexe

Tendances

How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcachevaluebound
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Justin Foell
 
Using memcache to improve php performance
Using memcache to improve php performanceUsing memcache to improve php performance
Using memcache to improve php performanceSudar Muthu
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference RecapChris Barber
 
Caching in Drupal 8
Caching in Drupal 8Caching in Drupal 8
Caching in Drupal 8valuebound
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Brian Moon
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 
Memcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainMemcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainDrupal Camp Delhi
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHPAnis Ahmad
 
Performance Optimization using Caching | Swatantra Kumar
Performance Optimization using Caching | Swatantra KumarPerformance Optimization using Caching | Swatantra Kumar
Performance Optimization using Caching | Swatantra KumarSwatantra Kumar
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPressMikel King
 
Memcache basics on google app engine
Memcache basics on google app engineMemcache basics on google app engine
Memcache basics on google app engineIdo Green
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012jonswar
 
CHI-YAPC-2009
CHI-YAPC-2009CHI-YAPC-2009
CHI-YAPC-2009jonswar
 
Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)Brian Moon
 
Simple Site Speed Improvements (SMX 2010)
Simple Site Speed Improvements (SMX 2010)Simple Site Speed Improvements (SMX 2010)
Simple Site Speed Improvements (SMX 2010)Ralf Schwoebel
 
Serve like a boss (part two)
Serve like a boss (part two)Serve like a boss (part two)
Serve like a boss (part two)Hamed Nemati
 

Tendances (20)

How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcache
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
Using memcache to improve php performance
Using memcache to improve php performanceUsing memcache to improve php performance
Using memcache to improve php performance
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference Recap
 
Caching in Drupal 8
Caching in Drupal 8Caching in Drupal 8
Caching in Drupal 8
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Memcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainMemcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav Jain
 
Optimize drupal
Optimize drupalOptimize drupal
Optimize drupal
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHP
 
Performance Optimization using Caching | Swatantra Kumar
Performance Optimization using Caching | Swatantra KumarPerformance Optimization using Caching | Swatantra Kumar
Performance Optimization using Caching | Swatantra Kumar
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPress
 
Memcache basics on google app engine
Memcache basics on google app engineMemcache basics on google app engine
Memcache basics on google app engine
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012
 
CHI-YAPC-2009
CHI-YAPC-2009CHI-YAPC-2009
CHI-YAPC-2009
 
Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)
 
Simple Site Speed Improvements (SMX 2010)
Simple Site Speed Improvements (SMX 2010)Simple Site Speed Improvements (SMX 2010)
Simple Site Speed Improvements (SMX 2010)
 
Serve like a boss (part two)
Serve like a boss (part two)Serve like a boss (part two)
Serve like a boss (part two)
 

Similaire à Cache all the things - A guide to caching Drupal

Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Wim Godden
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesExove
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialWim Godden
 
PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8Acquia
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and ScalabilityMediacurrent
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memoryMauro Cassani
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourWim Godden
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceAshok Modi
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Marcus Deglos
 
Challenges when building high profile editorial sites
Challenges when building high profile editorial sitesChallenges when building high profile editorial sites
Challenges when building high profile editorial sitesYann Malet
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & ScalabilityJoseph Scott
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupalJason Burnett
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!WordCamp Cape Town
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 

Similaire à Cache all the things - A guide to caching Drupal (20)

Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
 
Challenges when building high profile editorial sites
Challenges when building high profile editorial sitesChallenges when building high profile editorial sites
Challenges when building high profile editorial sites
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupal
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 

Plus de digital006

Vagrant and Puppet primer - NWDUG Sept 2013
Vagrant and Puppet primer - NWDUG Sept 2013Vagrant and Puppet primer - NWDUG Sept 2013
Vagrant and Puppet primer - NWDUG Sept 2013digital006
 
Custom Drush Commands - Drupal Yorkshire
Custom Drush Commands - Drupal YorkshireCustom Drush Commands - Drupal Yorkshire
Custom Drush Commands - Drupal Yorkshiredigital006
 
NWDUG Back to Basics - Part 1
NWDUG Back to Basics - Part 1NWDUG Back to Basics - Part 1
NWDUG Back to Basics - Part 1digital006
 
PHPNW Drupal as a Framework
PHPNW Drupal as a FrameworkPHPNW Drupal as a Framework
PHPNW Drupal as a Frameworkdigital006
 
PHPNW Why Drupal is Awesome and you should all use it!
PHPNW Why Drupal is Awesome and you should all use it!PHPNW Why Drupal is Awesome and you should all use it!
PHPNW Why Drupal is Awesome and you should all use it!digital006
 
Yet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment PresentationYet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment Presentationdigital006
 

Plus de digital006 (6)

Vagrant and Puppet primer - NWDUG Sept 2013
Vagrant and Puppet primer - NWDUG Sept 2013Vagrant and Puppet primer - NWDUG Sept 2013
Vagrant and Puppet primer - NWDUG Sept 2013
 
Custom Drush Commands - Drupal Yorkshire
Custom Drush Commands - Drupal YorkshireCustom Drush Commands - Drupal Yorkshire
Custom Drush Commands - Drupal Yorkshire
 
NWDUG Back to Basics - Part 1
NWDUG Back to Basics - Part 1NWDUG Back to Basics - Part 1
NWDUG Back to Basics - Part 1
 
PHPNW Drupal as a Framework
PHPNW Drupal as a FrameworkPHPNW Drupal as a Framework
PHPNW Drupal as a Framework
 
PHPNW Why Drupal is Awesome and you should all use it!
PHPNW Why Drupal is Awesome and you should all use it!PHPNW Why Drupal is Awesome and you should all use it!
PHPNW Why Drupal is Awesome and you should all use it!
 
Yet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment PresentationYet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment Presentation
 

Cache all the things - A guide to caching Drupal

  • 1. Cache All The Things
  • 2. About Me Mike Bell Drupal Developer @mikebell_ http://drupal.org/user/189605
  • 4. No really... Frontend: - HTML - CSS - Images - Javascript Backend: - PHP - MySQL So pretty much everything then!
  • 5. Where to start? Ask yourself: Why is my site slow? a) Bad code b) Bad server c) It's not!
  • 6. Bad Code Stop. Caching will help... but it won't solve your bigger issues. There are tools to help - xhprof (not covered here)
  • 7. Bad Server? So how's £5.99 a month working out for you? Caching will help... but you still have bigger issues. Scale horizontally/vertically for a quick fix then work on additional caching.
  • 8. It's not! I like you! Caching is always a good thing, except when you have to debug it...
  • 9. Caching in Drupal - Code Level (cache_get/cache_set) - APC (not covering) - Resource caching (this get's tricky!) - DB Layer - CDNs (related to resource caching)
  • 10. Code Level Drupal has it's own caching api. Module Developers use it! cache_set - store data in Drupals cache table cache_get - get data from Drupals cache table You can even define your own cache tables!
  • 11. Code Level (example) <?php function mymodule_cached_data($reset = FALSE) { global $language; $langcode = $language->language; $data = &drupal_static(__FUNCTION__, NULL, $reset); if (!isset($data)) { if (!$reset && $cache = cache_get("mymodule_cached_data:$langcode") && !empty($cache->data)) { $data = $cache->data; } else { $data = t('This would be an array or string generated using translated strings.'); cache_set("mymodule_cached_data:$langcode", $data); } } return $data; } ?> (source - http://drupal.org/node/145279)
  • 12. Resource Caching Many different types of resources Each can be cached by different tools Example: - Drupals CSS/JS Cache - Drupals Page Cache - Boost - Varnish
  • 13. Resource Caching Drupal default: CSS/JS and Page (taken from digital006.com - ooppss!)
  • 14. Resource Caching - Boost Boost - http://drupal.org/project/boost Static caching for all Drupal Assets Anonymous users only Ideal for shared hosting environments Potentially the easiest to setup
  • 15. Resource Caching - Varnish Application Accelerator Linux Only Caches resources based on initial view Anonymous only - very picky with sessions and cookies Insanely Powerful
  • 16. Resource Caching - Varnish Advanced setup - requires additional module and VCL for Drupal - http://drupal.org/project/varnish Granular ttls (time to live) Specific resource (image/css) and page element! All available through VCL config.
  • 17. Resource Caching - Varnish Anatomy of a varnish hit: HTTP/1.1 200 OK Server: Apache X-Drupal-Cache: MISS Expires: Sun, 19 Nov 1978 05:00:00 GMT Last-Modified: Tue, 08 Jan 2013 21:20:17 +0000 Cache-Control: public, max-age=900 ETag: "1357680017-1" Content-Language: en X-Generator: Drupal 7 (http://drupal.org) Link: </node/5468>; rel="shortlink",<http://badgerfakedomain.com/>; rel="canonical" Vary: Accept-Encoding Content-Type: text/html; charset=utf-8 Date: Tue, 08 Jan 2013 21:20:22 GMT X-Varnish: 979772308 979772303 Age: 3 Via: 1.1 varnish Connection: keep-alive X-Cache: HIT
  • 18. Resource Caching - Varnish Cache Stores - RAM - Disk Ram - super fast - requires a lot of ram Disk - fast - disk space is rarely an issue
  • 19. Data Caching - memcached Data and Database caching layer Caches cache... (and things!)
  • 20. Data Caching - memcached Example: Core cache - core cache tables (cache_*) Moved into memcached and shared between multiple instances across multiple servers Simple api makes getting and setting easy Drupal requires - http://drupal. org/project/memcache and pecl extension
  • 21. 3rd Party Caching - Akamai One of the biggest caching providers A high chance you've experienced Akamai 4-5 times today. Static cache of resources Content Distribution Network 100+ Edge servers all over the planet
  • 22. 3rd Party Caching - Akamai Coverage for DDOS attacks - Active monitoring and defense Advanced redirection rules through control panel It's not cheap! It's also pretty magical.
  • 23. 3rd Party Caching - Cloudflare Similar to Akamai Smaller scale Emphasis on security and DDOS protection
  • 24. Content Distribution Networks CDNs for short Offload resource handling to external provider - Images - Video - Audio - Large files Syndicate content around the world
  • 25. Content Distribution Network Why use a CDN? - Content is delivered quicker -- Latency cut down Pricing is granular - pay as you go type deal Amazon + Rackspace Cloud Files
  • 26. How does it all fit together? Apache / Mysql / Varnish Nginx memcache Apache / Mysql / Nginx memcache Akamai Load Balancer Apache / Mysql / Nginx memcache Varnish Apache / Mysql / Nginx memcache
  • 27. What happens when it all goes wrong?
  • 28. Caching to the rescue Each layer provides protection 3rd Party - shield 99% of anon traffic Varnish - the rest Anonymous users should never know your site has issues.
  • 29. Debugging Tips Configure different urls for different platforms - Easier to identify what cache layer has an issue Don't be afraid to flush caches - Your backend should be able to cope with it Analyse headers! Drupal and Varnish provide a lot of info
  • 30. Debugging Tips Monitor each layer - Icinga - Pingdom