SlideShare a Scribd company logo
1 of 26
Download to read offline
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

What's hot

Introduction to MongoDB and Ruby
Introduction to MongoDB and RubyIntroduction to MongoDB and Ruby
Introduction to MongoDB and Ruby
MongoDB
 
MongoDB PhillyDB database throw down
MongoDB PhillyDB database throw downMongoDB PhillyDB database throw down
MongoDB PhillyDB database throw down
zippy1981
 

What's hot (18)

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

Viewers also liked

02 mobile monday hanoi april 2013 vinova
02 mobile monday hanoi april 2013   vinova02 mobile monday hanoi april 2013   vinova
02 mobile monday hanoi april 2013 vinova
Quang Anh Le
 
Mobilemonday.vn momo-monetize thinking_tu do tai chinh_v1.2
Mobilemonday.vn   momo-monetize thinking_tu do tai chinh_v1.2Mobilemonday.vn   momo-monetize thinking_tu do tai chinh_v1.2
Mobilemonday.vn momo-monetize thinking_tu do tai chinh_v1.2
Quang Anh Le
 
Mobilemonday.vn adflex
Mobilemonday.vn   adflexMobilemonday.vn   adflex
Mobilemonday.vn adflex
Quang Anh Le
 
Mobilemonday.vn mobile interaction - mr ng cuu long goldsun focus media
Mobilemonday.vn   mobile interaction - mr ng cuu long goldsun focus mediaMobilemonday.vn   mobile interaction - mr ng cuu long goldsun focus media
Mobilemonday.vn mobile interaction - mr ng cuu long goldsun focus media
Quang Anh Le
 
Module 9 mindanao vocal music
Module  9 mindanao vocal musicModule  9 mindanao vocal music
Module 9 mindanao vocal music
S Marley
 

Viewers also liked (8)

02 mobile monday hanoi april 2013 vinova
02 mobile monday hanoi april 2013   vinova02 mobile monday hanoi april 2013   vinova
02 mobile monday hanoi april 2013 vinova
 
Mobilemonday.vn momo-monetize thinking_tu do tai chinh_v1.2
Mobilemonday.vn   momo-monetize thinking_tu do tai chinh_v1.2Mobilemonday.vn   momo-monetize thinking_tu do tai chinh_v1.2
Mobilemonday.vn momo-monetize thinking_tu do tai chinh_v1.2
 
Mobilemonday.vn adflex
Mobilemonday.vn   adflexMobilemonday.vn   adflex
Mobilemonday.vn adflex
 
Mobilemonday.vn mobile interaction - mr ng cuu long goldsun focus media
Mobilemonday.vn   mobile interaction - mr ng cuu long goldsun focus mediaMobilemonday.vn   mobile interaction - mr ng cuu long goldsun focus media
Mobilemonday.vn mobile interaction - mr ng cuu long goldsun focus media
 
Module 9 mindanao vocal music
Module  9 mindanao vocal musicModule  9 mindanao vocal music
Module 9 mindanao vocal music
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & Textspeak
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar to 04. Web optimization

Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
Thomas Weinert
 
High performance website
High performance websiteHigh performance website
High performance website
Chamnap Chhorn
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
tkramar
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it works
Ilya Grigorik
 

Similar to 04. Web optimization (20)

performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Speed!
Speed!Speed!
Speed!
 
High performance website
High performance websiteHigh performance website
High performance website
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
 
Making the web faster
Making the web fasterMaking the web faster
Making the web faster
 
Static resource-optimization using webutilities
Static resource-optimization using webutilitiesStatic resource-optimization using webutilities
Static resource-optimization using webutilities
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
WordPress Speed & Performance from Pagely's CTO
WordPress Speed & Performance from Pagely's CTOWordPress Speed & Performance from Pagely's CTO
WordPress Speed & Performance from Pagely's CTO
 
3 Hacks to Improve WordPress Performance
3 Hacks to Improve WordPress Performance3 Hacks to Improve WordPress Performance
3 Hacks to Improve WordPress Performance
 
Web performance optimization for modern web applications
Web performance optimization for modern web applicationsWeb performance optimization for modern web applications
Web performance optimization for modern web applications
 
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kuberneteshbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
hbaseconasia2017: Building online HBase cluster of Zhihu based on Kubernetes
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it works
 
