SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
“More pageviews coming up?
       Improve page loading speed?
            Add more boxes!”
                           - Anonymous developer


Thursday, January 17, 13
Let’s speed it up a bit
                             13 performance optimizing strategies[*]




                                 Pascal de Vink (@pascaldevink)


Thursday, January 17, 13
About me




Thursday, January 17, 13
Why does it matter?




Thursday, January 17, 13
So, it hurts...




Thursday, January 17, 13
So, it hurts...

                     • Your users




Thursday, January 17, 13
So, it hurts...

                     • Your users
                     • Your search ranking
                                         [1]




Thursday, January 17, 13
So, it hurts...

                     • Your users
                     • Your search ranking
                                         [1]


                     • Your profit[2]




Thursday, January 17, 13
Measure it


                     • Request/second benchmarking with AB or
                           jmeter
                     •     Page load speed with WebPageTest[3]




Thursday, January 17, 13
#1 HTTP cache
                              headers
                “If the content of the script changes only depending
                on what’s in the URL, it is cacheable; if the output
                depends on a cookie, authentication information or
                other external criteria, it probably isn’t”[4]
                                                   - Mark Nottingham




Thursday, January 17, 13
#1 HTTP cache
                                   headers
                     • Add:Cache-Control: public max-age=[seconds]
                           Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT



                     • But, be aware of its use, eg with
                           authentication pages




Thursday, January 17, 13
#2 Minification
                • Place javascript at the bottom of the html

                •     Place CSS at the top of the html

                • Use Minify JavaScript & CSS

                • Always write JavaScript & CSS in external file

                • Try to reduce number of JavaScript & CSS files



                • Assetic[5] can help you use tools
Thursday, January 17, 13
#3 GZIP compression
 <IfModule mod_deflate.c>
   SetOutputFilter DEFLATE
   # Don’t compress
   SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
   SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip
 dont-vary
   #Dealing with proxy servers
   <IfModule mod_headers.c>
     Header append Vary User-Agent
   </IfModule>
 </IfModule>




Thursday, January 17, 13
#4 CDN

                     • Content Delivery Network
                     • Used for streaming video
                     • Based on the browser limit of 2 requests
                           (not applicable anymore)




Thursday, January 17, 13
#4 CDN




Thursday, January 17, 13
#4 CDN

                     • CloudFlare is a free
                                         CDN[6]


                     • Amazon CloudFront is cheap [7]


                     • Amazon S3 works too [8]


                     • Roll your own

Thursday, January 17, 13
#5 Static site generation


                • Generate page(s) only if changed

                • Hype: blogging on dropbox/github pages[9]




Thursday, January 17, 13
#6 Tune apache


                • KeepAlive, KeepAliveTimeout, StartServers,
                  MaxClients[10]




Thursday, January 17, 13
#6b Get rid of apache




Thursday, January 17, 13
#7 Opcode caching
                     •     Pre-compiling PHP in memory[10]
                     • APC, eAccelerator, Zend server




Thursday, January 17, 13
#8 Varnish

                     • Load balancing
                     • Serving assets
                     • Maintenance mode


Thursday, January 17, 13
#9 Memcached
                           • In-memory object caching   system[11]




Thursday, January 17, 13
#10 Improve your SQL

                     • Use lazy-loading
                     • Tune MySQL  [12]


                     • Use NoSQL


Thursday, January 17, 13
#11 Load it off the request
                     • Message queues (ActiveMQ, RabbitMQ)
                     • Load off :
                       • Mails (notifications)
                       • Background changes (change of product 1
                             changes product 2)
                           • Logging (non vital)
                           • Cache updates
Thursday, January 17, 13
#12 Improve your file
                             handling
                • Reduce your include_path to a single entry or don't
                  use it at all

                • Include or require absolute paths

                • Ensure that each try to include a file is a hit

                • Avoid file_exists(), is_file(), is_dir(), is_link() etc.

                • Avoid autoloading[13]


Thursday, January 17, 13
#13 Use output buffering


                     • Specially for huge pages
                     • StreamedResponse in Symfony 2.1


Thursday, January 17, 13
Bonus #14 Use Google
                          SPDY
                     • Prioritizing & multiplexing
                     • Encryption & compression baked in
                     • Hint/push content
                     • Chromium, Firefox & Opera only

Thursday, January 17, 13
Bonus #15 Use
                            WebSockets

                     • Faster then AJAX request
                     • Great for instant client communication


