SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
My	
  site	
  is	
  slow	
  

 Hernâni	
  Borges	
  de	
  Freitas	
  
 Technical	
  Consultant	
  
 hernani@acquia.com	
  
 @hernanibf	
  
 	
  
 	
  
 London,	
  2nd	
  March,	
  2013	
  
About	
  me	
  

   •  .PT	
  	
  
   •  Acquia	
  Professional	
  Services	
  
            EMEA	
  
   •        Technical	
  Consultant	
  
   •        Drupal*	
  many	
  things	
  
   •        Travel	
  lover	
  
   •        Twitter.com/hernanibf	
  



My	
  site	
  is	
  slow	
  
What	
  does	
  my	
  team	
  do	
  ?	
  
   •        Drupal	
  Jumpstarts	
  
   •        Architecture	
  Workshops	
  
   •        Discovery	
  workshops	
  
   •        Site	
  Audits	
  
   •        Performance	
  Assessment	
  
   •        Security	
  Audits	
  
   •        On-­‐site	
  Consulting	
  



My	
  site	
  is	
  slow	
  
This	
  talk	
  

          is	
  mostly	
  about
                              	
                  is	
  not	
  much	
  about
                                                                           	
  
   •  Understanding	
  your	
  site	
             •  Increasing	
  performance	
  
       •  Your	
  limits	
                           by	
  changing	
  

       •  Your	
  benchmarks	
                     •  Infrastructure	
  
       •  Your	
  problems	
                       •  Caching	
  Strategies	
  

   •  Make	
  it	
  faster	
  with	
  same	
  
            resources.	
  


My	
  site	
  is	
  slow	
  
This is how it starts



                               My site is slow. 	




My	
  site	
  is	
  slow	
  
This is what usually follows.
                We already added        We are thinking about
                 5 more                  adding more mysql
                 webservers... 	

                                         slaves…

              We added nginx,
                                           We need more
               changed MySql
                                            granularity in slow
               version, added
                                            query logs. 	

               memcache... 	


                    We are sure the         We tried to patch
                     problem is in           boost module to
                     PHP Version. 	

        serve our needs. 	


My	
  site	
  is	
  slow	
  
But sometimes it’s even worst.
              “We need to rebuild
                this site from          We need to cache the
                scratch”.	

             whole site.


              We will export the
                                          We can’t handle this
               site to pure HTML
                                           traffic with Drupal .	

               and ditch the CMS. 	





My	
  site	
  is	
  slow	
  
What	
  you	
  mean?	
  “It’s	
  slow”?	
  
   •  Backend	
  slowness	
  
       •  Services	
  that	
  website	
  use	
  are	
  slow	
  or	
  
               unresponsive	
  (dbs)	
  
    •  Application	
  too	
  complex	
  
    •  Server	
  resources	
  overload	
  
   •  Frontend	
  slowness	
  
    •  Too	
  many	
  /	
  large	
  assets	
  
    •  Slow	
  connection	
  between	
  browser	
  and	
  
               server.	
  
       •  JS	
  slowing	
  the	
  DOM	
  (re)rendering	
  	
  

My	
  site	
  is	
  slow	
  
Science	
  
    Base your work in what you can prove	


   •  Find	
  good	
  data	
  that	
  you	
  can	
  use	
  
            to	
  measure.	
  
   •  Find	
  good	
  profiling	
  data	
  you	
  
            can	
  use	
  to	
  analyze.	
  
   •  Implement	
  improvements	
  for	
  
            the	
  problems	
  found.	
  
   •  Measure	
  again.	
  



My	
  site	
  is	
  slow	
  
Data	
  about	
  your	
  site	
  
   Understanding	
  how	
  much	
  time	
  are	
  you	
  taking	
  per	
  page	
  
                                       	

    You	
  need	
  data	
  to	
  understand	
  your	
  current	
  
    situation	
  and	
  compare	
  after	
  your	
  changes.	
  
     •  Apache	
  logs	
  with	
  rendering	
  times	
  
     	
  
    LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined	


             [31/Jan/2008:14:19:07 +0000] "GET / HTTP/1.1" 200 7918 ”" 0/95491	




     •  Accesslog	
  from	
  statistics	
  table	
  
            Aid        Title           Path          Ip            Uid         Timer      Timestamp
              23557145 Directory       node/465      10.156.11.248        2632    7262806        1346855808
              23557361                 home          10.156.11.248        9263    6967768        1346856897
              23557399                 home          10.156.11.248        7904    6690128        1346856985
              23557081 Search          search/node/how2=register=lovefilm 8058
                                                     10.156.11.248                6509745        1346855538

