Say you have a single server file, e.g. server.js, that sits in a host.
The file is written to serve http GET and POST requests. When you are developing this server file in your localhost, you generate a GET request to test this server.
It works, the server receives the request and send something back. But what if this server file sits on a public host. What happens when multiple clients post a GET request to the server?
As far as the server.js file is concerned, it only knows that when it receives a request, it sends a reply. It doesn't care/know who sends the request and whether the reply is sent to the right client and etc. How is multiple concurrent requests dealt in real life?
- Is a copy of
server.jscreated for each of the requesting clients to avoid request collisions? - or is other techniques used?
- What determines the maximum number of concurrent requests a server can handle?
Can anyone explain this clearly please. Thanks..