昨天写的Google Analytics事件跟踪功能中提到了用事件跟踪来分析网站的下载速度。有读者用了,跟我反应说得到的数据不太准确。我仔细看了一下,发现确实如此。今天跟大家分享一下网站下载速度方面的东西。
首先,看一下通过GA统计得到的我的SEO分享博客的下载速度。
大概为1.3秒的时间。然后再看一下我在自己电脑上分析的博客的下载速度。
大概为4.7秒。发现问题了吧!GA统计的与实际的下载速度确实有很大的差距。是什么原因造成了如此大的误差呢?进一步分析。
从上一篇博文里知道,GA的统计代码是加在<body>的开始和</body>的前面的。这说明,GA统计的时间只能是这两者之间的时间了。所以,两者的数据会有差别。GA统计的,是上图中两红线之间的时间。但进一步想想,我们网站的加载时间除了花费在<body>和</body>之间,还花费在什么地方了呢?看上图的第一条,2.436秒的时间,占了整个网页下载时间的一半,这些时间都用来做什么了呢?看下图:
The Blocked time includes any pre-processing time (such as cache lookup) and the time spent waiting for a network connection to become available. Internet Explorer will only create a maximum of two concurrent network connections per host name (i.e. www.microsoft.com) and will queue up requests until a network connection is available. Often the Blocked time is the most significant factor in the download time of images embedded in a web page.
DNS Lookup is the time required to resolve a host name (e.g. www.google.com) into a numeric IP address (e.g. 216.239.59.99).
Connect is the time required to create a TCP connection to the web server (or proxy). If a secure HTTPS connection is being used this time includes the SSL handshake process. Keep-Alive connections are often used to avoid the overhead of repeatedly connecting to the web server.
Send is the time required to send the HTTP request message to the server and will depend on the amount of data that is sent to the server. For example, long Send times will result from uploading files using an HTTP POST
Wait is the idle time spent waiting for a response message from the server. This value includes delays introduced due to network latency and the time required to process the request on the web server.
Receive is the time taken to read the response message from the server. This value will depend on the size of the content returned, network bandwidth and whether HTTP compression was used.
TTFB (or Time To First Byte) is the duration from the initial network request being initiated by the browser to the first byte being received from the server. It includes TCP connection time, the time to send the request and the time taken to get the first byte of the response message.
Network is the total duration of all network related operations for an HTTP request.
由于时间关系,我就不翻译了,有兴趣的自己读一下,没兴趣知道大概就可以了。明天我主持我们公司的电子商务论坛,的准备一下,今天就不细说了。有问题可以给我留言。