Thursday, January 17, 13
In conclusion
   •       #1 HTTP Cache Headers       •   #10 Improve your SQL
   •       #2 GZIP Compression         •   #11 Load it off the request
   •       #3 Minification
                                       •   #12 Improve file handling
   •       #4 CDN
                                       •   #13 Use output buffering
   •       #5 Static site generation
                                       •   Bonus #14 Use Google
   •       #6 Tune or ditch Apache         SPDY
   •       #7 Opcode caching
                                       •   Bonus #15 Use
   •       #8 Varnish                      websockets

   •       #9 Memcached
Thursday, January 17, 13
One more thing




Thursday, January 17, 13
One more thing




Thursday, January 17, 13
One more thing




Thursday, January 17, 13
Questions?

                           https://joind.in/talk/view/8066

                           @pascaldevink



Thursday, January 17, 13
References
     •       infographics: http://mashable.com/2012/11/22/slow-websites/
     •       varnish: http://deglos.com/blog/2010/09/22/drupal-and-varnish-quick-intro
     •       Webservers performance http://www.rootusers.com/web-server-performance-benchmark/
     •       [1] http://copperegg.com/slow-websites-hurt-search-engine-rankings/
     •       [2] http://econsultancy.com/nl/blog/11274-67-of-consumers-cite-slow-websites-as-the-main-cause-of-basket-abandonment
     •       [3] http://www.webpagetest.org
     •       [4] http://www.mnot.net/cache_docs/
     •       [5] http://symfony.com/doc/2.0/cookbook/assetic/asset_management.html
     •       [6] http://www.cloudflare.com/
     •       [7] http://aws.amazon.com/cloudfront/
     •       [8] http://aws.amazon.com/s3/
     •       [9] http://octopress.org/
     •       [10] http://www.bootstrappingindependence.com/technology/how-to-improve-website-performance-with-drupal-php-mysql-and-apache/
     •       [11] http://memcached.org/
     •       [12] http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation




Thursday, January 17, 13

Weitere ähnliche Inhalte

Was ist angesagt?

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Atwix
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
Thomas Weinert
 
From Tomcat to Java EE, making the transition with TomEE
From Tomcat to Java EE, making the transition with TomEEFrom Tomcat to Java EE, making the transition with TomEE
From Tomcat to Java EE, making the transition with TomEE
jaxconf
 

Was ist angesagt? (13)

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 
On the Move, Website Migrations Debunked
On the Move, Website Migrations DebunkedOn the Move, Website Migrations Debunked
On the Move, Website Migrations Debunked
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutions
 
Konsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman webKonsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman web
 
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
 
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on TomcatApache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
 
Tigahost
TigahostTigahost
Tigahost
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
From Tomcat to Java EE, making the transition with TomEE
From Tomcat to Java EE, making the transition with TomEEFrom Tomcat to Java EE, making the transition with TomEE
From Tomcat to Java EE, making the transition with TomEE
 
Setting up a local WordPress development environment
Setting up a local WordPress development environmentSetting up a local WordPress development environment
Setting up a local WordPress development environment
 
Automate IBM Connections Installations and more
Automate IBM Connections Installations and moreAutomate IBM Connections Installations and more
Automate IBM Connections Installations and more
 

Andere mochten auch

Learning How To Code
Learning How To CodeLearning How To Code
Learning How To Code
CoachPineda
 
Reading eggs @ jma
Reading eggs @ jmaReading eggs @ jma
Reading eggs @ jma
CoachPineda
 

Andere mochten auch (19)

My accidental education
My accidental educationMy accidental education
My accidental education
 
75176
7517675176
75176
 
700-3
700-3700-3
700-3
 
Doc32059
Doc32059Doc32059
Doc32059
 
Tl wn781 guia de uso
Tl wn781 guia de usoTl wn781 guia de uso
Tl wn781 guia de uso
 
Muñoz laguna javier_in2_global_iii
Muñoz laguna javier_in2_global_iiiMuñoz laguna javier_in2_global_iii
Muñoz laguna javier_in2_global_iii
 
32059 sistem
32059 sistem32059 sistem
32059 sistem
 
Html 1
Html 1Html 1
Html 1
 
Xmega d4 microcontroller
Xmega d4 microcontrollerXmega d4 microcontroller
Xmega d4 microcontroller
 
data of crime or crime of data?
data of crime or crime of data?data of crime or crime of data?
data of crime or crime of data?
 
700-1
700-1700-1
700-1
 
Session 34 Joel Hansson
Session 34 Joel HanssonSession 34 Joel Hansson
Session 34 Joel Hansson
 
