SlideShare a Scribd company logo
Web optimization
                 oàn Văn Tuy n
                   Pentalog Vietnam
http://www.facebook.com/doanvantuyen   doanvantuyen@gmail.com




                                                                1
Gi i thi u chung
• M c đích:
  “Chia s m t s kinh nghi m giúp tăng t c
    đ truy c p vào website”
• Áp d ng:
  “Dành cho nh ng website có lư ng truy
    c p ít và trung bình v i tài nguyên h n
    ch ”


                    PHP DAY 18/12/2010        2
Content
1.   HTTP request flow diagram
2.   Optimizing Page generate
3.   Minimizing round-trip times
4.   Minimizing request / response size
5.   Optimizing brower rendering
6.   Tools for Optimizing


                   PHP DAY 18/12/2010     3
1. HTTP request flow diagram
                                                            DNS server


                                    t
                                u es
                             Req              se
                         S                  on
                        N                 sp                  PHP compile & parser
                       D                re
                                  S
                                DN
Render page
                                        Page HTTP request

                                    Page HTTP response
                                   Image, JS, CSS request

              Client                       Image, JS, CSS                            DB
                                                                Web server



                                                   PHP DAY 18/12/2010                     4
2. Optimizing Page generate

•   Cache
•   Opcode cache
•   Server Configuration
•   Optimize code & log analysis =>
    Xdebug



                  PHP DAY 18/12/2010   5
2.1 Cache
• What:
  – Page cache
  – Block cache
  – Data cache
• How:
  –   Write on file
  –   Memory
  –   Database
  –   Static/Global variable




                               PHP DAY 18/12/2010   6
2.2 Opcode cache
•APC
•PHP accelerator
•eAccelerator
•Alternative PHP
Cache
•ionCube PHP
Accelerator
•XCache
•Zend Accelerator




                    PHP DAY 18/12/2010   7
2.3 Server Configuration
• Apache
  – MPM, remove .htaccess, GZip, ETag, Cache
    control
• PHP
  – Maximum memory, maximum execution time…
• MySQL
  – Slow SQL log




                     PHP DAY 18/12/2010        8
2.4 Optimize code & log
analysis
• Demo XDebug
• Other debug statement
  –   pint_r($x) , print_r($x, true)
  –   var_dump()
  –   thow new Exception()
  –   debug_print_backtrace()
  –   microtime(true)
  –   …



                        PHP DAY 18/12/2010   9
3. Minimizing round-trip
times
•   Use brower’s cache
•   User external CSS & javascript
•   Avoid 404 error
•   Combine CSS & JS file
•   Use CDN (Content delivery network)
•   Parallel download


                  PHP DAY 18/12/2010     10
3.1 Use brower’s cache




            PHP DAY 18/12/2010   11
3.2 User external CSS &
javascript




             PHP DAY 18/12/2010   12
3.3 Avoid 404 error




            PHP DAY 18/12/2010   13
4.4 Combine CSS & JS file

GOOD




BAD




              PHP DAY 18/12/2010   14
4.5 Use CDN




              PHP DAY 18/12/2010   15
3.6 Parallel download




             PHP DAY 18/12/2010   16
4. Minimizing request /
response size
• Use a cookieless domain for static
  content
• Use GZip
• Minify HTML, CSS, Javascript
• Optimize Image (and favicon.ico)



                 PHP DAY 18/12/2010    17
4.1 Use a cookieless domain for static
content




                    PHP DAY 18/12/2010   18
4.2 Use GZip




               PHP DAY 18/12/2010   19
4.3 Minify HTML, CSS, JS




             PHP DAY 18/12/2010   20
4.4 Optimize images
• Do not use BMPs or TIFFs
• Use PNG, GIF for small image or
  simple graphics
• Use JPG for photo
• Reduce the size of image to fit with
  display area
• Use small & cacheable favicon.ico


                 PHP DAY 18/12/2010      21
5. Optimizing brower
   rendering
•       Put CSS on top, javascript on
        bottom
