网页延迟分析
一。工具
chrome插件:page speed insight 自動分析插件
2.chrome工具:chrome > more tool >檢測設備> inspect(需要代理)> network
3.優化建議:http://bystep.duapp.com/drip/yahoo35.html#/
m.babytree.com/ask
4.chrome官方說明:https://developer.chrome.com/devtools/docs/network#resource-network-timing
二。說明
1.DNS lookup:域名解析時間
DNS(Domain Name System,域名系統),因特網上作為域名和IP地址相互映射的一個分布式數據庫,能夠使用戶更方便的訪問互聯網,而不用去記住能夠被機器直接讀取的IP數串。通過主機名,最終得到該主機名對應的IP地址的過程叫做域名解析(或主機名解析)。
2.stalled
Stalled是瀏覽器得到要發出這個請求的指令,到請求可以發出的等待時間,一般是代理協商、以及等待可復用的TCP連接釋放的時間,不包括DNS查詢、建立TCP連接等時間等
3.request sent
Request sent?請求第一個字節發出前到最后一個字節發出后的時間,也就是上傳時間
4.waiting
Waiting?請求發出后,到收到響應的第一個字節所花費的時間(Time To First Byte)
Stalled/Blocking
Time the request spent waiting before it could be sent. This time is
inclusive of any time spent in proxy negotiation. Additionally, this?time will include when the browser is waiting for an already
established connection to become available for re-use, obeying?Chrome's maximum six TCP connection per origin rule.
Proxy Negotiation
Time spent negotiating with a proxy server connection.
DNS Lookup
Time spent performing the DNS lookup. Every new domain on a page
requires a full roundtrip to do the DNS lookup.
Initial Connection / Connecting
Time it took to establish a connection, including TCP
handshakes/retries and negotiating a SSL.
TCP:當應用層向TCP層發送用于網間傳輸的、用8位字節表示的數據流,TCP則把數據流分割成適當長度的報文段,最大傳輸段大小(MSS)通常受該計算機連接的網絡的數據鏈路層的最大傳送單元(MTU)限制。之后TCP把數據包傳給IP層,由它來通過網絡將包傳送給接收端實體的TCP層。
TCP為了保證報文傳輸的可靠[1]?,就給每個包一個序號,同時序號也保證了傳送到接收端實體的包的按序接收。然后接收端實體對已成功收到的字節發回一個相應的確認(ACK);如果發送端實體在合理的往返時延(RTT)內未收到確認,那么對應的數據(假設丟失了)將會被重傳。
在數據正確性與合法性上,TCP用一個校驗和函數來檢驗數據是否有錯誤,在發送和接收時都要計算校驗和;同時可以使用md5認證對數據進行加密。
在保證可靠性上,采用超時重傳和捎帶確認機制。
在流量控制上,采用滑動窗口協議,協議中規定,對于窗口內未經確認的分組需要重傳。
在擁塞控制上,采用廣受好評的TCP擁塞控制算法(也稱AIMD算法)。該算法主要包括三個主要部分:1)加性增、乘性減;2)慢啟動;3)對超時事件做出反應。
Secure Socket Layer:為Netscape所研發,用以保障在Internet上數據傳輸之安全,利用數據加密(Encryption)技術,可確保數據在網絡上之傳輸過程中不會被截取及竊聽。一般通用之規格為40 bit之安全標準,美國則已推出128 bit之更高安全標準,但限制出境。只要3.0版本以上之I.E.或Netscape瀏覽器即可支持SSL。
當前版本為3.0。它已被廣泛地用于Web瀏覽器與服務器之間的身份認證和加密數據傳輸。
SSL協議位于TCP/IP協議與各種應用層協議之間,為數據通訊提供安全支持。SSL協議可分為兩層: SSL記錄協議(SSL Record Protocol):它建立在可靠的傳輸協議(如TCP)之上,為高層協議提供數據封裝、壓縮、加密等基本功能的支持。 SSL握手協議(SSL Handshake Protocol):它建立在SSL記錄協議之上,用于在實際的數據傳輸開始前,通訊雙方進行身份認證、協商加密算法、交換加密密鑰等。
SSL
Time spent completing a SSL handshake.
Request Sent / Sending
Time spent issuing the network request. Typically a fraction of a
millisecond.
Waiting (TTFB)
Time spent waiting for the initial response, also known as the Time To
First Byte. This time captures the latency of a round trip to the?server in addition to the time spent waiting for the server to deliver
the response.
Content Download / Downloading
Time spent receiving the response data.
The waterfall indicates when the the?DOMContentLoadedand?load?events were fired with blue and red vertical lines, respectively. The?DOMContentLoaded?event is fired when the main document had been loaded and parsed. The?load?event is fired when all of the page's resources have been downloaded.
The waterfall view in the Network panel graphs the time it took to load each resource, from the start of the HTTP request to the receipt of the final byte of the response. Each resource loading time is represented as a bar, color-coded according to the resource type. The length of the lighter-shaded part of each bar represents the request's latency, while the length of the darker-shaded part represents the time spent receiving the?
The waterfall view in the Network panel graphs the time it took to load each resource, from the start of the HTTP request to the receipt of the final byte of the response. Each resource loading time is represented as a bar, color-coded according to the resource type. The length of the lighter-shaded part of each bar represents the request's latency, while the length of the darker-shaded part represents the time spent receiving the?
三。建議
減少HTTP請求
合并圖片,js,css(如果不沖突)
減少dns查詢時間
dns的時間遠大于下載時間。
waiting是等待服務器的時間。
轉載于:https://blog.51cto.com/bysowhat/1607044
總結
- 上一篇: 基于Cocos2dx开发卡牌游戏Demo
- 下一篇: 总结 XSS 与 CSRF 两种跨站攻击