Reputation: 1120
For example, i can load the website 10 times consequentially with different pages (stackoverflow.com/questions/a , stackoverflow.com/questions/b , ...). The question is, will it be faster if i will load pages in 10 threads?
Upvotes: 0
Views: 310
Reputation: 21261
The biggest time in loading a webpage is waiting for the HTTP response to come back from the server, and a large amount of that time is taken in setting up the TCP connection.
HTTP has supported the concept of pipelining since version 1.1. This allows multiple requests to be sent along the same TCP connection, and also allows them to be sent before the replies have come back from the previous requests.
So yes, using ten threads could speed up loading ten different pages, but equally one thread could do the same by using asynchronous calls and firing off ten requests before the replies come back.
Upvotes: 1