Learning How To Code
Learning How To CodeLearning How To Code
Learning How To Code
 
Doc7745
Doc7745Doc7745
Doc7745
 
060213 katerina
060213 katerina060213 katerina
060213 katerina
 
700-4
700-4700-4
700-4
 
Reading eggs @ jma
Reading eggs @ jmaReading eggs @ jma
Reading eggs @ jma
 
Events in Gwinnett County
Events in Gwinnett CountyEvents in Gwinnett County
Events in Gwinnett County
 
Google Authorship - A Brief Introduction by Kate Dreyer
Google Authorship - A Brief Introduction by Kate DreyerGoogle Authorship - A Brief Introduction by Kate Dreyer
Google Authorship - A Brief Introduction by Kate Dreyer
 

Ähnlich wie Let's speed it up a bit (AmsterdamPHP)

eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
PatrickCrompton
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalability
Jason Ragsdale
 
7 Habits of Exceptional Performance
7 Habits of Exceptional Performance7 Habits of Exceptional Performance
7 Habits of Exceptional Performance
Nicole Sullivan
 
Proud to be polyglot!
Proud to be polyglot!Proud to be polyglot!
Proud to be polyglot!
NLJUG
 
20130714 php matsuri - highly available php
20130714   php matsuri - highly available php20130714   php matsuri - highly available php
20130714 php matsuri - highly available php
Graham Weldon
 

Ähnlich wie Let's speed it up a bit (AmsterdamPHP) (20)

Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer Toolbox
 
Optimize drupal
Optimize drupalOptimize drupal
Optimize drupal
 
AppEngine Performance Tuning
AppEngine Performance TuningAppEngine Performance Tuning
AppEngine Performance Tuning
 
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
JSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web Design
 
What is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress HostingWhat is Nginx and Why You Should to Use it with Wordpress Hosting
What is Nginx and Why You Should to Use it with Wordpress Hosting
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump Start
 
Static resource-optimization using webutilities
Static resource-optimization using webutilitiesStatic resource-optimization using webutilities
Static resource-optimization using webutilities
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
 
Digibury: SciVisum - Making your website fast - and scalable
Digibury: SciVisum - Making your website fast - and scalableDigibury: SciVisum - Making your website fast - and scalable
Digibury: SciVisum - Making your website fast - and scalable
 
My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalability
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
 
7 Habits of Exceptional Performance
7 Habits of Exceptional Performance7 Habits of Exceptional Performance
7 Habits of Exceptional Performance
 
Proud to be polyglot!
Proud to be polyglot!Proud to be polyglot!
Proud to be polyglot!
 
