High “Receiving Time” for HTTP Responses below 500 bytes in Chrome Devtools

China☆狼群 提交于 2019-12-06 04:45:03

问题


While using devtools Network tab on Chrome 15 (stable) on Windows 7 and Windows XP, I am seeing cases where "receiving" time for an HTTP response is >100ms but the response is a 302 redirects or small image (beacons) - with a payload below 500 bytes (header+content).

Capturing the TCP traffic on Wireshark clearly shows the server sent the entire HTTP response in a single TCP packet, so receiving time should have been 0. A good example is CNN homepage, or any major website that has a lot of ads and tracking beacons.

This brings up a couple of questions:

  1. What is defined as "receiving" in chrome devtools? is this the time from 1st packet to last packet?
  2. What factors in the client machine/operating systems impact "receiving" time, outside of the network/server communication?

In my tests I used a virtual machine for Windows XP, while Windows 7 was on a desktop (quad core, 8gb ram).


回答1:


  1. The "receiving time" is the time between the didReceiveResponse ("Response headers received") and didReceiveData ("A chunk of response data received") WebURLLoaderClient events reported by the network layer, so some internal processing overhead may apply.
  2. In a general case, keep in mind that the HTTP protocol is stream-oriented, so the division of data between TCP packets is not predictable (half of your headers may get into one packet, the rest and the response body may get into the next one, though this does not seem to be your case.)
  3. Whenever possible, use the latest version of Chrome available. It is likely to contain less errors, including the network layer :-)



回答2:


The Nagle Algorithm and the Delayed ACK Algorithm are two congestion control algorithms that are enabled by default on Windows machines. These will introduce delays in the traffic of small payloads in an attempt to reduce some of the chattiness of TCP/IP.

Delayed ACK will cause ~200ms of additional "Receiving" time in Chrome's network tab when receiving small payloads. Here is a webpage explaining the algorithms and how to disable them on Windows: http://smallvoid.com/article/winnt-nagle-algorithm.html



来源:https://stackoverflow.com/questions/8475445/high-receiving-time-for-http-responses-below-500-bytes-in-chrome-devtools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!