The server, depending on its configuration, can generally serve hundreds of requests at the same time -- if using Apache, the MaxClients
configuration option is the one saying :
The MaxClients
directive sets the
limit on the number of simultaneous
requests that will be served.
Any
connection attempts over the
MaxClients
limit will normally be
queued, up to a number based on the
ListenBacklog directive.
Once a child
process is freed at the end of a
different request, the connection will
then be serviced.
The fact that two clients request the same page is not a problem.
So :
Will the requests be queued?
No ; except if :
- there is some lock somewhere -- which can happen, for instance, if the two requests come from the same client, and you are using file-based sessions in PHP : while a script is being executed, the session is "locked", which means the server/client will have to wait until the first request is finished (and the file unlocked) to be able to use the file to open the session for the second user.
- the requests come from the same client AND the same browser; most browsers will queue the requests in this case, even when there is nothing server-side producing this behaviour.
- there are more than
MaxClients
currently active processes -- see the quote from Apache's manual just before.
Will they be ignored?
No : this would mean only one user can use a website at the same time ; this would not be quite nice, would it ?
If it was the case, I could not post this answer, if you where hitting F5 at the same moment to see if someone answered !
(Well, SO is not in PHP, but the principles are the same)
Any other possibility?
Yes ^^
edit after you edited the OP and the comment :
Will each request have its own script
instance?
There is no such thing as "script instance" : put simply, what's happening where a request to a script is made is :
- the webserver forks another process to handle the request (often, for performance reasons, those forks are made in advance, but this changes nothing)
- the process reads the PHP script from disk
- several processes can do this at the same time : there is no locking on file reading
- the file is loaded into memory ; in a distinct memory block for each process
- the PHP file in memory is "compiled" to opcodes -- still in memory
- those opcodes are executed -- still from the block of memory that belongs to the process answering your request
Really, you can have two users sending a request to the same PHP script (or to distinct PHP scripts that all include the same PHP file) ; that's definitly not a problem, or none of the website I ever worked on would work !