Advanced Drupal 8 Caching
Advanced Drupal 8 CachingAdvanced Drupal 8 Caching
Advanced Drupal 8 Caching
 
10 things you can do to speed up your web app today stir trek edition
10 things you can do to speed up your web app today   stir trek edition10 things you can do to speed up your web app today   stir trek edition
10 things you can do to speed up your web app today stir trek edition
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
SharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceSharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 Performance
 
10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today
 
#3 Hanoi Magento Meetup - Part 3: Magento Website Optimization
#3 Hanoi Magento Meetup - Part 3: Magento Website Optimization#3 Hanoi Magento Meetup - Part 3: Magento Website Optimization
#3 Hanoi Magento Meetup - Part 3: Magento Website Optimization
 

More from Quang Anh Le

01 mobile monday hanoi april 2013 mobile game - afoli
01 mobile monday hanoi april 2013   mobile game - afoli01 mobile monday hanoi april 2013   mobile game - afoli
01 mobile monday hanoi april 2013 mobile game - afoli
Quang Anh Le
 
03 mobile monday hanoi april 2013 monetize thinking g mo m-work
03 mobile monday hanoi april 2013 monetize thinking g mo   m-work03 mobile monday hanoi april 2013 monetize thinking g mo   m-work
03 mobile monday hanoi april 2013 monetize thinking g mo m-work
Quang Anh Le
 
2. minh chau momo t4
2. minh chau momo t42. minh chau momo t4
2. minh chau momo t4
Quang Anh Le
 
0. mobilemonday.vn hcm 20130424
0. mobilemonday.vn hcm 201304240. mobilemonday.vn hcm 20130424
0. mobilemonday.vn hcm 20130424
Quang Anh Le
 
Vietnam mobile day 2012 phan mem cho phai dep - mana
Vietnam mobile day 2012   phan mem cho phai dep - manaVietnam mobile day 2012   phan mem cho phai dep - mana
Vietnam mobile day 2012 phan mem cho phai dep - mana
Quang Anh Le
 
Vietnam mobile day 2012 i os memory management - techmaster
Vietnam mobile day 2012   i os memory management - techmasterVietnam mobile day 2012   i os memory management - techmaster
Vietnam mobile day 2012 i os memory management - techmaster
Quang Anh Le
 
Vietnam mobile day 2012 monetizing mobile apps games - rubycell
Vietnam mobile day 2012   monetizing mobile apps games - rubycellVietnam mobile day 2012   monetizing mobile apps games - rubycell
Vietnam mobile day 2012 monetizing mobile apps games - rubycell
Quang Anh Le
 
Vietnam mobile day 2012 cuoc cach mang thoi ky hau mobile - misfit
Vietnam mobile day 2012   cuoc cach mang thoi ky hau mobile - misfitVietnam mobile day 2012   cuoc cach mang thoi ky hau mobile - misfit
Vietnam mobile day 2012 cuoc cach mang thoi ky hau mobile - misfit
Quang Anh Le
 
Vietnam mobile day 2012 multi platform development - game loft
Vietnam mobile day 2012   multi platform development - game loftVietnam mobile day 2012   multi platform development - game loft
Vietnam mobile day 2012 multi platform development - game loft
Quang Anh Le
 
Vietnam mobile day 2012 developer opportunity - nokia
Vietnam mobile day 2012   developer opportunity - nokiaVietnam mobile day 2012   developer opportunity - nokia
Vietnam mobile day 2012 developer opportunity - nokia
Quang Anh Le
 
Vietnam mobile day 2012 building a mobile linux firmware for your router - ...
Vietnam mobile day 2012   building a mobile linux firmware for your router - ...Vietnam mobile day 2012   building a mobile linux firmware for your router - ...
Vietnam mobile day 2012 building a mobile linux firmware for your router - ...
Quang Anh Le
 
Vietnam mobile day 2012 ban quyen mobile contents - vsm
Vietnam mobile day 2012   ban quyen mobile contents - vsmVietnam mobile day 2012   ban quyen mobile contents - vsm
Vietnam mobile day 2012 ban quyen mobile contents - vsm
Quang Anh Le
 
