SlideShare uma empresa Scribd logo
1 de 97
High performance Web Sites richardchang 腾讯技术大讲堂
不知大家有没有看过这个 ppt
以及这个架构图
Yahoo’s Case Performance research and 14 rules
Exceptional Performance ,[object Object],[object Object],[object Object],[object Object],[object Object]
Scope ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Importance of Front-End Performance
Back-end vs. Front-end percentage of time spent on the front-end Empty Cache Full Cache amazon.com 82% 86% aol.com 94% 86% cnn.com 81% 92% ebay.com 98% 92% google.com 86% 64% msn.com 97% 95% myspace.com 96% 86% wikipedia.org 80% 88% yahoo.com 95% 88% youtube.com 97% 95%
The Performance Golden Rule ,[object Object],[object Object],[object Object],[object Object]
[object Object]
http://yuiblog.com/blog/2006/11/28/performance-research-part-1/
80/20 Performance Rule ,[object Object],[object Object],[object Object],[object Object]
Empty vs. Full Cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
Empty vs. Full Cache with an empty cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
Empty vs. Full Cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
Empty vs. Full Cache Expires header 3 user re-requests www.yahoo.com with a full cache 1 user requests www.yahoo.com 2 user requests other web pages
Empty vs. Full Cache ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How much does this benefit our users? ,[object Object],[object Object],[object Object],[object Object]
http://yuiblog.com/blog/2007/01/04/performance-research-part-2/
Browser Cache Experiment ,[object Object],[object Object],[object Object],[object Object],[object Object],} 1  px
Browser Cache Experiment ,[object Object],[object Object],[object Object]
Browser Cache Experiment What percentage of  users  view with an empty cache? # unique users with at least one 200 response total # unique users What percentage of  page views  are done with an empty cache? total # of 200 responses # of 200 + # of 304 responses } 1  px
Surprising Results 40-60%  ~20%  page views with empty cache users with empty cache
Experiment Takeaways ,[object Object],[object Object]
http://yuiblog.com/blog/2007/03/01/performance-research-part-3
HTTP Quick Review HTTP response header sent by the web server: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Set-Cookie: C=abcdefghijklmnopqrstuvwxyz; domain=.yahoo.com 1 user requests www.yahoo.com
HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: finance.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; …   Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 2 user requests finance.yahoo.com
HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: autos.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; …   Cookie:  C=abcdefghijklmnopqrstuvwxyz ; 1 user requests www.yahoo.com 3 user requests autos.yahoo.com
HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: mail.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; …   Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 4 user requests mail.yahoo.com
HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: tech.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; …   Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 5 user requests tech.yahoo.com
Impact of Cookies on Response Time 80 ms delay dialup users Cookie Size Time Delta 0 bytes 78 ms 0 ms 500 bytes 79 ms +1 ms 1000 bytes 94 ms +16 ms 1500 bytes 109 ms +31 ms 2000 bytes 125 ms +47 ms 2500 bytes 141 ms +63 ms 3000 bytes 156 ms +78 ms keep sizes low
.yahoo.com cookie sizes
Analysis of Cookie Sizes across the Web Total Cookie Size Amazon 60 bytes Google 72 bytes Yahoo 122 bytes CNN 184 bytes YouTube 218 bytes MSN 268 bytes eBay 331 bytes MySpace 500 bytes
Experiment Takeaways ,[object Object],[object Object],[object Object],[object Object],[object Object]
http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
Parallel Downloads Two components in parallel per hostname HTTP/1.1 GIF GIF GIF GIF GIF GIF
Parallel Downloads Two in parallel Four in parallel Eight in parallel
Maximizing Parallel Downloads response time (seconds) aliases
Maximizing Parallel Downloads response time (seconds) aliases
Maximizing Parallel Downloads response time (seconds) aliases
Maximizing Parallel Downloads response time (seconds) rule of thumb: use at least two but no more than four aliases
Experiment Takeaways ,[object Object],[object Object],[object Object]
[object Object]
How to optimize? ,[object Object],[object Object],[object Object],[object Object]
Basic Rules  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
14 things to check ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 1: Make fewer HTTP requests ,[object Object],[object Object],[object Object],[object Object]
Image maps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://www.w3.org/TR/html401/struct/objects.html#h-13.6
CSS Sprites – Preferred ,[object Object],CSS Sprites Generator - http://www.csssprites.com/  http://alistapart.com/articles/sprites  #rss {  background-image: url(sprite.png);  background-position: -8px -40px;  width: 16px;  height: 16px;  }
Combined Scripts,  Combined Stylesheets Scripts Stylesheets amazon.com 3 1 aol.com 18 1 cnn.com 11 2 ebay.com 7 2 froogle.google.com 1 1 msn.com 9 1 myspace.com 2 2 wikipedia.org 3 1 yahoo.com 4 1 youtube.com 7 3 Average 6.5 1.5
Combined Scripts, Combined Stylesheets ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 2: Use a CDN ,[object Object],amazon.com Akamai aol.com Akamai cnn.com ebay.com Akamai, Mirror Image google.com msn.com SAVVIS myspace.com Akamai, Limelight wikipedia.org yahoo.com Akamai youtube.com
Rule 3: Add an Expires header  ,[object Object],Images Stylesheets Scripts % Median Age amazon.com 0/62 0/1 0/3 0% 114 days aol.com 23/43 1/1 6/18 48% 217 days cnn.com 0/138 0/2 2/11 1% 227 days ebay.com 16/20 0/2 0/7 55% 140 days froogle.google.com 1/23 0/1 0/1 4% 454 days msn.com 32/35 1/1 3/9 80% 34 days myspace.com 0/18 0/2 0/2 0% 1 day wikipedia.org 6/8 1/1 2/3 75% 1 day yahoo.com 23/23 1/1 4/4 100% n/a youtube.com 0/32 0/3 0/7 0% 26 days
Setting Expires header in Apache ,[object Object],[object Object],[object Object]
When  modifing an asset? ,[object Object],[object Object],[object Object],[object Object]
Rule 4: Gzip components  ,[object Object],[object Object]
Gzip: not just for HTML ,[object Object],HTML Scripts Stylesheets amazon.com x aol.com x some some cnn.com ebay.com x froogle.google.com x x x msn.com x deflate deflate myspace.com x x x wikipedia.org x x x yahoo.com x x x youtube.com x some some
Gzip Configuration  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],needed for proxies
Rule 5: Put CSS at the top  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Slowest is Fastest
Rule 6: Move scripts to the bottom  ,[object Object],[object Object],[object Object],[object Object]
Rule 6: Move scripts to the bottom  ,[object Object],[object Object],[object Object],[object Object]
Rule 7: Avoid CSS expressions  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 8: Make JS and CSS external  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Post-Onload Download ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example : Google ,[object Object]
Example : Yahoo  ,[object Object]
Dynamic Inlining ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 9: Reduce DNS lookups  ,[object Object],[object Object],[object Object]
TTL (Time To Live) TTL – how long record can be cached browser settings override TTL www.amazon.com 1 minute www.aol.com 1 minute www.cnn.com 10 minutes www.ebay.com 1 hour www.google.com 5 minutes www.msn.com 5 minutes www.myspace.com 1 hour www.wikipedia.org 1 hour www.yahoo.com 1 minute www.youtube.com 5 minutes
Browser DNS Cache ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Reducing DNS Lookups ,[object Object],[object Object]
Rule 10: Minify JavaScript minify inline scripts, too Minify External? Minify Inline? www.amazon.com no no www.aol.com no no www.cnn.com no no www.ebay.com yes no froogle.google.com yes yes www.msn.com yes yes www.myspace.com no no www.wikipedia.org no no www.yahoo.com yes yes www.youtube.com no no
Minify vs. Obfuscate minify – it's safer http://crockford.com/javascript/jsmin http://dojotoolkit.org/docs/shrinksafe Original JSMin Savings Dojo Savings www.amazon.com 204K 31K (15%) 48K (24%) www.aol.com 44K 4K (10%) 4K (10%) www.cnn.com 98K 19K (20%) 24K (25%) www.myspace.com 88K 23K (27%) 24K (28%) www.wikipedia.org 42K 14K (34%) 16K (38%) www.youtube.com 34K 8K (22%) 10K (29%) Average 85K 17K (21%) 21K (25%)
Rule 11: Avoid redirects ,[object Object],[object Object],[object Object],[object Object],[object Object],http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Redirects Redirects www.amazon.com no www.aol.com yes – secondary page www.cnn.com yes – initial page www.ebay.com yes – secondary page froogle.google.com no www.msn.com yes – initial page www.myspace.com yes – secondary page www.wikipedia.org yes – secondary page www.yahoo.com yes – secondary page www.youtube.com no
Avoid Redirects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 12: Remove duplicate scripts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Script Insertion Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 13: Turn off ETags ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Problem with ETags ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule 14: Make AJAX cacheable  and small ,[object Object],[object Object]
AJAX Example: Yahoo! Mail Beta ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
IBM Page Detailer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://alphaworks.ibm.com/tech/pagedetailer
http://alphaworks.ibm.com/tech/pagedetailer
Fasterfox ,[object Object],[object Object],[object Object],[object Object],http://fasterfox.mozdev.org/
LiveHTTPHeaders ,[object Object],[object Object],[object Object],http://livehttpheaders.mozdev.org/
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://getfirebug.com/
http://getfirebug.com/
YSlow ,[object Object],[object Object],[object Object],[object Object],[object Object]
 
 
 
 
[object Object]
Takeaways ,[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesCurelet Marius
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesStrangeloop
 
Belgrade when its just too slow
Belgrade when its just too slowBelgrade when its just too slow
Belgrade when its just too slowDoug Sillars
 
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 worksIlya Grigorik
 
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXReducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXMichael Jones
 
How I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileHow I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileRoxana Stingu
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012Bastian Grimm
 
Accelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMPAccelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMPJono Alderson
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Andy Davies
 
Performance automation 101 @LDNWebPerf MickMcGuinness
Performance automation 101 @LDNWebPerf MickMcGuinnessPerformance automation 101 @LDNWebPerf MickMcGuinness
Performance automation 101 @LDNWebPerf MickMcGuinnessStephen Thair
 
How to Fix a Slow WordPress Site (and get A+ scores)
How to Fix a Slow WordPress Site (and get A+ scores)How to Fix a Slow WordPress Site (and get A+ scores)
How to Fix a Slow WordPress Site (and get A+ scores)Lewis Ogden
 
Its Time To Stop Stalling: Mobile App and Video Performance
Its Time To Stop Stalling: Mobile App and Video PerformanceIts Time To Stop Stalling: Mobile App and Video Performance
Its Time To Stop Stalling: Mobile App and Video PerformanceDoug Sillars
 
What does the browser pre-loader do?
What does the browser pre-loader do?What does the browser pre-loader do?
What does the browser pre-loader do?Andy Davies
 
The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2Andy Davies
 
A faster journey with HTTP
A faster journey with HTTPA faster journey with HTTP
A faster journey with HTTPMichael Ewins
 
Its timetostopstalling mot_paris
Its timetostopstalling mot_parisIts timetostopstalling mot_paris
Its timetostopstalling mot_parisDoug Sillars
 
Its timetostopstalling barcelonajs
Its timetostopstalling barcelonajsIts timetostopstalling barcelonajs
Its timetostopstalling barcelonajsDoug Sillars
 

Mais procurados (19)

Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client Machines
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companies
 
Belgrade when its just too slow
Belgrade when its just too slowBelgrade when its just too slow
Belgrade when its just too slow
 
Keep the Web Fast
Keep the Web FastKeep the Web Fast
Keep the Web Fast
 
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
 
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXReducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
 
How I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileHow I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess file
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
 
Cache is King
Cache is KingCache is King
Cache is King
 
Accelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMPAccelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMP
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Performance automation 101 @LDNWebPerf MickMcGuinness
Performance automation 101 @LDNWebPerf MickMcGuinnessPerformance automation 101 @LDNWebPerf MickMcGuinness
Performance automation 101 @LDNWebPerf MickMcGuinness
 
How to Fix a Slow WordPress Site (and get A+ scores)
How to Fix a Slow WordPress Site (and get A+ scores)How to Fix a Slow WordPress Site (and get A+ scores)
How to Fix a Slow WordPress Site (and get A+ scores)
 
Its Time To Stop Stalling: Mobile App and Video Performance
Its Time To Stop Stalling: Mobile App and Video PerformanceIts Time To Stop Stalling: Mobile App and Video Performance
Its Time To Stop Stalling: Mobile App and Video Performance
 
What does the browser pre-loader do?
What does the browser pre-loader do?What does the browser pre-loader do?
What does the browser pre-loader do?
 
The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2
 
A faster journey with HTTP
A faster journey with HTTPA faster journey with HTTP
A faster journey with HTTP
 
Its timetostopstalling mot_paris
Its timetostopstalling mot_parisIts timetostopstalling mot_paris
Its timetostopstalling mot_paris
 
Its timetostopstalling barcelonajs
Its timetostopstalling barcelonajsIts timetostopstalling barcelonajs
Its timetostopstalling barcelonajs
 

Destaque

腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化topgeek
 
百姓网的网速优化之路
百姓网的网速优化之路百姓网的网速优化之路
百姓网的网速优化之路topgeek
 
Rest与面向资源的web开发
Rest与面向资源的web开发Rest与面向资源的web开发
Rest与面向资源的web开发topgeek
 
腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3topgeek
 
腾讯大讲堂38 oracle基础体系结构及性能优化
腾讯大讲堂38 oracle基础体系结构及性能优化腾讯大讲堂38 oracle基础体系结构及性能优化
腾讯大讲堂38 oracle基础体系结构及性能优化topgeek
 
Adventures in Livestreaming
Adventures in LivestreamingAdventures in Livestreaming
Adventures in LivestreamingLori Packer
 

Destaque (6)

腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化
 
百姓网的网速优化之路
百姓网的网速优化之路百姓网的网速优化之路
百姓网的网速优化之路
 
Rest与面向资源的web开发
Rest与面向资源的web开发Rest与面向资源的web开发
Rest与面向资源的web开发
 
腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3
 
腾讯大讲堂38 oracle基础体系结构及性能优化
腾讯大讲堂38 oracle基础体系结构及性能优化腾讯大讲堂38 oracle基础体系结构及性能优化
腾讯大讲堂38 oracle基础体系结构及性能优化
 
Adventures in Livestreaming
Adventures in LivestreamingAdventures in Livestreaming
Adventures in Livestreaming
 

Semelhante a 腾讯大讲堂09 如何建设高性能网站

腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站George Ang
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website PerformanceRene Churchill
 
Heavy Web Optimization: Frontend
Heavy Web Optimization: FrontendHeavy Web Optimization: Frontend
Heavy Web Optimization: FrontendVõ Duy Tuấn
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
Web Front End Performance
Web Front End PerformanceWeb Front End Performance
Web Front End PerformanceChris Love
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax ApplicationsSiarhei Barysiuk
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyChristian Thilmany
 
Frontend performance
Frontend performanceFrontend performance
Frontend performancesacred 8
 
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Adam Dunford
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesStoyan Stefanov
 
Page Performance
Page PerformancePage Performance
Page Performanceatorreno
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScalePatrick Chanezon
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...John McCaffrey
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuningJohn McCaffrey
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 
Web 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web SitesWeb 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web SitesSteve Souders
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By DesignTim Morrow
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website OptimizationGerard Sychay
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersDistilled
 

Semelhante a 腾讯大讲堂09 如何建设高性能网站 (20)

腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website Performance
 
Heavy Web Optimization: Frontend
Heavy Web Optimization: FrontendHeavy Web Optimization: Frontend
Heavy Web Optimization: Frontend
 
High performance website
High performance websiteHigh performance website
High performance website
 
Web Front End Performance
Web Front End PerformanceWeb Front End Performance
Web Front End Performance
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian Thilmany
 
Frontend performance
Frontend performanceFrontend performance
Frontend performance
 
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
 
Speed = $$$
Speed = $$$Speed = $$$
Speed = $$$
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
 
Page Performance
Page PerformancePage Performance
Page Performance
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Web 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web SitesWeb 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web Sites
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By Design
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
 

Mais de topgeek

明洪涛 个性化推荐系统@土豆
明洪涛 个性化推荐系统@土豆明洪涛 个性化推荐系统@土豆
明洪涛 个性化推荐系统@土豆topgeek
 
项亮 推荐系统实践 从入门到精通
项亮 推荐系统实践 从入门到精通 项亮 推荐系统实践 从入门到精通
项亮 推荐系统实践 从入门到精通 topgeek
 
空望 推荐系统@淘宝
空望 推荐系统@淘宝空望 推荐系统@淘宝
空望 推荐系统@淘宝topgeek
 
从长津湖战役看团队建设
从长津湖战役看团队建设从长津湖战役看团队建设
从长津湖战役看团队建设topgeek
 
Agile changes in liba
Agile changes in libaAgile changes in liba
Agile changes in libatopgeek
 
I hate unit test
I hate unit testI hate unit test
I hate unit testtopgeek
 
Ruby agile development_of_game_operation_platform
Ruby agile development_of_game_operation_platformRuby agile development_of_game_operation_platform
Ruby agile development_of_game_operation_platformtopgeek
 
图形组件技术杂谈
图形组件技术杂谈图形组件技术杂谈
图形组件技术杂谈topgeek
 
腾讯大讲堂42 数据库内核设计思路浅析
腾讯大讲堂42 数据库内核设计思路浅析腾讯大讲堂42 数据库内核设计思路浅析
腾讯大讲堂42 数据库内核设计思路浅析topgeek
 
腾讯大讲堂48 数据库查询优化浅析
腾讯大讲堂48 数据库查询优化浅析腾讯大讲堂48 数据库查询优化浅析
腾讯大讲堂48 数据库查询优化浅析topgeek
 
腾讯大讲堂45 解剖ttc
腾讯大讲堂45 解剖ttc腾讯大讲堂45 解剖ttc
腾讯大讲堂45 解剖ttctopgeek
 
腾讯大讲堂26 带宽优化之道
腾讯大讲堂26 带宽优化之道腾讯大讲堂26 带宽优化之道
腾讯大讲堂26 带宽优化之道topgeek
 
腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍topgeek
 
腾讯大讲堂24 qq show2.0重构历程
腾讯大讲堂24 qq show2.0重构历程腾讯大讲堂24 qq show2.0重构历程
腾讯大讲堂24 qq show2.0重构历程topgeek
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向topgeek
 
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)腾讯大讲堂17 性能优化不是仅局限于后台(qzone)
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)topgeek
 
