Why are there multiple TCP connections to the server when I open one website page in my Chrome?

前端 未结 1 840
别跟我提以往
别跟我提以往 2021-01-28 23:58

The website is developed in SpringBoot and deployed in Linux server. When I open one website page in Chrome, and I open TCP Viewer, I see that there are multiple TCP connections

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 00:09

    While HTTP/1.0 and HTTP/1.1 support persistent connections where multiple HTTP requests are handled within the same TCP connection, these requests are still handled on after each other within the same connection. If many resources are needed from a site this sequential loading using a single TCP connection would be too slow. Thus parallel loading using multiple TCP connection is done. Since most sites load many resources (main HTML, various CSS, JavaScript, images, fonts...) one sees multiple TCP connections used with most sites.

    With HTTP/2 parallel loading within a single TCP connection is supported. In this case one will usually see only a single TCP connection to a site. Of course, if resources are loaded from multiple sites (i.e. ads, tracking ...) one will also see multiple TCP connections again - but only one per destination if HTTP/2 is used for the specific destination.

    0 讨论(0)
提交回复
热议问题