Vietnam mobile day 2012 platform mo va ung dung de phat trien mang xa hoi m...
Vietnam mobile day 2012   platform mo va ung dung de phat trien mang xa hoi m...Vietnam mobile day 2012   platform mo va ung dung de phat trien mang xa hoi m...
Vietnam mobile day 2012 platform mo va ung dung de phat trien mang xa hoi m...
Quang Anh Le
 
Vietnam mobile day 2012 co hoi mobile tai vietnam - cyber agent
Vietnam mobile day 2012   co hoi mobile tai vietnam - cyber agentVietnam mobile day 2012   co hoi mobile tai vietnam - cyber agent
Vietnam mobile day 2012 co hoi mobile tai vietnam - cyber agent
Quang Anh Le
 
Vietnam mobile day 2012 html5 game using impact js - aiti-aptech
Vietnam mobile day 2012   html5 game using impact js - aiti-aptechVietnam mobile day 2012   html5 game using impact js - aiti-aptech
Vietnam mobile day 2012 html5 game using impact js - aiti-aptech
Quang Anh Le
 
Vietnam mobile day 2012 tuong lai cho nha phat trien nds - share plus
Vietnam mobile day 2012   tuong lai cho nha phat trien nds - share plusVietnam mobile day 2012   tuong lai cho nha phat trien nds - share plus
Vietnam mobile day 2012 tuong lai cho nha phat trien nds - share plus
Quang Anh Le
 
Vietnam mobile day 2012 trends in mobile marketing - fifth i media
Vietnam mobile day 2012   trends in mobile marketing - fifth i mediaVietnam mobile day 2012   trends in mobile marketing - fifth i media
Vietnam mobile day 2012 trends in mobile marketing - fifth i media
Quang Anh Le
 
Vietnam mobile day 2012 thi hieu nguoi dung mobile - app storevn
Vietnam mobile day 2012   thi hieu nguoi dung mobile - app storevnVietnam mobile day 2012   thi hieu nguoi dung mobile - app storevn
Vietnam mobile day 2012 thi hieu nguoi dung mobile - app storevn
Quang Anh Le
 
Vietnam mobile day 2012 new platform - new opportunity - appota
Vietnam mobile day 2012   new platform - new opportunity - appotaVietnam mobile day 2012   new platform - new opportunity - appota
Vietnam mobile day 2012 new platform - new opportunity - appota
Quang Anh Le
 
Vietnam mobile day 2012 vietnam mobile vas market review - vdec
Vietnam mobile day 2012   vietnam mobile vas market review - vdecVietnam mobile day 2012   vietnam mobile vas market review - vdec
Vietnam mobile day 2012 vietnam mobile vas market review - vdec
Quang Anh Le
 

More from Quang Anh Le (20)

01 mobile monday hanoi april 2013 mobile game - afoli
01 mobile monday hanoi april 2013   mobile game - afoli01 mobile monday hanoi april 2013   mobile game - afoli
01 mobile monday hanoi april 2013 mobile game - afoli
 
03 mobile monday hanoi april 2013 monetize thinking g mo m-work
03 mobile monday hanoi april 2013 monetize thinking g mo   m-work03 mobile monday hanoi april 2013 monetize thinking g mo   m-work
03 mobile monday hanoi april 2013 monetize thinking g mo m-work
 
2. minh chau momo t4
2. minh chau momo t42. minh chau momo t4
2. minh chau momo t4
 
0. mobilemonday.vn hcm 20130424
0. mobilemonday.vn hcm 201304240. mobilemonday.vn hcm 20130424
0. mobilemonday.vn hcm 20130424
 
Vietnam mobile day 2012 phan mem cho phai dep - mana
Vietnam mobile day 2012   phan mem cho phai dep - manaVietnam mobile day 2012   phan mem cho phai dep - mana
Vietnam mobile day 2012 phan mem cho phai dep - mana
 
Vietnam mobile day 2012 i os memory management - techmaster
Vietnam mobile day 2012   i os memory management - techmasterVietnam mobile day 2012   i os memory management - techmaster
Vietnam mobile day 2012 i os memory management - techmaster
 
