SlideShare une entreprise Scribd logo
1  sur  31
High Performance
Drupal Web Sites

     360°

      jbguerraz@skilld.fr
Who's that punk ?!
●
    A French nerd !
●   Used to manage complex IT projects for the
    last 10 years
●
    And many more nights on performances

    issues   ... :)
●
    ... who just created his own company
Summary



    Cache

    Upload & Download

    Browser rendering

    Compression

    Drupal pages architecture

    Analyze
Cache
What should we cache ?

                            EVERY POSSIBLE THING !!!

●   PHP (opcode)
●   Computations (functions results)
●   Datas (views, DB requests)
●   Entities & Fields (nodes, comments, taxonomy terms, user profiles,…)
●   Images (imagecache/styles)
●   HTML (page, block, panel, pane, views)
●   Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …)




                                   jbguerraz@skilld.fr
Cache
How should we cache ?


PHP (opcode) :                                // allocate one segment of 32Mb
                                              apc.shm_segments=1
                                              apc.shm_size=32

                                              // do not check if php file was updated
                                              apc.stat= 0
●
    APC                                       // never expire
                                              apc.ttl = 0
●
    Eaccelerator (a bit faster,               // use kernel anonymous memory

    seg fault)                                apc.mmap_file_mask = /dev/zero.




                        jbguerraz@skilld.fr
Cache
How should we cache ?

                                         function mymodule_complex_calculation_crazy_cache() {
Computations (functions results) :         static $cache ;
                                           if (isset($cache)) {
                                             return $cache ;
                                           }
● drupal_static (sometime static if big    if ($cache = &drupal_static(__FUNCTION__)) {
                                             return $cache;
  amount of calls within a page load) }
                                           if ($cache = cache_get('my_cache_item', 'my_cache_bin')) {
                                             $cache = $cache->data;
                                           }
● cache_set / cache_get (use your own else {

  bin if lot of data to store and/or need // some = complex_calculation(); kitten
                                             $cache
                                                      heavy calculations that kills

  more control over your cache)              cache_set('my_cache_item', $cache, 'my_cache_bin');
                                           }
                                           return $cache ;
                                         }




                                       jbguerraz@skilld.fr
Cache
                                                 Note :
How should we cache ?                            A custom cache bin require, at
                                                 module install, to create a new cache
                                                 table using the same schema as core
                                                 cache tables (see table below).
                                                 Copy/paste from :
Datas (views, DB requests) :                     includes/system.install

●
    Views cache                                        Field          Type      Null
                                                 cid           varchar(255)   no
●
    Views per user cache
                                                 data          longblob       yes
●
    Own cache bin for DB requests (if            expire        int            no
    somehow there is a good reason               created       int            no
    to request DB directly)                      headers       text           yes
                                                 serialized smallint          no




                           jbguerraz@skilld.fr
Cache
How should we cache ?

Entities (nodes, comments, taxonomy terms,
 user profiles,…) :             Entity cache
                                                       Load 1 000 users
●
    Entity cache                50
                                45
                                40
                                35                                                 First load
                                30                                                 Next loads
                      seconds



                                25
                                20
                                15
                                10
                                 5
                                 0
                                     No entity cache                Entity cache




                   jbguerraz@skilld.fr
Cache
How should we cache ?


Images (imagecache/styles) :
●
    ImageCache
●
    ImageCache External




                    jbguerraz@skilld.fr
Cache
How should we cache ?


HTML (page, block, panel, pane, views) :
●
    Panels Page Cache
●
    Panels Hash Cache
●
    Varnish
●
    Varnish ESI


                    jbguerraz@skilld.fr
Cache
How should we cache ?


Any static ressource (CSS, JS, SWF, SVG,
 PDF, ZIP, Video, Sound, …) :
●
    Varnish
●
    Nginx
●
    CDN far-future



                     jbguerraz@skilld.fr
Cache
What cache backends ?




             http://janezurevc.name/static/bcn_cache



                    jbguerraz@skilld.fr
Cache
What about cache invalidation ?

●
    Cache actions
●
    Cachetags
●
    Views content cache
●
    Expire
●
    Entity cache flusher


                       jbguerraz@skilld.fr
Upload & Download

Cookie free domains

CDN module in order to use static resources
 dedicated domain(s) which differ from main
 domain (for instance, static.mysite.com)

$cookie_domain have to be set to main domain in
  settings.php (for instance www.mysite.com)


                   jbguerraz@skilld.fr
