COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE1
22.	
  September	
  2015	
  
Harald	
  Zeitlhofer,	
  Dynatrace	
  	
  
harald.zeitlhofer@dynatrace.com	
  
@HZeitlhofer	
  
Improve	
  Magento	
  Performance	
  
To	
  Drive	
  Higher	
  Conversions	
  
	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE2
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE3
• Major	
  problem	
  in	
  November	
  2014	
  
• Magento	
  Shop	
  was	
  actually	
  too	
  slow!	
  
• Infrastructure	
  was	
  very	
  limited	
  at	
  that	
  
Lme	
  
• Scale	
  Infrastructure	
  ?	
  
• Get	
  external	
  advice	
  
• The	
  real	
  problems	
  were	
  hidden	
  that	
  Lme	
  
Performance	
  threatens	
  goals	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE4
lessc	
  CSS	
  pre-­‐
processor	
  
social	
  login	
  
module	
  
PHP	
  execuLon	
  
was	
  really	
  
slow	
  
during	
  the	
  first	
  analysis	
  session	
  we	
  iden2fied	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE5
average contribution of
PHP compilation time
Slow	
  PHP	
  execuLon	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE6
PHP compilation time could
be reduced considerably just
by using PHP 5.5 + Opcache!
ARer	
  update	
  to	
  PHP	
  5.5	
  
use	
  latest	
  versions	
  
of	
  used	
  technology	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE8
PHP execution presented
a major global bottleneck
for page load times
Performance	
  hotspot:	
  PHP	
  execuLon	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE9
less	
  CSS	
  preprocessor	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE10
less	
  CSS	
  preprocessor	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE11
errors	
  in	
  PHP	
  execuLon	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE12
server-side calls to
unused external services
Social	
  Login	
  Modul	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE13
Using	
  external	
  services	
  
performance	
  hotspot	
  
/en/externalprice/	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE14
response	
  Lme	
  	
  
hotspot	
  PHP	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE15
slow	
  SAP	
  connector	
  ?	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE16
session	
  data	
  locking	
  
response	
  Lme	
  hotspot:	
  
usleep();	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE17
• CM_RedisSession	
  uses	
  usleep()	
  in	
  locking	
  logic	
  
• session_start()	
  locks	
  session	
  file	
  
• only	
  lock	
  if	
  required	
  
• session_write_close()	
  releases	
  lock	
  
PHP	
  session	
  locking	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE18
• New	
  feature:	
  show	
  stock	
  and	
  leadLmes	
  
• Calculated	
  on-­‐the-­‐fly	
  
• Very	
  bad	
  performance	
  impact	
  
Inhouse	
  development	
  
• Design	
  change:	
  pre	
  calculate	
  and	
  cache	
  
• Workflow	
  change:	
  test	
  automaLon	
  including	
  
performance	
  tests	
  
know	
  your	
  code	
  
	
  
know	
  your	
  external	
  libraries	
  
	
  
evaluate	
  carefully	
  before	
  using	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE20
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE21
Modern	
  Web	
  Pages:	
  lots	
  of	
  staLc	
  content	
  
434	
  Resources	
  in	
  total	
  on	
  that	
  page:	
  
230	
  JPEGs,	
  75	
  PNGs,	
  50	
  GIFs,	
  …	
  
more	
  than	
  20MB	
  page	
  size	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE22
Not	
  following	
  Web	
  Performance	
  Best	
  PracLces	
   282!	
  Objects	
  
on	
  that	
  page	
  9.68MB	
  Page	
  Size	
  
8.8s	
  Page	
  Load	
  
Time	
  
Most	
  objects	
  are	
  images	
  
delivered	
  from	
  the	
  	
  
main	
  domain	
  
Very	
  long	
  connect	
  Lme	
  
(1.8s)	
  to	
  the	
  CDN	
  
use	
  proper	
  caching	
  
	
  
pack	
  JS,	
  CSS	
  
	
  
use	
  sprite	
  for	
  images	
  
	
  
use	
  CDNs	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE24
cached	
  content	
  
sLll	
  creates	
  roundtrips	
  !	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE25
Original	
  Web	
  Request	
  handling	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE26
New	
  Web	
  Request	
  handling	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE27
more information:
http://apmblog.dynatrace.com/2014/10/30/proper-configuration-running-php-nginx/
http://www.slideshare.net/HaraldZeitlhofer/php-conference-berlin-2015-running-php-on-nginx
NGINX	
  
use	
  proper	
  server	
  tools	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE29
Status	
  Quo	
  
• Infrastructure	
  has	
  changed	
  significantly	
  
• New	
  design	
  and	
  review	
  process	
  
• Test	
  automaLon	
  with	
  	
  
