SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
“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

Más contenido relacionado

La actualidad más candente

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
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessAnthony Somerset
 
On the Move, Website Migrations Debunked
On the Move, Website Migrations DebunkedOn the Move, Website Migrations Debunked
On the Move, Website Migrations DebunkedJonathan Perlman
 
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 solutionsChau Thanh
 
Konsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman webKonsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman webAhmad Faizar
 
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)Grant Norwood
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdevThanh Chau
 
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 TomcatTomitribe
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas 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 TomEEjaxconf
 
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 environmentZero Point Development
 
Automate IBM Connections Installations and more
Automate IBM Connections Installations and moreAutomate IBM Connections Installations and more
Automate IBM Connections Installations and morepanagenda
 

La actualidad más candente (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
 

Destacado (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
 

Similar a Let's speed it up a bit (AmsterdamPHP)

Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer ToolboxYnon Perek
 
AppEngine Performance Tuning
AppEngine Performance TuningAppEngine Performance Tuning
AppEngine Performance TuningDavid Chen
 
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
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
JSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJonathan Klein
 
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 HostingWPSFO Meetup Group
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump StartTroy Miles
 
Static resource-optimization using webutilities
Static resource-optimization using webutilitiesStatic resource-optimization using webutilities
Static resource-optimization using webutilitiesrpatil82
 
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 appsPablo Godel
 
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 scalableLizzie Hodgson
 
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 2013hernanibf
 
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 scalabilityJason Ragsdale
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdevChau Thanh
 
7 Habits of Exceptional Performance
7 Habits of Exceptional Performance7 Habits of Exceptional Performance
7 Habits of Exceptional PerformanceNicole 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 phpGraham Weldon
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalJeff Geerling
 
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...Domingo Suarez Torres
 

Similar a 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...
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"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
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
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!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 

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