Upload & Download

Aggregates

●
  JS (Advanced aggregate)
                                        Note :
●
  CSS (Advanced aggregate)              Sprites are now obselete, use CSS
                                        embeded image instead
●
  Images & CSS (CSS
                                        (for IE, images <32Kb can be
   embeded image)                       embeded)

●
  Images (spritesheets)



                  jbguerraz@skilld.fr
Upload & Download

Parrallelization

●
  CDN (URL
  sharding)
●
  Head.js
                                                                    CSS
●
  Yepnopejs
(Interesting but not yet drupal integrated)
                                                                    JS




                                              jbguerraz@skilld.fr
Browser rendering

JS

●
    Rendering sequence : request as soon as it
    parse
       ●
           JS in footer scope
●
    Head.js / lab.js (defer)




                          jbguerraz@skilld.fr
Browser rendering

CSS

●
  Translate3D, no DOM position change
●
  Pay attention to selectors performances ! No
  CSS3 selectors (great but slow)
●
  Avoid blinking > no JS to hide an element on
  load, hide by CSS and show from JS
  (perception matters!)


                    jbguerraz@skilld.fr
Compression

What should we compress ?

●
  Images
●
  CSS
●
  JS
●
  HTML
●
  «Any» static file



                       jbguerraz@skilld.fr
Compression

How should we compress ?

Images

●
    Imageapi optimize
       ●
           jpegtran
       ●
           advpng




                        jbguerraz@skilld.fr
Compression

How should we compress ?

CSS

●
  Advagg CSS compress
●
  CSS Compressor
       ●
           faster than CSSTidy
●
    gzip


                         jbguerraz@skilld.fr
Compression

How should we compress ?

JS

●
  Advagg JS compress
●
  JSMin
       ●
           faster than JSMin+
●
    Gzip


                          jbguerraz@skilld.fr
Compression

How should we compress ?

HTML

●
    Gzip




                jbguerraz@skilld.fr
Compression

How should we compress ?

Any static files

●
    Gzip




                    jbguerraz@skilld.fr
Drupal pages architecture

How to build a performant page ?

      USE AS FEW MODULES AS POSSIBLE !

  ●Search_api (solr, mongo)          ●Panels
  ●Mongodb                           ●Panels everywhere

  ●Redis                             ●Views

  ●Memcache                          ●Rules

  ●Elysia cron                       ●Entities




                              jbguerraz@skilld.fr
Drupal pages architecture

Why homogeneity maters ?

           Blocks, panes, pick one !

One single way of managing « blocks » helps
 using ESI caching for instance; it also makes
 easier the cache invalidation management for
 these «blocks».
      Keep it simple : one API to implement


                   jbguerraz@skilld.fr
Analyze

Browser level

●
  Gtmetrix.com
●
  Yslow
●
  Firebug
●
  Chrome / Safari developer tools
●
  Whichloadsfaster.com



                    jbguerraz@skilld.fr
Analyze

Drupal level

●
  Devel
●
  Watchdog (redirected to syslog if needed on live
  server)




                    jbguerraz@skilld.fr
Analyze

PHP level

●
  FirePHP / ChromePHP
●
  Xhprof (eventually in addition to Xdebug)
●
  PHP error log
●
  PHP-FPM slow logs
●
  MySQL Slow query logs



                    jbguerraz@skilld.fr
Analyze

System level

●
  strace
●
  tcpdump & wireshark




                   jbguerraz@skilld.fr
Spasibo bolshoe !
Your time now, any question ?




         Wanna get these slides ?


    Search for jbguerraz on Slideshare ;)




              jbguerraz@skilld.fr

Contenu connexe

Tendances

iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2Baruch Osoveskiy
 
Hong Qiangning in QConBeijing
Hong Qiangning in QConBeijingHong Qiangning in QConBeijing
Hong Qiangning in QConBeijingshen liu
 
CUDA Deep Dive
CUDA Deep DiveCUDA Deep Dive
CUDA Deep Divekrasul
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!Daniel Cousineau
 
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
2012-03-20 - Getting started with Node.js and MongoDB on MS AzureJohannes Hoppe
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDBDavid Coallier
 
Node.js in action
Node.js in actionNode.js in action
Node.js in actionSimon Su
 
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliNoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliSteve Maraspin
 
2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung MosbachJohannes Hoppe
 