•       Specify image size
•       Post load & Pre load
•       Use smart event handle
    –    Use $(“a”).click(function(){}); thay cho <a href=
         “javascript: …”



                            PHP DAY 18/12/2010               22
6. Tools for Optimizing




           XDebug & WinCacheGrind




            PHP DAY 18/12/2010      23
6. Tools for Optimizing (Cont)




                                https://addons.mozilla.org/en-US/firefox/addon/1843/




http://code.google.com/speed/page-speed/download.html     https://addons.mozilla.org/en-US/firefox/addon/5369/
                                                  PHP DAY 18/12/2010                                      24
Reference
•   http://code.google.com/speed/page-speed/docs/rules_intro.html
•   http://developer.yahoo.com/performance/rules.html
•   http://www.xdebug.org/
•   https://addons.mozilla.org/en-US/firefox/addon/1843/
•   http://developer.yahoo.com/yslow/
•   http://code.google.com/speed/page-speed/
•   http://sourceforge.net/projects/wincachegrind




                                 PHP DAY 18/12/2010                 25
Thanks !




           26

More Related Content

PDF
Introduction to performance tuning perl web applications
PDF
Building Scalable Websites with Perl
PDF
WordPress Need For Speed
PPT
Zend Con 2008 Slides
PDF
PyGotham 2014 Introduction to Profiling
ODP
Improving PHP Application Performance with APC
PPTX
Using memcache to improve php performance
PDF
Massively Scaled High Performance Web Services with PHP
Introduction to performance tuning perl web applications
Building Scalable Websites with Perl
WordPress Need For Speed
Zend Con 2008 Slides
PyGotham 2014 Introduction to Profiling
Improving PHP Application Performance with APC
Using memcache to improve php performance
Massively Scaled High Performance Web Services with PHP

What's hot (20)

PDF
Less and faster – Cache tips for WordPress developers
PPTX
PHP conference Berlin 2015: running PHP on Nginx
PDF
Running php on nginx
PDF
Caching with Memcached and APC
PDF
Scaling PHP web apps
PPT
Memcache
PDF
Search in WordPress - how it works and howto customize it
ODP
Choosing a Web Architecture for Perl
PDF
Memcached Presentation
PDF
Running PHP on Nginx
PPTX
Boost your website by running PHP on Nginx
PPT
5 things MySql
PDF
Improve Magento Performance
KEY
Performance Tuning - MuraCon 2012
PDF
Web Performance Optimization with HTTP/3
PDF
Magento performance & optimisation best practices
PDF
Connection Pooling in PostgreSQL using pgbouncer
PDF
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
PDF
From One to a Cluster
PDF
Engage 2013 - Multi Channel Data Collection
Less and faster – Cache tips for WordPress developers
PHP conference Berlin 2015: running PHP on Nginx
Running php on nginx
Caching with Memcached and APC
Scaling PHP web apps
Memcache
Search in WordPress - how it works and howto customize it
Choosing a Web Architecture for Perl
Memcached Presentation
Running PHP on Nginx
Boost your website by running PHP on Nginx
5 things MySql
Improve Magento Performance
Performance Tuning - MuraCon 2012
Web Performance Optimization with HTTP/3
Magento performance & optimisation best practices
Connection Pooling in PostgreSQL using pgbouncer
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
From One to a Cluster
Engage 2013 - Multi Channel Data Collection
Ad

Viewers also liked (11)

PDF
Zingme practice for building scalable website with PHP
PPTX
Speed up with hiphop php 2014 01-22
PPT
Caching strategy and apc
PPT
Heavy Web Optimization: Backend
PPTX
React introduction
PPT
Heavy Web Optimization: Frontend
PDF
Scale with Microservices
PPTX
How to Build Recommender System with Content based Filtering
PDF
Chatbot in Sale Management
PDF
Building a Recommendation Engine - An example of a product recommendation engine
PDF
Recommender system algorithm and architecture
Zingme practice for building scalable website with PHP
Speed up with hiphop php 2014 01-22
Caching strategy and apc
Heavy Web Optimization: Backend
React introduction
Heavy Web Optimization: Frontend
Scale with Microservices
How to Build Recommender System with Content based Filtering
Chatbot in Sale Management
Building a Recommendation Engine - An example of a product recommendation engine
Recommender system algorithm and architecture
Ad

