0

Is it possible for web servers, when dealing with a single machine, to process and respond to multiple requests to the same domain asynchronously? The requests are done with Javascript.

How do servers even work in such a case? Does it process and send a single request at a time? For example, if I wanted to load five different pages from a web server at the same time, does page 2 have to wait until page 1 is done loading on my machine? Or can page 1 and 2 be loaded at the same time?

Thanks.

dapirate7
  • 47
  • 7
  • Session locking may prevent a server from handling multiple pages at once (for the same _session_). Scripts will block and wait for the session resource to become available. http://konrness.com/php5/how-to-prevent-blocking-php-requests/ There is nothing inherently in the network stack that wouldn't allow this. – Halcyon Aug 20 '14 at 15:19

1 Answers1

0

The server can, if the client opens multiple connections to the server and makes simultaneous requests on those different connections.

If the client doesn't open multiple connections then the server can't really do this due to the sequential request/response nature of HTTP.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • How would I open multiple connections to the server on a single machine? – dapirate7 Aug 20 '14 at 15:22
  • @dapirate7 From JavaScript I don't know that there is a way you can request this explicitly; usually browsers will allow only up to some number of parallel connections to the same domain. This behavior is automatic and out of your control. – cdhowie Aug 20 '14 at 15:24
  • Thanks cdhowie. That was very helpful. Any way to know how many parallel connections are allowed for a single domain? – dapirate7 Aug 20 '14 at 15:59
  • @dapirate7 [It depends on the browser](http://stackoverflow.com/q/985431/501250). – cdhowie Aug 20 '14 at 16:04