My	
  site	
  is	
  slow	
  
NewRelic.com	
  
   Extra insight about how are you doing	





My	
  site	
  is	
  slow	
  
Google	
  Analytics	
  site	
  speed	
  
   Be sure you know how fast you are delivering front end	





My	
  site	
  is	
  slow	
  
Analyze	
  on	
  a	
  deeper	
  level	
  
   Generate	
  your	
  own	
  data	


     •  XhProf	
  
     •  XhProfCli	
  
     Aggregates	
  data	
  from	
  XhProf	
  profiling	
  data	
  from	
  a	
  
     set	
  of	
  pages.	
  
     https://github.com/msonnabaum/XHProfCLI	
  
     	
  
     	
  




My	
  site	
  is	
  slow	
  
What	
  you	
  need	
  to	
  find	
  
   Before you do anything else	


          •  Find	
  average/individual	
  page	
  load	
  times.	
  
          •  Find	
  average/individual	
  page	
  memory	
  
                  consumption.	
  
          •  Identify	
  problematic	
  pages.	
  
          •  Compare	
  time	
  wasted	
  in	
  CPU	
  vs	
  Waiting	
  
                  for	
  IO.	
  
          •  Identify	
  problematic	
  components	
  (blocks,	
  
             views,	
  components).	
  




My	
  site	
  is	
  slow	
  
Profile	
  
   Time for some research	


          Look	
  for	
  pages	
  you	
  suspect	
  
          •  Start	
  with	
  the	
  ones	
  your	
  data	
  confirms	
  	
  as	
  
                  slow.	
  
          •  Start	
  by	
  easy	
  ones	
  
              •  404	
  page	
  (the	
  fastest	
  page	
  you	
  can	
  get).	
  
              •  Node	
  view	
  page	
  
              •  Homepage	
  




My	
  site	
  is	
  slow	
  
Benchmarks	
  
          Ideally	
  your	
  normal	
  pages	
  should	
  take	
  
          •  1	
  ~	
  1.5	
  sec	
  
          •  30	
  ~	
  60	
  mb	
  of	
  memory	
  
          •  100~300	
  queries	
  per	
  page	
  
          Simpler	
  pages	
  like	
  404	
  are	
  good	
  indicators	
  of	
  
          what	
  is	
  the	
  fastest	
  all	
  other	
  pages	
  will	
  run.	
  
          Measure	
  pages	
  for	
  different	
  types	
  of	
  users,	
  
          not	
  for	
  only	
  uid	
  #1	
  without	
  access	
  checks	
  and	
  
          the	
  heavy	
  admin_menu	
  in	
  all	
  pages...	
  



My	
  site	
  is	
  slow	
  