Scaling Rails with Memcached
Scaling Rails with MemcachedScaling Rails with Memcached
Scaling Rails with Memcachedguest2259ea
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core DataInferis
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined DatacenterNETWAYS
 
Varnish in action confoo11
Varnish in action confoo11Varnish in action confoo11
Varnish in action confoo11Combell NV
 
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)Johannes Hoppe
 
What istheservicestack
What istheservicestackWhat istheservicestack
What istheservicestackDemis Bellot
 
Percona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationPercona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationmysqlops
 
Create a Core Data Observer in 10mins
Create a Core Data Observer in 10minsCreate a Core Data Observer in 10mins
Create a Core Data Observer in 10minszmcartor
 

Tendances (18)

iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2
 
Hong Qiangning in QConBeijing
Hong Qiangning in QConBeijingHong Qiangning in QConBeijing
Hong Qiangning in QConBeijing
 
CUDA Deep Dive
CUDA Deep DiveCUDA Deep Dive
CUDA Deep Dive
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
Node.js in action
Node.js in actionNode.js in action
Node.js in action
 
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non RelazionaliNoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
NoSQL Data Stores: Introduzione alle Basi di Dati Non Relazionali
 
2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach
 
Scaling Rails with Memcached
Scaling Rails with MemcachedScaling Rails with Memcached
Scaling Rails with Memcached
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core Data
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
 
Varnish in action confoo11
Varnish in action confoo11Varnish in action confoo11
Varnish in action confoo11
 
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)
2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)
 
What istheservicestack
What istheservicestackWhat istheservicestack
What istheservicestack
 
Percona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationPercona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimization
 
Create a Core Data Observer in 10mins
Create a Core Data Observer in 10minsCreate a Core Data Observer in 10mins
Create a Core Data Observer in 10mins
 
Cold Hard Cache
Cold Hard CacheCold Hard Cache
Cold Hard Cache
 

En vedette

Csc1401 lecture07 -external memory
Csc1401   lecture07 -external memoryCsc1401   lecture07 -external memory
Csc1401 lecture07 -external memoryIIUM
 
External memory - Computer Architecture
External memory - Computer ArchitectureExternal memory - Computer Architecture
External memory - Computer ArchitectureBretz Harllynne Moltio
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in javaagorolabs
 
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)Raid Data Recovery
 
Computer Hardware
Computer HardwareComputer Hardware
Computer Hardwarenitinmote
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Computer Architecture and organization
Computer Architecture and organizationComputer Architecture and organization
Computer Architecture and organizationBadrinath Kadam
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 
08. Central Processing Unit (CPU)
08. Central Processing Unit (CPU)08. Central Processing Unit (CPU)
08. Central Processing Unit (CPU)Akhila Dakshina
 
Cpu presentation
Cpu presentationCpu presentation
Cpu presentationHarry Singh
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 

En vedette (20)

Edp111c z2-001
Edp111c z2-001Edp111c z2-001
Edp111c z2-001
 
Csc1401 lecture07 -external memory
Csc1401   lecture07 -external memoryCsc1401   lecture07 -external memory
Csc1401 lecture07 -external memory
 
06 External Memory
06  External  Memory06  External  Memory
06 External Memory
 
External memory - Computer Architecture
External memory - Computer ArchitectureExternal memory - Computer Architecture
External memory - Computer Architecture
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
RAID seminar
RAID seminarRAID seminar
RAID seminar
 
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)
Understanding RAID Levels (RAID 0, RAID 1, RAID 2, RAID 3, RAID 4, RAID 5)
 
Computer Hardware
Computer HardwareComputer Hardware
Computer Hardware
 
Input-Output Modules
Input-Output ModulesInput-Output Modules
Input-Output Modules
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Computer Architecture and organization
Computer Architecture and organizationComputer Architecture and organization
Computer Architecture and organization
 
Cpu ppt cse
Cpu ppt cseCpu ppt cse
Cpu ppt cse
 
RAID
RAIDRAID
RAID
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
08. Central Processing Unit (CPU)
08. Central Processing Unit (CPU)08. Central Processing Unit (CPU)
08. Central Processing Unit (CPU)
 
Cpu presentation
Cpu presentationCpu presentation
Cpu presentation
 
Hard disk PPT
Hard disk PPTHard disk PPT
Hard disk PPT
 
E commerce ppt
E commerce pptE commerce ppt
E commerce ppt
 
E commerce
E commerceE commerce
E commerce
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 

