SlideShare ist ein Scribd-Unternehmen logo
1 von 19
网站性能优化  分享一 — 关于首屏时间
这是为神马 都不是浮云 老齐:团购导航打开好慢!老周:游戏浏览器好慢!有白屏!XX童鞋:360导航打开需要10秒XXVP:能否再快一点 再优化一些
这究竟是为什么呢,我在公司没感觉到慢啊。
首先考虑,什么是慢??? 通常用户所感知的慢 是指网站载入时空白时间长。
我感觉不出慢的原因可能有: 公司网络太好了 是XX光纤 伟大的帝都离机房特别近 我感知的都是缓存! 的确不慢,是对方的网络环境较差 RPWT 木有感知 幸好,我们有无线网卡。换上无线网卡来测试看看
果然真是慢!  白屏时间长!首屏时间长! 看一下QQ TAOBAO的国内性能指数 http://www.networkbench.com/?_m=ranklist_v3
评测网站性能指标NO.1 首屏时间:指网站在浏览器第一屏区域被充满所需时间,反映了用户在打开网站第一时间的感觉性能。 通常一个网站,如果首屏时间在5秒以内是比较优秀的,10秒以内是可以接受的,10秒以上就不可容忍了。超过10秒的首屏时间用户会选择刷新页面或立刻离开。
首屏时间影响因素 a. 页面落在首屏部分的页面结构,包括页面内容大小、图片大小、JS外链文件及CSS外链文件、调用第三方内容、层次结构等都会直接影响首屏时间。 b. 网络因素,评定的指标有:DNS解析时间,建立连接时间,SSL握手时间,发出请求时间,重定向时间,第一个包时间,剩余包时间,内容下载时间。 c. 其他因素,比如Javascript脚本运行时间。
我们优化的目标:减少首屏时间 那么,怎么分析造成首屏时间过长的具体原因呢?
发现影响首屏时间的相关问题  HTTP数据包嗅探 记录HTTP请求形成的瀑布图 分析HTTP请求间的顺序 分析单个请求的内容和时间线 (域名解析,建立连接,发送请求,等待响应,接收数据) 单机工具: HTTPWatch      Firebug 联网工具:  www.webpagetest.org
分析HTTP瀑布图 单个域名HTTP1.1请求并发数 IE6,7 为2个,IE8 为6个, Firefox 3+为6个 分析工具: WebPagetest IE7 分析案例   tuan.360.cn  game.360.cn/?/ge/ hao.360.cn
Tuan.360.cn (chicago IE7 DSL) http://www.webpagetest.org/result/110303_5T_34S0/1/details/ 1 IE7同一个域名最多2个并发请求 2 do.min.js的执行阻塞其他下载 3 Jquery的并行请求不阻塞其他下载 4 页面请求没有Keep-live
game.360.cn/?/ge/ (chicago IE7 DSL) http://www.webpagetest.org/result/110303_AV_34V9/
Hao.360.cn (chicago IE7 DSL) http://www.webpagetest.org/result/110303_06_34WK/ 1 页面请求有KEEP-ALIVE
当我们无法改变用户的网络环境时 DNS lookup 域名解析耗时 加强DNS服务器的规划与部署 建立连接 WEB服务的规划与部署,使用CDN,开启keep-alive 等待响应 减小服务端执行耗时,使用chunked 发送请求   接收数据 这个和用户所在的网络环境极其相关 在HTTP响应头及内容中做优化工作
为了让浏览器尽早渲染的一些经验 减少<head>内的CSS的请求,1个最佳 生产环境的CSS避免使用@import 首屏的页面结构不要过于复杂,CSS不要使用expression,selector注意优化 首屏中避免JS的请求 延迟首屏交互代码的执行 服务端进行请求可缓存的相关设置 服务端启用GZIP压缩 避免使用IFRAME
更深入的改进点 静态文件放置在CDN  静态文件采用独立域名,cookie-free Domain     img.qihoo.com  s.qhimg.com 图像优化 (大题目) 信息量的大页面使用 chunked 公司级的缓存策略(需要代码级公用) 结构的表现采用平稳过渡,即使背景图片没有下载完成,依然可以有配色区分内容。
讨论时间  下次优化分享:图像优化
Thanks All irideas@gmail.com 2011.3.3

Weitere ähnliche Inhalte

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

网站优化-首屏时间