HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf ·...

40
High Performance for Small Sites John Bickar, Stanford Web Services 1

Transcript of HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf ·...

Page 1: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

High  Performance  for  Small  Sites    John  Bickar,  Stanford  Web  Services  

1

Page 2: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Small  VPS  

What  is  a  “small  site?”  

Shared  hos=ng  

Limited/no  access  to  Linux/Apache  layer  

Cannot  install  Varnish,  memcache,  etc.  

Page 3: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

What  is  a  “small  site?”  

If  you  run:    $ sudo apt-get install varnish  And  it  returns,  “user  not  sufficiently  super,”  you  might  have  a  small  site.  

Page 4: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

YOUR  SLOW  DRUPAL  SITE  

Page 5: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 6: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 7: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 8: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

What you want.

Page 9: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 10: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

What you can make your users think you have.

Page 11: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

What you’re still not going to get.

Page 12: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

The  Crea=on  of  a  Slow  Drupal  Site  

A  play  in  four  acts  

Page 13: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

ACT  I:  INCEPTION  

Page 14: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

“We  need  a  Drupal!”  

Page 15: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

ACT  II:  CREATION  

Page 16: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Work,  work,  work  

Page 17: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

ACT  III:  EXPANSION  

Page 18: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

“That’s  great!”  

“Can  we  add…”  

Events  

Contact  form  

Restricted  content  

Room  reserva=ons   Seventeen  more  roles  Publishing  workflow   Ten  more  content  types  

Slap  Chop  

George  Foreman  grill  

Custom  breadcrumbs  

Custom  .tpl.php  

Custom  web  app  

Mobile  device  detec=on  

Field-­‐level  permissions  GI  Joe  with  the  kung-­‐fu  grip  

Discussion  forums  

Page 19: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

ACT  IV:  DECELERATION  

Page 20: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 21: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   21

Ini=al  Assessment  

Hos=ng  Op=ons  

Traffic  

Resources  

Priori=es  

Page 22: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   22

Assessing  Performance  Bo^lenecks  

When?  

Where?  

What?  

Who?  

Why?  

Page 23: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   23

General  Tips  

Delete  unnecessary  modules  

Disable  unnecessary  modules  

Page 24: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 25: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 26: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 27: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   27

General  Tips  

Use  them  

Drupal  core  performance  se`ngs  

admin/se`ngs/performance  (D6)  

admin/config/development/performance  (D7)  

Page 28: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   28

Tes=ng  Tools  

YSlow  

Inspector  in  Chrome,  Safari  

ApacheBench  

Page 29: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   29

Advanced  Performance  -­‐  Caching  

Cache  Rules  Everything  Around  Me  

Cache  gets  stale  

Page 30: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   30

Advanced  Performance  -­‐  Caching  

cron  

32 * * * * curl -sS http://www.example.com/foo > \/dev/null

Page 31: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   31

Advanced  Performance  -­‐  Caching  

Views  caching  

Panels  caching  

Boost  

AuthCache  

Page 32: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Prove  it  techcommons.stanford.edu  

Homepage  load  =me  with  uncached  View:  

9.7  seconds  

Page 33: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Prove  it  techcommons.stanford.edu  

Homepage  load  =me  ager  enabling  Views  caching:  

2.8  seconds  

Page 34: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Prove  it  techcommons.stanford.edu  

Homepage  load  =me  ager  enabling  Boost  caching:  

117  milliseconds  

Page 35: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   35

Advanced  Performance  -­‐  Debugging  

Devel  

Page 36: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 37: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 38: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“
Page 39: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

May  5th,  2012   39

Summary  

Know  thy  users  

   

Keep  Calm  And  

DRUPAL  ON  Know  thy  content  

Know  thy  traffic  

Page 40: HighPerformanceforSmallSitesweb.stanford.edu/.../HighPerformanceforSmallSites.pdf · Whatis%a“small%site?”% If%you%run:% % $ sudo apt-get install varnish % And%itreturns,%“

Appendix  

Linkies:  •  h^p://techcommons.stanford.edu/topics/web-­‐development/benchmarking-­‐site-­‐performance-­‐apachebench  

•  h^p://techcommons.stanford.edu/topics/drupal/boost    

•  h^p://techcommons.stanford.edu/topics/drupal/improving-­‐drupal-­‐performance-­‐and-­‐speed-­‐leland-­‐servers