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

PPTX
Type URL, Enter, and Then …
PDF
Introduction to Web Designing
PDF
Web performance mercadolibre - ECI 2013
PPTX
5 critical-optimizations.v2
PPTX
Availing Windows Dedicated Servers of HTS Hosting
PDF
Optimize drupal
PPTX
PDF
PHP MySQL Training : Module 3
Type URL, Enter, and Then …
Introduction to Web Designing
Web performance mercadolibre - ECI 2013
5 critical-optimizations.v2
Availing Windows Dedicated Servers of HTS Hosting
Optimize drupal
PHP MySQL Training : Module 3

What's hot (18)

PPTX
PHP conference Berlin 2015: running PHP on Nginx
PDF
Web performance optimization - MercadoLibre
ODP
PHP Training: Module 1
PDF
Running php on nginx
PDF
PHP MySQL Training : Module 2
PDF
Getting Started: The Environment
PDF
Introduction to MongoDB and Ruby
PDF
Hard Caching in TYPO3 - Developer Days in Malmø 2017
PPTX
Web subjects
ODP
MongoDB PhillyDB database throw down
PDF
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
PDF
Mongo db dhruba
PPTX
Mongo db intro.pptx
PPTX
Mongo DB
PPT
Simple Site Speed Improvements (SMX 2010)
PDF
What's behind facebook
PPT
статические и динамические сайты
PDF
Caching methodology and strategies
PHP conference Berlin 2015: running PHP on Nginx
Web performance optimization - MercadoLibre
PHP Training: Module 1
Running php on nginx
PHP MySQL Training : Module 2
Getting Started: The Environment
Introduction to MongoDB and Ruby
Hard Caching in TYPO3 - Developer Days in Malmø 2017
Web subjects
MongoDB PhillyDB database throw down
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Mongo db dhruba
Mongo db intro.pptx
Mongo DB
Simple Site Speed Improvements (SMX 2010)
What's behind facebook
статические и динамические сайты
Caching methodology and strategies
Ad

Viewers also liked (11)

PDF
Javapolis
KEY
Grade 1 Career Day
PPS
Uloga azoo u profesionalnom razvoju prosvjetnih djelatnika
PDF
CrossMark and Other Interesting Developments, Aries EMUG Meeting at CrossRef
PPTX
Illinois Ethics Citation Presentation
PDF
The press release on #CPSP 2013
PDF
CrossRef For African Journals
PPT
2013 CrossRef Workshops System Update: Reference Deposit Processing , Jon Stark
PPT
Rade Tricković - Oglasni potencijal web sajtova u Srbiji
PPT
What The App Presentation Podcamp East 2012
PPTX
Pinterest and Instagram for 2013 REALTOR Conference and Expo
Javapolis
Grade 1 Career Day
Uloga azoo u profesionalnom razvoju prosvjetnih djelatnika
CrossMark and Other Interesting Developments, Aries EMUG Meeting at CrossRef
Illinois Ethics Citation Presentation
The press release on #CPSP 2013
CrossRef For African Journals
2013 CrossRef Workshops System Update: Reference Deposit Processing , Jon Stark
Rade Tricković - Oglasni potencijal web sajtova u Srbiji
What The App Presentation Podcamp East 2012
Pinterest and Instagram for 2013 REALTOR Conference and Expo
Ad

Similar to 04 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 Nguyen Duc Phu (17)

PPTX
iOS Gaming with Cocos2d
PPT
05 - Phan Thai Trung - Tu dong dat hang tu he thong ban le lon nhat Trung Quoc
PPT
8 - Javascript unit testing framework
PPT
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
PPT
Hanoi php day 2008 - 03. dang minh tuan - html, css, javascript
PPT
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
PPT
Hanoi php day 2008 - 02. phan thai trung - drupal
PPT
13 social network game
PPTX
12 trung-oss-magento-overview
PPT
11 building joomla! extensions with flex integration
PDF
10 su dung drupal xay dung mang xa hoi
PPT
09 html5 css3-the_future_of_web_technology
PPT
07 build your-own_php_extension
PDF
02 vng thanhnt-speedup_ntvv2_by_ph_pextmodule_
PDF
01 zingme practice for building scalable website with php
PPT
14 how startups can benefit from launch community
PPT
Hanoi PHP Day 2008 - 04 - Nguyen Duc Phu - Search Engine: New Collection S...
iOS Gaming with Cocos2d
05 - Phan Thai Trung - Tu dong dat hang tu he thong ban le lon nhat Trung Quoc
8 - Javascript unit testing framework
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 03. dang minh tuan - html, css, javascript
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 02. phan thai trung - drupal
13 social network game
12 trung-oss-magento-overview
11 building joomla! extensions with flex integration
10 su dung drupal xay dung mang xa hoi
09 html5 css3-the_future_of_web_technology
07 build your-own_php_extension
02 vng thanhnt-speedup_ntvv2_by_ph_pextmodule_
01 zingme practice for building scalable website with php
14 how startups can benefit from launch community
Hanoi PHP Day 2008 - 04 - Nguyen Duc Phu - Search Engine: New Collection S...

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Getting Started with Data Integration: FME Form 101
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
A Presentation on Artificial Intelligence
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Machine Learning_overview_presentation.pptx
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Getting Started with Data Integration: FME Form 101
Accuracy of neural networks in brain wave diagnosis of schizophrenia
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
MYSQL Presentation for SQL database connectivity
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A Presentation on Artificial Intelligence
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
MIND Revenue Release Quarter 2 2025 Press Release
Spectral efficient network and resource selection model in 5G networks
Machine Learning_overview_presentation.pptx
SOPHOS-XG Firewall Administrator PPT.pptx

04 web optimization

  • 1. Web optimization oàn Văn Tuy n Pentalog Vietnam http://www.facebook.com/doanvantuyen [email protected] 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