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

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

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
 

Ä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

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"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
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
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
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
"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
 
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
 
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
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Kürzlich hochgeladen (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"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
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
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
 
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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
"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
 
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
 
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!
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

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