Ask a question yo don't know how the title should be taken
It was the title party.
There is a PHP file on the server, such as 1.php.
When someone requests this file,
This file will be executed and returned to the client after it executes.
My question is,
When a client visits 1.php, this is the server has not finished,
Suddenly the B client also came to visit this is 1.php is waiting for a request to return a request in the execution B, or can execute the request of B at the same time
------Solution--------------------
Execute B's request at the same time
------Solution--------------------
In fact, this involves the problem of the network model.
Do you know why the Nginx is now respected to replace Apache, why the Nginx processing concurrency problem is much stronger than Apache?
Because Apache uses the Select model of the old Linux kernel, Nginx uses the 2.6+ version of the Epool model.
Back to the specific question you're talking about, if a customer comes to the B, the server waits for a client to process the result and then accepts the B request, which is how the Select model works. After receiving the request, the same process will always follow this entire handshake process, knowing that response is over. This model is also vulnerable to DDoS attacks.
The Epool model, however, is asynchronous. After the server receives a request, by a master process responsible for the task of the Rational division of work, there is a distribution of the task of the thread is responsible for the distribution of tasks, the rest of the matter entrusted to other threads to handle, after the other thread processing, will callback the main process can response, and then return to the corresponding client. This way of working, each request does not block each other.
But after this explanation, you might not understand, is it that Apache can't handle concurrent tasks? One request is blocked, and the other requests are not coming in? Of course not, Apache worker mode will open n processes, so-called blocking, will only block a process. But this approach to the Select model is really inefficient.
This part of the knowledge you can refer to Libevent