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