Ask a question yo don't know how the title should be taken

Source: Internet
Author: User
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

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.