最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - "transferred over network" size larger than resource size - Stack Overflow

programmeradmin3浏览0评论

I am using XMLHttpRequest to read the json file and find that "transferred over network" is significantly larger than the resource size.

xmlhttp.open("GET", "resources.json", true);

While others have resource size equal to or larger than "transferred over network". What happened to it? Should I be worried about this?

I am using XMLHttpRequest to read the json file and find that "transferred over network" is significantly larger than the resource size.

xmlhttp.open("GET", "resources.json", true);

While others have resource size equal to or larger than "transferred over network". What happened to it? Should I be worried about this?

Share Improve this question asked Jun 3, 2020 at 23:51 MidoMido 3502 silver badges15 bronze badges 1
  • 2 For such small sizes, there is also significant HTTP [header] overhead. This overhead is not part of the resource. – user2864740 Commented Jun 4, 2020 at 0:05
Add a ment  | 

2 Answers 2

Reset to default 10

Transfered is the total amount of bytes traveled in both directions, while resource size is the size of received response body.

A HTTP request is posite of url, request headers, request body, response headers and response body.

See a sample message of a HTTP request:

POST / HTTP/1.1
Host: foo.
Content-Type: application/x-www-form-urlencoded
Content-Length: 13

say=Hi&to=Mom

Note that the content length header is only 13 bytes (only the say=Hi&to=Mom size),while this entire HTTP message contains 111 bytes.

For more details see the message format section at https://en.m.wikipedia/wiki/Hypertext_Transfer_Protocol

"Transferred" is the sum of the bytes for the total sent and received data in the displayed requests.

"Resource size" is the sum of the bytes for the received data, that's why they don't match.

Consider this example:

See how the Resources matches with the sum of received bytes for each request.

发布评论

评论列表(0)

  1. 暂无评论