Do you need the number of HTTP requests to run a web page?

Are all assets (html files, js files, css files, images) in one web page passed through one HTTP request / response or through multiple HTTP requests / responses, one for each asset? Guessed there is no XHR on this webpage.

+2


a source to share


4 answers


Conceptually, each asset is a separate request. In practice, most servers allow the browser to reuse the same physical socket connection for multiple requests (but they are still issued one after the other), and this can significantly improve performance (because you need additional round trips to establish a connection, and subsequent requests may copy to the ACK for the previous request: you cut a lot of rounds).

But yes, there is always one request / response per resource per page.



On high latency connections (e.g. Australia → USA), the number of round trips can be a significant bottleneck, and therefore things like CSS sprites are widely used.

+2


a source


All digital assets in a web document are passed on separate HTTP requests . However, modern web servers and browsers can use the same TCP connection with HTTP keep-alive .



+3


a source


This is one request for each asset, but you can use multiple TCP connections to send multiple HTTP requests in parallel. Virtually all browsers do just that.

0


a source


I would recommend downloading Firebug for Firefox and then looking at its "Net" tab when you browse some sites. He would answer this question and more.

0


a source







All Articles