Vietnam mobile day 2012 monetizing mobile apps games - rubycell
Vietnam mobile day 2012   monetizing mobile apps games - rubycellVietnam mobile day 2012   monetizing mobile apps games - rubycell
Vietnam mobile day 2012 monetizing mobile apps games - rubycell
 
Vietnam mobile day 2012 cuoc cach mang thoi ky hau mobile - misfit
Vietnam mobile day 2012   cuoc cach mang thoi ky hau mobile - misfitVietnam mobile day 2012   cuoc cach mang thoi ky hau mobile - misfit
Vietnam mobile day 2012 cuoc cach mang thoi ky hau mobile - misfit
 
Vietnam mobile day 2012 multi platform development - game loft
Vietnam mobile day 2012   multi platform development - game loftVietnam mobile day 2012   multi platform development - game loft
Vietnam mobile day 2012 multi platform development - game loft
 
Vietnam mobile day 2012 developer opportunity - nokia
Vietnam mobile day 2012   developer opportunity - nokiaVietnam mobile day 2012   developer opportunity - nokia
Vietnam mobile day 2012 developer opportunity - nokia
 
Vietnam mobile day 2012 building a mobile linux firmware for your router - ...
Vietnam mobile day 2012   building a mobile linux firmware for your router - ...Vietnam mobile day 2012   building a mobile linux firmware for your router - ...
Vietnam mobile day 2012 building a mobile linux firmware for your router - ...
 
Vietnam mobile day 2012 ban quyen mobile contents - vsm
Vietnam mobile day 2012   ban quyen mobile contents - vsmVietnam mobile day 2012   ban quyen mobile contents - vsm
Vietnam mobile day 2012 ban quyen mobile contents - vsm
 
Vietnam mobile day 2012 platform mo va ung dung de phat trien mang xa hoi m...
Vietnam mobile day 2012   platform mo va ung dung de phat trien mang xa hoi m...Vietnam mobile day 2012   platform mo va ung dung de phat trien mang xa hoi m...
Vietnam mobile day 2012 platform mo va ung dung de phat trien mang xa hoi m...
 
Vietnam mobile day 2012 co hoi mobile tai vietnam - cyber agent
Vietnam mobile day 2012   co hoi mobile tai vietnam - cyber agentVietnam mobile day 2012   co hoi mobile tai vietnam - cyber agent
Vietnam mobile day 2012 co hoi mobile tai vietnam - cyber agent
 
Vietnam mobile day 2012 html5 game using impact js - aiti-aptech
Vietnam mobile day 2012   html5 game using impact js - aiti-aptechVietnam mobile day 2012   html5 game using impact js - aiti-aptech
Vietnam mobile day 2012 html5 game using impact js - aiti-aptech
 
Vietnam mobile day 2012 tuong lai cho nha phat trien nds - share plus
Vietnam mobile day 2012   tuong lai cho nha phat trien nds - share plusVietnam mobile day 2012   tuong lai cho nha phat trien nds - share plus
Vietnam mobile day 2012 tuong lai cho nha phat trien nds - share plus
 
Vietnam mobile day 2012 trends in mobile marketing - fifth i media
Vietnam mobile day 2012   trends in mobile marketing - fifth i mediaVietnam mobile day 2012   trends in mobile marketing - fifth i media
Vietnam mobile day 2012 trends in mobile marketing - fifth i media
 
Vietnam mobile day 2012 thi hieu nguoi dung mobile - app storevn
Vietnam mobile day 2012   thi hieu nguoi dung mobile - app storevnVietnam mobile day 2012   thi hieu nguoi dung mobile - app storevn
Vietnam mobile day 2012 thi hieu nguoi dung mobile - app storevn
 
Vietnam mobile day 2012 new platform - new opportunity - appota
Vietnam mobile day 2012   new platform - new opportunity - appotaVietnam mobile day 2012   new platform - new opportunity - appota
Vietnam mobile day 2012 new platform - new opportunity - appota
 
Vietnam mobile day 2012 vietnam mobile vas market review - vdec
Vietnam mobile day 2012   vietnam mobile vas market review - vdecVietnam mobile day 2012   vietnam mobile vas market review - vdec
Vietnam mobile day 2012 vietnam mobile vas market review - vdec
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 

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