performance	
  tests	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE30
CharLng	
  data	
  in	
  	
  
business	
  dashboards	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE31
PosiLve	
  impact	
  on	
  conversion	
  rate	
  
COMPANY CONFIDENTIAL – DO NOT DISTRIBUTE32
www.dynatrace.com	
  
Thank you !!!
Harald	
  Zeitlhofer	
  
Performance	
  Advocate	
  
#HZeitlhofer	
  
harald.zeitlhofer@dynatrace.com	
  
hmp://blog.dyntrace.com	
  
Dynatrace	
  Free	
  Trial:	
  	
  
hmp://bit.ly/dmrial	
  

Improve Magento Performance

  • 1.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE1 22.  September  2015   Harald  Zeitlhofer,  Dynatrace     harald.zeitlhofer@dynatrace.com   @HZeitlhofer   Improve  Magento  Performance   To  Drive  Higher  Conversions    
  • 2.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE2
  • 3.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE3 • Major  problem  in  November  2014   • Magento  Shop  was  actually  too  slow!   • Infrastructure  was  very  limited  at  that   Lme   • Scale  Infrastructure  ?   • Get  external  advice   • The  real  problems  were  hidden  that  Lme   Performance  threatens  goals  
  • 4.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE4 lessc  CSS  pre-­‐ processor   social  login   module   PHP  execuLon   was  really   slow   during  the  first  analysis  session  we  iden2fied  
  • 5.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE5 average contribution of PHP compilation time Slow  PHP  execuLon  
  • 6.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE6 PHP compilation time could be reduced considerably just by using PHP 5.5 + Opcache! ARer  update  to  PHP  5.5  
  • 7.
    use  latest  versions   of  used  technology  
  • 8.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE8 PHP execution presented a major global bottleneck for page load times Performance  hotspot:  PHP  execuLon  
  • 9.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE9 less  CSS  preprocessor  
  • 10.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE10 less  CSS  preprocessor  
  • 11.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE11 errors  in  PHP  execuLon  
  • 12.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE12 server-side calls to unused external services Social  Login  Modul  
  • 13.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE13 Using  external  services   performance  hotspot   /en/externalprice/  
  • 14.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE14 response  Lme     hotspot  PHP  
  • 15.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE15 slow  SAP  connector  ?  
  • 16.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE16 session  data  locking   response  Lme  hotspot:   usleep();  
  • 17.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE17 • CM_RedisSession  uses  usleep()  in  locking  logic   • session_start()  locks  session  file   • only  lock  if  required   • session_write_close()  releases  lock   PHP  session  locking  
  • 18.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE18 • New  feature:  show  stock  and  leadLmes   • Calculated  on-­‐the-­‐fly   • Very  bad  performance  impact   Inhouse  development   • Design  change:  pre  calculate  and  cache   • Workflow  change:  test  automaLon  including   performance  tests  
  • 19.
    know  your  code     know  your  external  libraries     evaluate  carefully  before  using  
  • 20.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE20
  • 21.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE21 Modern  Web  Pages:  lots  of  staLc  content   434  Resources  in  total  on  that  page:   230  JPEGs,  75  PNGs,  50  GIFs,  …   more  than  20MB  page  size  
  • 22.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE22 Not  following  Web  Performance  Best  PracLces   282!  Objects   on  that  page  9.68MB  Page  Size   8.8s  Page  Load   Time   Most  objects  are  images   delivered  from  the     main  domain   Very  long  connect  Lme   (1.8s)  to  the  CDN  
  • 23.
    use  proper  caching     pack  JS,  CSS     use  sprite  for  images     use  CDNs  
  • 24.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE24 cached  content   sLll  creates  roundtrips  !  
  • 25.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE25 Original  Web  Request  handling  
  • 26.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE26 New  Web  Request  handling  
  • 27.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE27 more information: http://apmblog.dynatrace.com/2014/10/30/proper-configuration-running-php-nginx/ http://www.slideshare.net/HaraldZeitlhofer/php-conference-berlin-2015-running-php-on-nginx NGINX  
  • 28.
  • 29.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE29 Status  Quo   • Infrastructure  has  changed  significantly   • New  design  and  review  process   • Test  automaLon  with     performance  tests  
  • 30.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE30 CharLng  data  in     business  dashboards  
  • 31.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE31 PosiLve  impact  on  conversion  rate  
  • 32.
    COMPANY CONFIDENTIAL –DO NOT DISTRIBUTE32 www.dynatrace.com   Thank you !!! Harald  Zeitlhofer   Performance  Advocate   #HZeitlhofer   harald.zeitlhofer@dynatrace.com   hmp://blog.dyntrace.com   Dynatrace  Free  Trial:     hmp://bit.ly/dmrial