Similaire à Drupal Camp Kiev 2012 - High Performance Drupal Web Sites

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesSkilld
 
CHI-YAPC-2009
CHI-YAPC-2009CHI-YAPC-2009
CHI-YAPC-2009jonswar
 
Drupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hoodDrupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hoodPiyuesh Kumar
 
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
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtfOlivier Lamy
 
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...ScyllaDB
 
Render Caching for Drupal 8
Render Caching for Drupal 8Render Caching for Drupal 8
Render Caching for Drupal 8John Doyle
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails applicationArrrrCamp
 
High Performance Django 1
High Performance Django 1High Performance Django 1
High Performance Django 1DjangoCon2008
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance DjangoDjangoCon2008
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDocker, Inc.
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012jonswar
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupaldigital006
 

Similaire à Drupal Camp Kiev 2012 - High Performance Drupal Web Sites (20)

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
 
CHI-YAPC-2009
CHI-YAPC-2009CHI-YAPC-2009
CHI-YAPC-2009
 
Drupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hoodDrupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hood
 
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
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtf
 
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...
Key-Key-Value Store: Generic NoSQL Datastore with Tombstone Reduction and Aut...
 
Render Caching for Drupal 8
Render Caching for Drupal 8Render Caching for Drupal 8
Render Caching for Drupal 8
 
Azure appfabric caching intro and tips
Azure appfabric caching intro and tipsAzure appfabric caching intro and tips
Azure appfabric caching intro and tips
 
Caching in WordPress
Caching in WordPressCaching in WordPress
Caching in WordPress
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
 
High Performance Django 1
High Performance Django 1High Performance Django 1
High Performance Django 1
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
 
Fluent 2012 v2
Fluent 2012   v2Fluent 2012   v2
Fluent 2012 v2
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
Varnish - PLNOG 4
Varnish - PLNOG 4Varnish - PLNOG 4
Varnish - PLNOG 4
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupal
 