腾讯大讲堂13 soso访问速度优化
腾讯大讲堂13 soso访问速度优化腾讯大讲堂13 soso访问速度优化
腾讯大讲堂13 soso访问速度优化topgeek
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨topgeek
 
腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化topgeek
 
腾讯大讲堂05 面向对象应对之道
腾讯大讲堂05 面向对象应对之道腾讯大讲堂05 面向对象应对之道
腾讯大讲堂05 面向对象应对之道topgeek
 

Mais de topgeek (20)

明洪涛 个性化推荐系统@土豆
明洪涛 个性化推荐系统@土豆明洪涛 个性化推荐系统@土豆
明洪涛 个性化推荐系统@土豆
 
项亮 推荐系统实践 从入门到精通
项亮 推荐系统实践 从入门到精通 项亮 推荐系统实践 从入门到精通
项亮 推荐系统实践 从入门到精通
 
空望 推荐系统@淘宝
空望 推荐系统@淘宝空望 推荐系统@淘宝
空望 推荐系统@淘宝
 
从长津湖战役看团队建设
从长津湖战役看团队建设从长津湖战役看团队建设
从长津湖战役看团队建设
 
Agile changes in liba
Agile changes in libaAgile changes in liba
Agile changes in liba
 
I hate unit test
I hate unit testI hate unit test
I hate unit test
 