Similar to Web optimization (20)

PDF
Optimizing Your Frontend Performance
PDF
Php go vrooom!
PPT
Make Drupal Run Fast - increase page load speed
PDF
Dutch php conference_2010_opm
PPTX
BTV PHP - Building Fast Websites
PPTX
Northeast PHP - High Performance PHP
PPTX
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
PDF
Performance scalability brandonlyon
PDF
Clug 2012 March web server optimisation
ODP
Clug 2011 March web server optimisation
PPTX
EscConf - Deep Dive Frontend Optimization
PDF
High performance website
PDF
Top ten-list
PDF
PDF
Bottom to Top Stack Optimization with LAMP
PDF
Bottom to Top Stack Optimization - CICON2011
PDF
Tuning web performance
PDF
Tuning Web Performance
PDF
Let's speed it up a bit (AmsterdamPHP)
KEY
Performance and scalability with drupal
Optimizing Your Frontend Performance
Php go vrooom!
Make Drupal Run Fast - increase page load speed
Dutch php conference_2010_opm
BTV PHP - Building Fast Websites
Northeast PHP - High Performance PHP
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Performance scalability brandonlyon
Clug 2012 March web server optimisation
Clug 2011 March web server optimisation
EscConf - Deep Dive Frontend Optimization
High performance website
Top ten-list
Bottom to Top Stack Optimization with LAMP
Bottom to Top Stack Optimization - CICON2011
Tuning web performance
Tuning Web Performance
Let's speed it up a bit (AmsterdamPHP)
Performance and scalability with drupal

More from Võ Duy Tuấn (20)

PPTX
Log management system for Microservices
PDF
Multi-tenant Database Design for SaaS
PPTX
Flutter introduction
PPTX
Mobile outsourcing best practices
PPTX
Microservices and docker
PPTX
Microservices in production
PPTX
Business Intelligence in Retail Industry
PPTX
Php psr standard 2014 01-22
PPTX
How to build a Recommender System
PPT
Mobile for web
PPTX
Reader.vn 2012 - The Book Of Life
PPT
PHP: Debugger, Profiler and more
PPTX
Magento overview and how sell Magento extensions
PPT
Javascript unit testing framework
PPT
Html5, css3 and the future of web technologies
PPT
How startups can benefit from launch community
PPT
Build your own PHP extension
PDF
Xây dựng mạng xã hội bằng drupal
PDF
Speed up zing me – ntvv2 code with PHP extension module
PDF
Hanoi php day 2010 program
Log management system for Microservices
Multi-tenant Database Design for SaaS
Flutter introduction
Mobile outsourcing best practices
Microservices and docker
Microservices in production
Business Intelligence in Retail Industry
Php psr standard 2014 01-22
How to build a Recommender System
Mobile for web
Reader.vn 2012 - The Book Of Life
PHP: Debugger, Profiler and more
Magento overview and how sell Magento extensions
Javascript unit testing framework
Html5, css3 and the future of web technologies
How startups can benefit from launch community
Build your own PHP extension
Xây dựng mạng xã hội bằng drupal
Speed up zing me – ntvv2 code with PHP extension module
Hanoi php day 2010 program