Dernier

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Dernier (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites

  • 1. High Performance Drupal Web Sites 360° jbguerraz@skilld.fr
  • 2. Who's that punk ?! ● A French nerd ! ● Used to manage complex IT projects for the last 10 years ● And many more nights on performances issues ... :) ● ... who just created his own company
  • 3. Summary  Cache  Upload & Download  Browser rendering  Compression  Drupal pages architecture  Analyze
  • 4. Cache What should we cache ? EVERY POSSIBLE THING !!! ● PHP (opcode) ● Computations (functions results) ● Datas (views, DB requests) ● Entities & Fields (nodes, comments, taxonomy terms, user profiles,…) ● Images (imagecache/styles) ● HTML (page, block, panel, pane, views) ● Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …) jbguerraz@skilld.fr
  • 5. Cache How should we cache ? PHP (opcode) : // allocate one segment of 32Mb apc.shm_segments=1 apc.shm_size=32 // do not check if php file was updated apc.stat= 0 ● APC // never expire apc.ttl = 0 ● Eaccelerator (a bit faster, // use kernel anonymous memory seg fault) apc.mmap_file_mask = /dev/zero. jbguerraz@skilld.fr
  • 6. Cache How should we cache ? function mymodule_complex_calculation_crazy_cache() { Computations (functions results) : static $cache ; if (isset($cache)) { return $cache ; } ● drupal_static (sometime static if big if ($cache = &drupal_static(__FUNCTION__)) { return $cache; amount of calls within a page load) } if ($cache = cache_get('my_cache_item', 'my_cache_bin')) { $cache = $cache->data; } ● cache_set / cache_get (use your own else { bin if lot of data to store and/or need // some = complex_calculation(); kitten $cache heavy calculations that kills more control over your cache) cache_set('my_cache_item', $cache, 'my_cache_bin'); } return $cache ; } jbguerraz@skilld.fr
  • 7. Cache Note : How should we cache ? A custom cache bin require, at module install, to create a new cache table using the same schema as core cache tables (see table below). Copy/paste from : Datas (views, DB requests) : includes/system.install ● Views cache Field Type Null cid varchar(255) no ● Views per user cache data longblob yes ● Own cache bin for DB requests (if expire int no somehow there is a good reason created int no to request DB directly) headers text yes serialized smallint no jbguerraz@skilld.fr
  • 8. Cache How should we cache ? Entities (nodes, comments, taxonomy terms, user profiles,…) : Entity cache Load 1 000 users ● Entity cache 50 45 40 35 First load 30 Next loads seconds 25 20 15 10 5 0 No entity cache Entity cache jbguerraz@skilld.fr
  • 9. Cache How should we cache ? Images (imagecache/styles) : ● ImageCache ● ImageCache External jbguerraz@skilld.fr
  • 10. Cache How should we cache ? HTML (page, block, panel, pane, views) : ● Panels Page Cache ● Panels Hash Cache ● Varnish ● Varnish ESI jbguerraz@skilld.fr
  • 11. Cache How should we cache ? Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …) : ● Varnish ● Nginx ● CDN far-future jbguerraz@skilld.fr
  • 12. Cache What cache backends ? http://janezurevc.name/static/bcn_cache jbguerraz@skilld.fr
  • 13. Cache What about cache invalidation ? ● Cache actions ● Cachetags ● Views content cache ● Expire ● Entity cache flusher jbguerraz@skilld.fr
  • 14. Upload & Download Cookie free domains CDN module in order to use static resources dedicated domain(s) which differ from main domain (for instance, static.mysite.com) $cookie_domain have to be set to main domain in settings.php (for instance www.mysite.com) jbguerraz@skilld.fr
  • 15. Upload & Download Aggregates ● JS (Advanced aggregate) Note : ● CSS (Advanced aggregate) Sprites are now obselete, use CSS embeded image instead ● Images & CSS (CSS (for IE, images <32Kb can be embeded image) embeded) ● Images (spritesheets) jbguerraz@skilld.fr
  • 16. Upload & Download Parrallelization ● CDN (URL sharding) ● Head.js CSS ● Yepnopejs (Interesting but not yet drupal integrated) JS jbguerraz@skilld.fr
  • 17. Browser rendering JS ● Rendering sequence : request as soon as it parse ● JS in footer scope ● Head.js / lab.js (defer) jbguerraz@skilld.fr
  • 18. Browser rendering CSS ● Translate3D, no DOM position change ● Pay attention to selectors performances ! No CSS3 selectors (great but slow) ● Avoid blinking > no JS to hide an element on load, hide by CSS and show from JS (perception matters!) jbguerraz@skilld.fr
  • 19. Compression What should we compress ? ● Images ● CSS ● JS ● HTML ● «Any» static file jbguerraz@skilld.fr
  • 20. Compression How should we compress ? Images ● Imageapi optimize ● jpegtran ● advpng jbguerraz@skilld.fr
  • 21. Compression How should we compress ? CSS ● Advagg CSS compress ● CSS Compressor ● faster than CSSTidy ● gzip jbguerraz@skilld.fr
  • 22. Compression How should we compress ? JS ● Advagg JS compress ● JSMin ● faster than JSMin+ ● Gzip jbguerraz@skilld.fr
  • 23. Compression How should we compress ? HTML ● Gzip jbguerraz@skilld.fr
  • 24. Compression How should we compress ? Any static files ● Gzip jbguerraz@skilld.fr
  • 25. Drupal pages architecture How to build a performant page ? USE AS FEW MODULES AS POSSIBLE ! ●Search_api (solr, mongo) ●Panels ●Mongodb ●Panels everywhere ●Redis ●Views ●Memcache ●Rules ●Elysia cron ●Entities jbguerraz@skilld.fr
  • 26. Drupal pages architecture Why homogeneity maters ? Blocks, panes, pick one ! One single way of managing « blocks » helps using ESI caching for instance; it also makes easier the cache invalidation management for these «blocks». Keep it simple : one API to implement jbguerraz@skilld.fr
  • 27. Analyze Browser level ● Gtmetrix.com ● Yslow ● Firebug ● Chrome / Safari developer tools ● Whichloadsfaster.com jbguerraz@skilld.fr
  • 28. Analyze Drupal level ● Devel ● Watchdog (redirected to syslog if needed on live server) jbguerraz@skilld.fr
  • 29. Analyze PHP level ● FirePHP / ChromePHP ● Xhprof (eventually in addition to Xdebug) ● PHP error log ● PHP-FPM slow logs ● MySQL Slow query logs jbguerraz@skilld.fr
  • 30. Analyze System level ● strace ● tcpdump & wireshark jbguerraz@skilld.fr
  • 31. Spasibo bolshoe ! Your time now, any question ? Wanna get these slides ? Search for jbguerraz on Slideshare ;) jbguerraz@skilld.fr