20130714 php matsuri - highly available php
20130714   php matsuri - highly available php20130714   php matsuri - highly available php
20130714 php matsuri - highly available php
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Groovy & Grails eXchange 2012 - Building an e-commerce business with gr8 tec...
Groovy & Grails eXchange 2012 - Building an  e-commerce business with gr8 tec...Groovy & Grails eXchange 2012 - Building an  e-commerce business with gr8 tec...
Groovy & Grails eXchange 2012 - Building an e-commerce business with gr8 tec...
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Let's speed it up a bit (AmsterdamPHP)

  • 1. “More pageviews coming up? Improve page loading speed? Add more boxes!” - Anonymous developer Thursday, January 17, 13
  • 2. Let’s speed it up a bit 13 performance optimizing strategies[*] Pascal de Vink (@pascaldevink) Thursday, January 17, 13
  • 4. Why does it matter? Thursday, January 17, 13
  • 5. So, it hurts... Thursday, January 17, 13
  • 6. So, it hurts... • Your users Thursday, January 17, 13
  • 7. So, it hurts... • Your users • Your search ranking [1] Thursday, January 17, 13
  • 8. So, it hurts... • Your users • Your search ranking [1] • Your profit[2] Thursday, January 17, 13
  • 9. Measure it • Request/second benchmarking with AB or jmeter • Page load speed with WebPageTest[3] Thursday, January 17, 13
  • 10. #1 HTTP cache headers “If the content of the script changes only depending on what’s in the URL, it is cacheable; if the output depends on a cookie, authentication information or other external criteria, it probably isn’t”[4] - Mark Nottingham Thursday, January 17, 13
  • 11. #1 HTTP cache headers • Add:Cache-Control: public max-age=[seconds] Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT • But, be aware of its use, eg with authentication pages Thursday, January 17, 13
  • 12. #2 Minification • Place javascript at the bottom of the html • Place CSS at the top of the html • Use Minify JavaScript & CSS • Always write JavaScript & CSS in external file • Try to reduce number of JavaScript & CSS files • Assetic[5] can help you use tools Thursday, January 17, 13
  • 13. #3 GZIP compression <IfModule mod_deflate.c> SetOutputFilter DEFLATE # Don’t compress SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary #Dealing with proxy servers <IfModule mod_headers.c> Header append Vary User-Agent </IfModule> </IfModule> Thursday, January 17, 13
  • 14. #4 CDN • Content Delivery Network • Used for streaming video • Based on the browser limit of 2 requests (not applicable anymore) Thursday, January 17, 13
  • 16. #4 CDN • CloudFlare is a free CDN[6] • Amazon CloudFront is cheap [7] • Amazon S3 works too [8] • Roll your own Thursday, January 17, 13
  • 17. #5 Static site generation • Generate page(s) only if changed • Hype: blogging on dropbox/github pages[9] Thursday, January 17, 13
  • 18. #6 Tune apache • KeepAlive, KeepAliveTimeout, StartServers, MaxClients[10] Thursday, January 17, 13
  • 19. #6b Get rid of apache Thursday, January 17, 13
  • 20. #7 Opcode caching • Pre-compiling PHP in memory[10] • APC, eAccelerator, Zend server Thursday, January 17, 13
  • 21. #8 Varnish • Load balancing • Serving assets • Maintenance mode Thursday, January 17, 13
  • 22. #9 Memcached • In-memory object caching system[11] Thursday, January 17, 13
  • 23. #10 Improve your SQL • Use lazy-loading • Tune MySQL [12] • Use NoSQL Thursday, January 17, 13
  • 24. #11 Load it off the request • Message queues (ActiveMQ, RabbitMQ) • Load off : • Mails (notifications) • Background changes (change of product 1 changes product 2) • Logging (non vital) • Cache updates Thursday, January 17, 13
  • 25. #12 Improve your file handling • Reduce your include_path to a single entry or don't use it at all • Include or require absolute paths • Ensure that each try to include a file is a hit • Avoid file_exists(), is_file(), is_dir(), is_link() etc. • Avoid autoloading[13] Thursday, January 17, 13
  • 26. #13 Use output buffering • Specially for huge pages • StreamedResponse in Symfony 2.1 Thursday, January 17, 13
  • 27. Bonus #14 Use Google SPDY • Prioritizing & multiplexing • Encryption & compression baked in • Hint/push content • Chromium, Firefox & Opera only Thursday, January 17, 13
  • 28. Bonus #15 Use WebSockets • Faster then AJAX request • Great for instant client communication Thursday, January 17, 13
  • 29. In conclusion • #1 HTTP Cache Headers • #10 Improve your SQL • #2 GZIP Compression • #11 Load it off the request • #3 Minification • #12 Improve file handling • #4 CDN • #13 Use output buffering • #5 Static site generation • Bonus #14 Use Google • #6 Tune or ditch Apache SPDY • #7 Opcode caching • Bonus #15 Use • #8 Varnish websockets • #9 Memcached Thursday, January 17, 13
  • 30. One more thing Thursday, January 17, 13
  • 31. One more thing Thursday, January 17, 13
  • 32. One more thing Thursday, January 17, 13
  • 33. Questions? https://joind.in/talk/view/8066 @pascaldevink Thursday, January 17, 13
  • 34. References • infographics: http://mashable.com/2012/11/22/slow-websites/ • varnish: http://deglos.com/blog/2010/09/22/drupal-and-varnish-quick-intro • Webservers performance http://www.rootusers.com/web-server-performance-benchmark/ • [1] http://copperegg.com/slow-websites-hurt-search-engine-rankings/ • [2] http://econsultancy.com/nl/blog/11274-67-of-consumers-cite-slow-websites-as-the-main-cause-of-basket-abandonment • [3] http://www.webpagetest.org • [4] http://www.mnot.net/cache_docs/ • [5] http://symfony.com/doc/2.0/cookbook/assetic/asset_management.html • [6] http://www.cloudflare.com/ • [7] http://aws.amazon.com/cloudfront/ • [8] http://aws.amazon.com/s3/ • [9] http://octopress.org/ • [10] http://www.bootstrappingindependence.com/technology/how-to-improve-website-performance-with-drupal-php-mysql-and-apache/ • [11] http://memcached.org/ • [12] http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation Thursday, January 17, 13