Web optimization

  • 1. Web optimization oàn Văn Tuy n Pentalog Vietnam http://www.facebook.com/doanvantuyen doanvantuyen@gmail.com 1
  • 2. Gi i thi u chung • M c đích: “Chia s m t s kinh nghi m giúp tăng t c đ truy c p vào website” • Áp d ng: “Dành cho nh ng website có lư ng truy c p ít và trung bình v i tài nguyên h n ch ” PHP DAY 18/12/2010 2
  • 3. Content 1. HTTP request flow diagram 2. Optimizing Page generate 3. Minimizing round-trip times 4. Minimizing request / response size 5. Optimizing brower rendering 6. Tools for Optimizing PHP DAY 18/12/2010 3
  • 4. 1. HTTP request flow diagram DNS server t u es Req se S on N sp PHP compile & parser D re S DN Render page Page HTTP request Page HTTP response Image, JS, CSS request Client Image, JS, CSS DB Web server PHP DAY 18/12/2010 4
  • 5. 2. Optimizing Page generate • Cache • Opcode cache • Server Configuration • Optimize code & log analysis => Xdebug PHP DAY 18/12/2010 5
  • 6. 2.1 Cache • What: – Page cache – Block cache – Data cache • How: – Write on file – Memory – Database – Static/Global variable PHP DAY 18/12/2010 6
  • 7. 2.2 Opcode cache •APC •PHP accelerator •eAccelerator •Alternative PHP Cache •ionCube PHP Accelerator •XCache •Zend Accelerator PHP DAY 18/12/2010 7
  • 8. 2.3 Server Configuration • Apache – MPM, remove .htaccess, GZip, ETag, Cache control • PHP – Maximum memory, maximum execution time… • MySQL – Slow SQL log PHP DAY 18/12/2010 8
  • 9. 2.4 Optimize code & log analysis • Demo XDebug • Other debug statement – pint_r($x) , print_r($x, true) – var_dump() – thow new Exception() – debug_print_backtrace() – microtime(true) – … PHP DAY 18/12/2010 9
  • 10. 3. Minimizing round-trip times • Use brower’s cache • User external CSS & javascript • Avoid 404 error • Combine CSS & JS file • Use CDN (Content delivery network) • Parallel download PHP DAY 18/12/2010 10
  • 11. 3.1 Use brower’s cache PHP DAY 18/12/2010 11
  • 12. 3.2 User external CSS & javascript PHP DAY 18/12/2010 12
  • 13. 3.3 Avoid 404 error PHP DAY 18/12/2010 13
  • 14. 4.4 Combine CSS & JS file GOOD BAD PHP DAY 18/12/2010 14
  • 15. 4.5 Use CDN PHP DAY 18/12/2010 15
  • 16. 3.6 Parallel download PHP DAY 18/12/2010 16
  • 17. 4. Minimizing request / response size • Use a cookieless domain for static content • Use GZip • Minify HTML, CSS, Javascript • Optimize Image (and favicon.ico) PHP DAY 18/12/2010 17
  • 18. 4.1 Use a cookieless domain for static content PHP DAY 18/12/2010 18
  • 19. 4.2 Use GZip PHP DAY 18/12/2010 19
  • 20. 4.3 Minify HTML, CSS, JS PHP DAY 18/12/2010 20
  • 21. 4.4 Optimize images • Do not use BMPs or TIFFs • Use PNG, GIF for small image or simple graphics • Use JPG for photo • Reduce the size of image to fit with display area • Use small & cacheable favicon.ico PHP DAY 18/12/2010 21
  • 22. 5. Optimizing brower rendering • Put CSS on top, javascript on bottom • Specify image size • Post load & Pre load • Use smart event handle – Use $(“a”).click(function(){}); thay cho <a href= “javascript: …” PHP DAY 18/12/2010 22
  • 23. 6. Tools for Optimizing XDebug & WinCacheGrind PHP DAY 18/12/2010 23
  • 24. 6. Tools for Optimizing (Cont) https://addons.mozilla.org/en-US/firefox/addon/1843/ http://code.google.com/speed/page-speed/download.html https://addons.mozilla.org/en-US/firefox/addon/5369/ PHP DAY 18/12/2010 24
  • 25. Reference • http://code.google.com/speed/page-speed/docs/rules_intro.html • http://developer.yahoo.com/performance/rules.html • http://www.xdebug.org/ • https://addons.mozilla.org/en-US/firefox/addon/1843/ • http://developer.yahoo.com/yslow/ • http://code.google.com/speed/page-speed/ • http://sourceforge.net/projects/wincachegrind PHP DAY 18/12/2010 25
  • 26. Thanks ! 26