Ruby agile development_of_game_operation_platform
Ruby agile development_of_game_operation_platformRuby agile development_of_game_operation_platform
Ruby agile development_of_game_operation_platform
 
图形组件技术杂谈
图形组件技术杂谈图形组件技术杂谈
图形组件技术杂谈
 
腾讯大讲堂42 数据库内核设计思路浅析
腾讯大讲堂42 数据库内核设计思路浅析腾讯大讲堂42 数据库内核设计思路浅析
腾讯大讲堂42 数据库内核设计思路浅析
 
腾讯大讲堂48 数据库查询优化浅析
腾讯大讲堂48 数据库查询优化浅析腾讯大讲堂48 数据库查询优化浅析
腾讯大讲堂48 数据库查询优化浅析
 
腾讯大讲堂45 解剖ttc
腾讯大讲堂45 解剖ttc腾讯大讲堂45 解剖ttc
腾讯大讲堂45 解剖ttc
 
腾讯大讲堂26 带宽优化之道
腾讯大讲堂26 带宽优化之道腾讯大讲堂26 带宽优化之道
腾讯大讲堂26 带宽优化之道
 
腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍
 
腾讯大讲堂24 qq show2.0重构历程
腾讯大讲堂24 qq show2.0重构历程腾讯大讲堂24 qq show2.0重构历程
腾讯大讲堂24 qq show2.0重构历程
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向
 
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)腾讯大讲堂17 性能优化不是仅局限于后台(qzone)
腾讯大讲堂17 性能优化不是仅局限于后台(qzone)
 