Profiling	
  tools	
  
          Chasing	
  it	
  
          •  Use	
  Devel	
  module	
  (
                  http://drupal.org/project/devel	
  )	
  to	
  have	
  
                  a	
  fast	
  indication	
  of	
  page	
  load	
  times	
  and	
  
                  memory	
  consumption.	
  
          •  Use	
  XhProf	
  (
                  http://drupal.org/project/xhprof)	
  	
  to	
  
                  profile	
  the	
  page	
  and	
  understand	
  slower	
  
                  components.	
  
          •  Use	
  timer_start(),	
  timer_read()	
  
                  functions	
  	
  in	
  situations	
  where	
  you	
  are	
  
                  unsure.	
  

My	
  site	
  is	
  slow	
  
Typical	
  #1	
  –	
  The	
  SLOOOOW	
  Query	
  




My	
  site	
  is	
  slow	
  
Typical	
  #1	
  –	
  The	
  SLOOOOW	
  Query	
  
          •  First	
  look	
  to	
  profiling	
  data	
  shows	
  something	
  really	
  slow.	
  

                               Devel	

                                        XhProf	





       Problem 	

       •  Related to the database (Wall time vs Total Time).	

       •  Number of queries is low, so probably it’s due to some special
          queries.	

       •  Unfortunately, occurs in a specially visited page.	

       •  Unfortunately, they are not usually single.	

My	
  site	
  is	
  slow	
  
Typical	
  #1	
  –	
  The	
  single	
  SLOOOOW	
  Query	
  
          •  Not	
  indexed	
  queries,	
  views	
  query	
  with	
  a	
  lot	
  of	
  nodes,	
  	
  
    SELECT node.nid AS nid, users.picture AS users_picture, users.uid AS users_uid, users.name AS
    users_name, users.mail AS users_mail, node.title AS node_title, GREATEST(node.changed,
    node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated
    FROM node node 	

            	

INNER JOIN users users ON node.uid = users.uid 	

            	

INNER JOIN node_comment_statistics node_comment_statistics ON node.nid =
    node_comment_statistics.nid 	

       	
   	

ORDER BY node_comment_statistics_last_updated DESC	

          •  Count(*)	
  queries	
  by	
  views	
  pagers	
  with	
  a	
  lot	
  of	
  nodes	
  in	
  
                  InnoDb.	
  




My	
  site	
  is	
  slow	
  
Typical	
  #2	
  –	
  The	
  super	
  fast	
  queries	
  




My	
  site	
  is	
  slow	
  
Typical	
  #2	
  –	
  The	
  super	
  fast	
  queries	
  

                               Devel	

                    XhProf	





       Problem 	

       •        High number of queries.	

       •        High memory consumption.	

       •        High number of function calls.	

       •        All those little queries and memory consumption mean that you
                are loading lots of information from somewhere.	


My	
  site	
  is	
  slow	
  
Typical	
  #2	
  –	
  The	
  super	
  fast	
  queries	
  
      Usually 	

      •  Big Menus with lots of menu items.	

      •  Page contains elements that are slow to render (several views,
         minipanels in megamenu, nodes loaded everywhere).	

      •  Nodes/users/menus being loaded all the time:	



            Search-result.tpl.php	

            <?php 	

             $nid = $result[node]->nid;	

             $node = node_load($nid);	



My	
  site	
  is	
  slow	
  
Typical	
  #3	
  –	
  The	
  castaway	
  
     •  Edge conditions that occur in every page load	

         // we will need to mark users who saw the xmas page	

         function xmas_init() {	

               	

global $user;	

               	

$user->xmas_count++;	

               	

user_save($user);	

               	

variable_set(‘xmas_is_coming’, 1);	

         }	


         // connect to webservice to get information and show in footer homepage	

         function hook_footer() {	

               	

$webservice = new WeatherService();	

               	

$weather_c = $webservice->get('weather', 'Madrid');	

               	

if ($_GET['q'] == 'home')	

               	

 return t('%degrees degrees.', array('%degrees', $weather_c)); 	

	

         }	


My	
  site	
  is	
  slow	
  
Typical	
  #3	
  –	
  The	
  castaway	
  
     •  Edge conditions that occur in every page load	

         // we will need to mark users who saw the xmas page	

         function xmas_init() {	

               	

global $user;	

               	

$user = add_xmas_tree_to_user($user);	

               	

user_save($user);	

               	

variable_set(‘xmas_is_coming’, 1);	

         }	


         // connect to webservice to get information and show in footer homepage	

         function hook_footer() {	

               	

$webservice = new WeatherService();	

               	

$weather_c = $webservice->get('weather', 'Madrid');	

               	

if ($_GET['q'] == 'home')	

               	

 return t('%degrees degrees.', array('%degrees', $weather_c)); 	

	

         }	


My	
  site	
  is	
  slow	
  
Typical	
  #3	
  –	
  The	
  castaway	
  
     •  More common things on this topic	


            •  Blocks rendered. But not shown.	

               •  Look at admin/structure/block	


            •  Menus computed to a special task. But not used. 	


            •  Theme_rebuild and cache_clear_all in middle of
               code. Code that ends up executed in all pages.	




My	
  site	
  is	
  slow	
  
Typical	
  #4	
  –	
  The	
  missile	
  killer	
  




My	
  site	
  is	
  slow	
  
Typical	
  #4	
  –	
  The	
  missile	
  killer	
  
     •  Usually	
  a	
  task	
  executed	
  in	
  special	
  situations	
  or	
  in	
  
         certain	
  pages	
  that	
  seriously	
  slows	
  down	
  the	
  platform.	
  
        •  Synchronizations	
  of	
  thousand	
  of	
  nodes	
  from	
  web	
  
           services.	
  
        •  Synchronization	
  of	
  all	
  user	
  base	
  from	
  LDAP.	
  
        •  Sending	
  thousand	
  of	
  mails	
  via	
  Cron.	
  
        •  Even	
  worst	
  when	
  those	
  tasks	
  are	
  called	
  by	
  
           frontend	
  pages.	
  




My	
  site	
  is	
  slow	
  
Typical	
  #5	
  –	
  Killing	
  me	
  softly	
  
     •  Several	
  small	
  percentages	
  take	
  as	
  much	
  hit	
  as	
  a	
  big	
  one.	
  




            •  It’s	
  almost	
  18%	
  of	
  all	
  page	
  load	
  times	
  to	
  simply	
  render	
  
               Google	
  Analytics	
  Js.	
  
            •  Look	
  to	
  sections	
  or	
  functions	
  that	
  take	
  more	
  than	
  10%	
  of	
  
               time	
  and	
  look	
  if	
  they	
  can	
  be	
  improved.	
  



My	
  site	
  is	
  slow	
  
Solutions	
  
  After you identified the problems	


           1.  Reduce	
  complexity.	
  Make	
  sure	
  your	
  site	
  is	
  as	
  slim	
  as	
  possible.	
  
           2.  Decrease	
  not	
  only	
  average	
  rendering	
  times.	
  
           3.  Cache	
  where	
  you	
  can.	
  At	
  all	
  levels.	
  
           4.  Maintain	
  cache	
  as	
  longer	
  as	
  possible	
  until	
  it	
  is	
  acceptable.	
  
           5.  Compute	
  behind	
  the	
  scenes	
  when	
  you	
  can.	
  
           6.  Distribute	
  the	
  heavier	
  tasks	
  to	
  larger	
  intervals.	
  
           7.  Grow	
  infrastructure	
  if	
  you	
  are	
  reaching	
  server	
  limits.	
  


My	
  site	
  is	
  slow	
  
Caching	
  
          Can	
  it	
  be	
  cached?	
  Cache	
  it!	
  
           •  Page	
  caching,	
  panels	
  caching,	
  block	
  caching,	
  views	
  caching,	
  
                    entity	
  cache,	
  caching	
  API..	
  
           •  Review	
  caching	
  strategy:	
  	
  
                  •  https://www.acquia.com/blog/when-­‐and-­‐how-­‐caching-­‐can-­‐
                          save-­‐your-­‐site-­‐part-­‐2-­‐authenticated-­‐users	
  
           •  Guarantee	
  that	
  caching	
  is	
  effectively	
  helping	
  you.	
  
                  •  Don t	
  clear	
  it	
  too	
  often.	
  
                  •  Not	
  used	
  only	
  by	
  a	
  minority.	
  


My	
  site	
  is	
  slow	
  
Measuring	
  in	
  high	
  load	
  
           •  With	
  sample	
  load	
  
                  •  Locally	
  Jmeter	
  with	
  a	
  
                          list	
  of	
  urls	
  
           •  With	
  decent	
  load	
  
                  •  Blazemeter	
  
           •  Measure	
  again	
  a	
  subset	
  of	
  
                    results.	
  




My	
  site	
  is	
  slow	
  
Would	
  you	
  like	
  to	
  join	
  Acquia?	
  
We are hiring EVERYWHERE!
 •  Consultants 	

 •  Support	

 •  Sales	

 •  Engineering
Twitter.com/hernanibf	
  
          	

    QUESTIONS	
  ?	
  

Weitere ähnliche Inhalte

Was ist angesagt?

Academic Websites in Plone
Academic Websites in PloneAcademic Websites in Plone
Academic Websites in PloneJazkarta, Inc.
 
Zurb foundation
Zurb foundationZurb foundation
Zurb foundationsean_todd
 
Online exhibits in Plone
Online exhibits in PloneOnline exhibits in Plone
Online exhibits in PloneJazkarta, Inc.
 
WordPress as a CMS - Case Study of an Organizational Intranet
WordPress as a CMS - Case Study of an Organizational IntranetWordPress as a CMS - Case Study of an Organizational Intranet
WordPress as a CMS - Case Study of an Organizational IntranetTech Liminal
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeJulie Kuehl
 
Getting started with CSS frameworks using Zurb foundation
Getting started with CSS frameworks using Zurb foundationGetting started with CSS frameworks using Zurb foundation
Getting started with CSS frameworks using Zurb foundationMelanie Archer
 
Drupal - Blocks vs Context vs Panels
Drupal - Blocks vs Context vs PanelsDrupal - Blocks vs Context vs Panels
Drupal - Blocks vs Context vs PanelsDavid Burns
 
Content First – Planning Drupal Content Types
Content First – Planning Drupal Content TypesContent First – Planning Drupal Content Types
Content First – Planning Drupal Content TypesCarrie Hane
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinSuzanne Dergacheva
 
Preventing Drupal Headaches: Content Type Checklist
Preventing Drupal Headaches: Content Type ChecklistPreventing Drupal Headaches: Content Type Checklist
Preventing Drupal Headaches: Content Type ChecklistAcquia
 
Online Exhibits in Plone
Online Exhibits in PloneOnline Exhibits in Plone
Online Exhibits in PloneJazkarta, Inc.
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectIztok Smolic
 
Making Multisite Work for You
Making Multisite Work for YouMaking Multisite Work for You
Making Multisite Work for Youdrywallbmb
 
Drupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content ManagementDrupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content ManagementVibrant Technologies & Computers
 
Advanced Wordpress
Advanced WordpressAdvanced Wordpress
Advanced Wordpresslexinamer
 
Responsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationResponsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationSolTech, Inc.
 
What is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? WebinarWhat is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? WebinarSuzanne Dergacheva
 

Was ist angesagt? (20)

72d5drupal
72d5drupal72d5drupal
72d5drupal
 
Academic Websites in Plone
Academic Websites in PloneAcademic Websites in Plone
Academic Websites in Plone
 
Zurb foundation
Zurb foundationZurb foundation
Zurb foundation
 
Online exhibits in Plone
Online exhibits in PloneOnline exhibits in Plone
Online exhibits in Plone
 
WordPress as a CMS - Case Study of an Organizational Intranet
WordPress as a CMS - Case Study of an Organizational IntranetWordPress as a CMS - Case Study of an Organizational Intranet
WordPress as a CMS - Case Study of an Organizational Intranet
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress Theme
 
Getting started with CSS frameworks using Zurb foundation
Getting started with CSS frameworks using Zurb foundationGetting started with CSS frameworks using Zurb foundation
Getting started with CSS frameworks using Zurb foundation
 
Drupal - Blocks vs Context vs Panels
Drupal - Blocks vs Context vs PanelsDrupal - Blocks vs Context vs Panels
Drupal - Blocks vs Context vs Panels
 
Content First – Planning Drupal Content Types
Content First – Planning Drupal Content TypesContent First – Planning Drupal Content Types
Content First – Planning Drupal Content Types
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
 
Preventing Drupal Headaches: Content Type Checklist
Preventing Drupal Headaches: Content Type ChecklistPreventing Drupal Headaches: Content Type Checklist
Preventing Drupal Headaches: Content Type Checklist
 
Online Exhibits in Plone
Online Exhibits in PloneOnline Exhibits in Plone
Online Exhibits in Plone
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal project
 
Wordpress overview
Wordpress overviewWordpress overview
Wordpress overview
 
Drupal
DrupalDrupal
Drupal
 
Making Multisite Work for You
Making Multisite Work for YouMaking Multisite Work for You
Making Multisite Work for You
 
Drupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content ManagementDrupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content Management
 
Advanced Wordpress
Advanced WordpressAdvanced Wordpress
Advanced Wordpress
 
Responsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationResponsive Web Design using ZURB Foundation
Responsive Web Design using ZURB Foundation
 
What is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? WebinarWhat is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? Webinar
 

Ähnlich wie My Site is slow - Drupal Camp London 2013

5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Performance metrics for a social network
Performance metrics for a social networkPerformance metrics for a social network
Performance metrics for a social networkThierry Schellenbach
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilitycherryhillco
 
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...Ezra Gildesgame
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
HyperDB, MySQL Performance, & Flavors of MySQL
HyperDB, MySQL Performance, & Flavors of MySQLHyperDB, MySQL Performance, & Flavors of MySQL
HyperDB, MySQL Performance, & Flavors of MySQLEvan Volgas
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmNigel Price
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalChapter Three
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14GABeech
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsAchievers Tech
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalAndy Kucharski
 

Ähnlich wie My Site is slow - Drupal Camp London 2013 (20)

5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Performance metrics for a social network
Performance metrics for a social networkPerformance metrics for a social network
Performance metrics for a social network
 
Fashiolista
FashiolistaFashiolista
Fashiolista
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
HyperDB, MySQL Performance, & Flavors of MySQL
HyperDB, MySQL Performance, & Flavors of MySQLHyperDB, MySQL Performance, & Flavors of MySQL
HyperDB, MySQL Performance, & Flavors of MySQL
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
How_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_FarmHow_To_Soup_Up_Your_Farm
How_To_Soup_Up_Your_Farm
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
Performance stack
Performance stackPerformance stack
Performance stack
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14
 
mtl_rubykaigi
mtl_rubykaigimtl_rubykaigi
mtl_rubykaigi
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for Drupal
 

Mehr von hernanibf

Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...hernanibf
 
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018hernanibf
 
One drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp CaceresOne drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp Cacereshernanibf
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commonshernanibf
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 
Drupal + selenium
Drupal + seleniumDrupal + selenium
Drupal + seleniumhernanibf
 
Drupal Recipe
Drupal RecipeDrupal Recipe
Drupal Recipehernanibf
 

Mehr von hernanibf (8)

Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...
 
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
 
One drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp CaceresOne drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp Caceres
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commons
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 
Drupal + selenium
Drupal + seleniumDrupal + selenium
Drupal + selenium
 
Drupal Recipe
Drupal RecipeDrupal Recipe
Drupal Recipe
 

Kürzlich hochgeladen

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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
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
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Kürzlich hochgeladen (20)

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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
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
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
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?
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

My Site is slow - Drupal Camp London 2013

  • 1. My  site  is  slow   Hernâni  Borges  de  Freitas   Technical  Consultant   hernani@acquia.com   @hernanibf       London,  2nd  March,  2013  
  • 2. About  me   •  .PT     •  Acquia  Professional  Services   EMEA   •  Technical  Consultant   •  Drupal*  many  things   •  Travel  lover   •  Twitter.com/hernanibf   My  site  is  slow  
  • 3. What  does  my  team  do  ?   •  Drupal  Jumpstarts   •  Architecture  Workshops   •  Discovery  workshops   •  Site  Audits   •  Performance  Assessment   •  Security  Audits   •  On-­‐site  Consulting   My  site  is  slow  
  • 4. This  talk   is  mostly  about   is  not  much  about   •  Understanding  your  site   •  Increasing  performance   •  Your  limits   by  changing   •  Your  benchmarks   •  Infrastructure   •  Your  problems   •  Caching  Strategies   •  Make  it  faster  with  same   resources.   My  site  is  slow  
  • 5. This is how it starts My site is slow. My  site  is  slow  
  • 6. This is what usually follows. We already added We are thinking about 5 more adding more mysql webservers... slaves… We added nginx, We need more changed MySql granularity in slow version, added query logs. memcache... We are sure the We tried to patch problem is in boost module to PHP Version. serve our needs. My  site  is  slow  
  • 7. But sometimes it’s even worst. “We need to rebuild this site from We need to cache the scratch”. whole site. We will export the We can’t handle this site to pure HTML traffic with Drupal . and ditch the CMS. My  site  is  slow  
  • 8. What  you  mean?  “It’s  slow”?   •  Backend  slowness   •  Services  that  website  use  are  slow  or   unresponsive  (dbs)   •  Application  too  complex   •  Server  resources  overload   •  Frontend  slowness   •  Too  many  /  large  assets   •  Slow  connection  between  browser  and   server.   •  JS  slowing  the  DOM  (re)rendering     My  site  is  slow  
  • 9. Science   Base your work in what you can prove •  Find  good  data  that  you  can  use   to  measure.   •  Find  good  profiling  data  you   can  use  to  analyze.   •  Implement  improvements  for   the  problems  found.   •  Measure  again.   My  site  is  slow  
  • 10. Data  about  your  site   Understanding  how  much  time  are  you  taking  per  page   You  need  data  to  understand  your  current   situation  and  compare  after  your  changes.   •  Apache  logs  with  rendering  times     LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined [31/Jan/2008:14:19:07 +0000] "GET / HTTP/1.1" 200 7918 ”" 0/95491 •  Accesslog  from  statistics  table   Aid Title Path Ip Uid Timer Timestamp 23557145 Directory node/465 10.156.11.248 2632 7262806 1346855808 23557361 home 10.156.11.248 9263 6967768 1346856897 23557399 home 10.156.11.248 7904 6690128 1346856985 23557081 Search search/node/how2=register=lovefilm 8058 10.156.11.248 6509745 1346855538 My  site  is  slow  
  • 11. NewRelic.com   Extra insight about how are you doing My  site  is  slow  
  • 12. Google  Analytics  site  speed   Be sure you know how fast you are delivering front end My  site  is  slow  
  • 13. Analyze  on  a  deeper  level   Generate  your  own  data •  XhProf   •  XhProfCli   Aggregates  data  from  XhProf  profiling  data  from  a   set  of  pages.   https://github.com/msonnabaum/XHProfCLI       My  site  is  slow  
  • 14. What  you  need  to  find   Before you do anything else •  Find  average/individual  page  load  times.   •  Find  average/individual  page  memory   consumption.   •  Identify  problematic  pages.   •  Compare  time  wasted  in  CPU  vs  Waiting   for  IO.   •  Identify  problematic  components  (blocks,   views,  components).   My  site  is  slow  
  • 15. Profile   Time for some research Look  for  pages  you  suspect   •  Start  with  the  ones  your  data  confirms    as   slow.   •  Start  by  easy  ones   •  404  page  (the  fastest  page  you  can  get).   •  Node  view  page   •  Homepage   My  site  is  slow  
  • 16. Benchmarks   Ideally  your  normal  pages  should  take   •  1  ~  1.5  sec   •  30  ~  60  mb  of  memory   •  100~300  queries  per  page   Simpler  pages  like  404  are  good  indicators  of   what  is  the  fastest  all  other  pages  will  run.   Measure  pages  for  different  types  of  users,   not  for  only  uid  #1  without  access  checks  and   the  heavy  admin_menu  in  all  pages...   My  site  is  slow  
  • 17. Profiling  tools   Chasing  it   •  Use  Devel  module  ( http://drupal.org/project/devel  )  to  have   a  fast  indication  of  page  load  times  and   memory  consumption.   •  Use  XhProf  ( http://drupal.org/project/xhprof)    to   profile  the  page  and  understand  slower   components.   •  Use  timer_start(),  timer_read()   functions    in  situations  where  you  are   unsure.   My  site  is  slow  
  • 18. Typical  #1  –  The  SLOOOOW  Query   My  site  is  slow  
  • 19. Typical  #1  –  The  SLOOOOW  Query   •  First  look  to  profiling  data  shows  something  really  slow.   Devel XhProf Problem •  Related to the database (Wall time vs Total Time). •  Number of queries is low, so probably it’s due to some special queries. •  Unfortunately, occurs in a specially visited page. •  Unfortunately, they are not usually single. My  site  is  slow  
  • 20. Typical  #1  –  The  single  SLOOOOW  Query   •  Not  indexed  queries,  views  query  with  a  lot  of  nodes,     SELECT node.nid AS nid, users.picture AS users_picture, users.uid AS users_uid, users.name AS users_name, users.mail AS users_mail, node.title AS node_title, GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated FROM node node INNER JOIN users users ON node.uid = users.uid INNER JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid   ORDER BY node_comment_statistics_last_updated DESC •  Count(*)  queries  by  views  pagers  with  a  lot  of  nodes  in   InnoDb.   My  site  is  slow  
  • 21. Typical  #2  –  The  super  fast  queries   My  site  is  slow  
  • 22. Typical  #2  –  The  super  fast  queries   Devel XhProf Problem •  High number of queries. •  High memory consumption. •  High number of function calls. •  All those little queries and memory consumption mean that you are loading lots of information from somewhere. My  site  is  slow  
  • 23. Typical  #2  –  The  super  fast  queries   Usually •  Big Menus with lots of menu items. •  Page contains elements that are slow to render (several views, minipanels in megamenu, nodes loaded everywhere). •  Nodes/users/menus being loaded all the time: Search-result.tpl.php <?php $nid = $result[node]->nid; $node = node_load($nid); My  site  is  slow  
  • 24. Typical  #3  –  The  castaway   •  Edge conditions that occur in every page load // we will need to mark users who saw the xmas page function xmas_init() { global $user; $user->xmas_count++; user_save($user); variable_set(‘xmas_is_coming’, 1); } // connect to webservice to get information and show in footer homepage function hook_footer() { $webservice = new WeatherService(); $weather_c = $webservice->get('weather', 'Madrid'); if ($_GET['q'] == 'home') return t('%degrees degrees.', array('%degrees', $weather_c)); } My  site  is  slow  
  • 25. Typical  #3  –  The  castaway   •  Edge conditions that occur in every page load // we will need to mark users who saw the xmas page function xmas_init() { global $user; $user = add_xmas_tree_to_user($user); user_save($user); variable_set(‘xmas_is_coming’, 1); } // connect to webservice to get information and show in footer homepage function hook_footer() { $webservice = new WeatherService(); $weather_c = $webservice->get('weather', 'Madrid'); if ($_GET['q'] == 'home') return t('%degrees degrees.', array('%degrees', $weather_c)); } My  site  is  slow  
  • 26. Typical  #3  –  The  castaway   •  More common things on this topic •  Blocks rendered. But not shown. •  Look at admin/structure/block •  Menus computed to a special task. But not used. •  Theme_rebuild and cache_clear_all in middle of code. Code that ends up executed in all pages. My  site  is  slow  
  • 27. Typical  #4  –  The  missile  killer   My  site  is  slow  
  • 28. Typical  #4  –  The  missile  killer   •  Usually  a  task  executed  in  special  situations  or  in   certain  pages  that  seriously  slows  down  the  platform.   •  Synchronizations  of  thousand  of  nodes  from  web   services.   •  Synchronization  of  all  user  base  from  LDAP.   •  Sending  thousand  of  mails  via  Cron.   •  Even  worst  when  those  tasks  are  called  by   frontend  pages.   My  site  is  slow  
  • 29. Typical  #5  –  Killing  me  softly   •  Several  small  percentages  take  as  much  hit  as  a  big  one.   •  It’s  almost  18%  of  all  page  load  times  to  simply  render   Google  Analytics  Js.   •  Look  to  sections  or  functions  that  take  more  than  10%  of   time  and  look  if  they  can  be  improved.   My  site  is  slow  
  • 30. Solutions   After you identified the problems 1.  Reduce  complexity.  Make  sure  your  site  is  as  slim  as  possible.   2.  Decrease  not  only  average  rendering  times.   3.  Cache  where  you  can.  At  all  levels.   4.  Maintain  cache  as  longer  as  possible  until  it  is  acceptable.   5.  Compute  behind  the  scenes  when  you  can.   6.  Distribute  the  heavier  tasks  to  larger  intervals.   7.  Grow  infrastructure  if  you  are  reaching  server  limits.   My  site  is  slow  
  • 31. Caching   Can  it  be  cached?  Cache  it!   •  Page  caching,  panels  caching,  block  caching,  views  caching,   entity  cache,  caching  API..   •  Review  caching  strategy:     •  https://www.acquia.com/blog/when-­‐and-­‐how-­‐caching-­‐can-­‐ save-­‐your-­‐site-­‐part-­‐2-­‐authenticated-­‐users   •  Guarantee  that  caching  is  effectively  helping  you.   •  Don t  clear  it  too  often.   •  Not  used  only  by  a  minority.   My  site  is  slow  
  • 32. Measuring  in  high  load   •  With  sample  load   •  Locally  Jmeter  with  a   list  of  urls   •  With  decent  load   •  Blazemeter   •  Measure  again  a  subset  of   results.   My  site  is  slow  
  • 33. Would  you  like  to  join  Acquia?   We are hiring EVERYWHERE! •  Consultants •  Support •  Sales •  Engineering
  • 34. Twitter.com/hernanibf   QUESTIONS  ?