腾讯大讲堂13 soso访问速度优化
腾讯大讲堂13 soso访问速度优化腾讯大讲堂13 soso访问速度优化
腾讯大讲堂13 soso访问速度优化
 
腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨腾讯大讲堂08 可扩展web架构探讨
腾讯大讲堂08 可扩展web架构探讨
 
腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化腾讯大讲堂06 qq邮箱性能优化
腾讯大讲堂06 qq邮箱性能优化
 
腾讯大讲堂05 面向对象应对之道
腾讯大讲堂05 面向对象应对之道腾讯大讲堂05 面向对象应对之道
腾讯大讲堂05 面向对象应对之道
 

Último

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
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
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Último (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
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 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
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!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

腾讯大讲堂09 如何建设高性能网站

  • 1. High performance Web Sites richardchang 腾讯技术大讲堂
  • 4. Yahoo’s Case Performance research and 14 rules
  • 5.
  • 6.
  • 7. The Importance of Front-End Performance
  • 8. Back-end vs. Front-end percentage of time spent on the front-end Empty Cache Full Cache amazon.com 82% 86% aol.com 94% 86% cnn.com 81% 92% ebay.com 98% 92% google.com 86% 64% msn.com 97% 95% myspace.com 96% 86% wikipedia.org 80% 88% yahoo.com 95% 88% youtube.com 97% 95%
  • 9.
  • 10.
  • 12.
  • 13. Empty vs. Full Cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
  • 14. Empty vs. Full Cache with an empty cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
  • 15. Empty vs. Full Cache 1 user requests www.yahoo.com 2 user requests other web pages 3 user re-requests www.yahoo.com
  • 16. Empty vs. Full Cache Expires header 3 user re-requests www.yahoo.com with a full cache 1 user requests www.yahoo.com 2 user requests other web pages
  • 17.
  • 18.
  • 20.
  • 21.
  • 22. Browser Cache Experiment What percentage of users view with an empty cache? # unique users with at least one 200 response total # unique users What percentage of page views are done with an empty cache? total # of 200 responses # of 200 + # of 304 responses } 1 px
  • 23. Surprising Results 40-60% ~20% page views with empty cache users with empty cache
  • 24.
  • 26. HTTP Quick Review HTTP response header sent by the web server: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Set-Cookie: C=abcdefghijklmnopqrstuvwxyz; domain=.yahoo.com 1 user requests www.yahoo.com
  • 27. HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: finance.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; … Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 2 user requests finance.yahoo.com
  • 28. HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: autos.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; … Cookie: C=abcdefghijklmnopqrstuvwxyz ; 1 user requests www.yahoo.com 3 user requests autos.yahoo.com
  • 29. HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: mail.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; … Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 4 user requests mail.yahoo.com
  • 30. HTTP Quick Review HTTP request header sent by the browser: GET / HTTP/1.1 Host: tech.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; … Cookie: C=abcdefghijklmnopqrstuvwxyz; 1 user requests www.yahoo.com 5 user requests tech.yahoo.com
  • 31. Impact of Cookies on Response Time 80 ms delay dialup users Cookie Size Time Delta 0 bytes 78 ms 0 ms 500 bytes 79 ms +1 ms 1000 bytes 94 ms +16 ms 1500 bytes 109 ms +31 ms 2000 bytes 125 ms +47 ms 2500 bytes 141 ms +63 ms 3000 bytes 156 ms +78 ms keep sizes low
  • 33. Analysis of Cookie Sizes across the Web Total Cookie Size Amazon 60 bytes Google 72 bytes Yahoo 122 bytes CNN 184 bytes YouTube 218 bytes MSN 268 bytes eBay 331 bytes MySpace 500 bytes
  • 34.
  • 36. Parallel Downloads Two components in parallel per hostname HTTP/1.1 GIF GIF GIF GIF GIF GIF
  • 37. Parallel Downloads Two in parallel Four in parallel Eight in parallel
  • 38. Maximizing Parallel Downloads response time (seconds) aliases
  • 39. Maximizing Parallel Downloads response time (seconds) aliases
  • 40. Maximizing Parallel Downloads response time (seconds) aliases
  • 41. Maximizing Parallel Downloads response time (seconds) rule of thumb: use at least two but no more than four aliases
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50. Combined Scripts, Combined Stylesheets Scripts Stylesheets amazon.com 3 1 aol.com 18 1 cnn.com 11 2 ebay.com 7 2 froogle.google.com 1 1 msn.com 9 1 myspace.com 2 2 wikipedia.org 3 1 yahoo.com 4 1 youtube.com 7 3 Average 6.5 1.5
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70. TTL (Time To Live) TTL – how long record can be cached browser settings override TTL www.amazon.com 1 minute www.aol.com 1 minute www.cnn.com 10 minutes www.ebay.com 1 hour www.google.com 5 minutes www.msn.com 5 minutes www.myspace.com 1 hour www.wikipedia.org 1 hour www.yahoo.com 1 minute www.youtube.com 5 minutes
  • 71.
  • 72.
  • 73. Rule 10: Minify JavaScript minify inline scripts, too Minify External? Minify Inline? www.amazon.com no no www.aol.com no no www.cnn.com no no www.ebay.com yes no froogle.google.com yes yes www.msn.com yes yes www.myspace.com no no www.wikipedia.org no no www.yahoo.com yes yes www.youtube.com no no
  • 74. Minify vs. Obfuscate minify – it's safer http://crockford.com/javascript/jsmin http://dojotoolkit.org/docs/shrinksafe Original JSMin Savings Dojo Savings www.amazon.com 204K 31K (15%) 48K (24%) www.aol.com 44K 4K (10%) 4K (10%) www.cnn.com 98K 19K (20%) 24K (25%) www.myspace.com 88K 23K (27%) 24K (28%) www.wikipedia.org 42K 14K (34%) 16K (38%) www.youtube.com 34K 8K (22%) 10K (29%) Average 85K 17K (21%) 21K (25%)
  • 75.
  • 76. Redirects Redirects www.amazon.com no www.aol.com yes – secondary page www.cnn.com yes – initial page www.ebay.com yes – secondary page froogle.google.com no www.msn.com yes – initial page www.myspace.com yes – secondary page www.wikipedia.org yes – secondary page www.yahoo.com yes – secondary page www.youtube.com no
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 87.
  • 88.
  • 89.
  • 91.
  • 92.  
  • 93.  
  • 94.  
  • 95.  
  • 96.
  • 97.

Notas do Editor

  1. Mysql conf 2005
  2. Perlbal + memcached, both developed and shared by LJ team
  3. 用了 packet sniffer 以后,下图显示如果用户没有 cache ( empty cache )的情况下读取 www.yahoo.com 的情况,可以看到其实只有 5 % 的时间花在了读取最开始的 html 上( 0.24 ),其他的 90% 时间花在了读取其他组件,例如 image , css 和 scripts 。
  4. 我们又对其他大型网站做了测试,发现情况也很类似,大部分的时间都是花在了读取非 html 的其他组件。
  5. 目前很多常用的性能优化技巧都集中在 html 生成( generating html )的部分( apache , C++, database , etc )但是实际上用户反应时间( response time )中只有 20% 是和这一部分相关的,所以我们还是将时间花在另外那 80% 的问题吧。
  6. 2/8 定律
  7. 结论:要让用户感觉网页反应最快, full cache 的优势很大
  8. 有多少比例的用户在看主页的时候是 empty cache 有多少比例的 PV 是在 empty cache 的情况下产生的
  9. 在 yahoo 的首页增加一个透明的小图 (1x1) , header 设置成 ” Expires: Thu, 15 Apr 2004 20:00:00 GMT , Last-Modified: Wed, 28 Sep 2006 23:49:57 GMT“ 。每天跟踪有多少比例的用户请求的这个小图,以及多少比例的 page view 中请求了这个小图 When the browser saves a component in its cache, it also saves the Expires and Last Modified values. Specifying an Expires date in the past forces the browser to request the image every time the page is viewed (with a few exceptions, such as when users click the browser’s “back” button to return to a page).
  10. 从浏览器返回的 response 应该是 200 ( The browser does not have the image in its cache )或者 304 ( The browser has the image in its cache, but needs to verify the last modified date )。
  11. On the first day of the experiment, no one had these images cached so the empty cache percentage was 100%. As the days passed more users had the images cached, so the percentages dropped until at some point it reached a constant steady state.
  12. However, we found in our study that regardless of usage patterns, the percentage of page views with an empty cache is always ~20%. empty cache 的用户很可能比你想像中要多得多
  13. The browser saves the “C” cookie on the user’s computer and sends it back in future requests. The “domain=.yahoo.com” specifies that the browser should include the cookie in future requests within the .yahoo.com domain and all its sub-domains. For example, if the user then visits finance.yahoo.com, the browser includes the “C” cookie in the request. Since an Expires attribute is not included in this example, the cookie expires at the end of the session.
  14. Cookies 的大小也会对用户的反应时间造成很大影响,
  15. While the data shows that the majority of page views aren’t impacted by a significant delay, it also shows that about 2% of page views have over 1500 bytes of cookies set at the .yahoo.com domain. Although 2% sounds insignificant, at Yahoo! this translates to millions of page views per day,
  16. The data in Table 2 reflects only cookies set at the top domain levels to eliminate any cookies that may have been set by ads
  17. A cookie set at the .yahoo.com domain impacts the response time for every Yahoo! page in the .yahoo.com domain that a user visits. 尽量减少不必要的 cookies 将 cookie 的 size 缩小 将 cookie 放到 domain level 的时候要谨慎小心,尽量不要影响其他的 sub domain 将 expiration date 合理设置
  18. 既然对最终用户反应时间的最大影响来自与有多少个组件要被请求,为什么不能一次同时将他们下载完呢?主要是因为 http/1.1 的规范,浏览器每次只能同时从单个 hostname 下载两个组件
  19. 但是如果一个网站将自己的组件平均地分配到两个 hostname 上,就会像下图
  20. 那么到底是不是将组件分配到越多 hostname 越好呢,我们也做了测试。 The experiment measured an empty HTML document with 20 images on the page. The images were fetched from the same servers as those used by real Yahoo! pages. We ran the experiment in a controlled environment using a test harness that fetches a set of URLs repeatedly while measuring how long it takes to load the page on DSL.
  21. We fetch 20 smaller-sized images (36 x 36 px) and 20 medium-sized images (116 x 61 px). To our surprise, increasing the number of aliases for loading the medium-size images (116 x 61px) worsens the response times using four or more aliases. Increasing the number of aliases by more than two for smaller-sized images (36 x 36px) doesn’t make much of an impact on the overall response time. On average, using two aliases is best. One possible contributor for slower response times is the amount of CPU thrashing on the client caused by increasing the number of parallel downloads. Another issue to consider is that DNS lookup times vary significantly across ISPs and geographic locations.
  22. check out this image, used on Yahoo!'s homepage , or this one from Google's .
  23. serving compressed HTML, CSS, client-side scripts, and any other type of text content. If you make XMLHttpRequests to services that return XML (or JSON, or plain text), make sure your server gzips as well
  24. There's one gotcha when it comes to serving gzipped content: you must make sure that proxies do not get in your way. If an ISP's proxy caches your gzipped content and serves it to all of its customers, chances are that someone with a browser that doesn't support compression will receive your compressed content. To avoid this you can use the Vary: Accept-Encoding response header to tell the proxy to cache this response only for clients that send the same Accept-Encoding request header.
  25. due to the nature of the scripts (they could potentially change anything on a page), browsers block all downloads when they encounters a <script> tag. So until a script is downloaded and parsed, no other downloads will be initiated.
  26. Look out for the Number One