Ask a question. I don't know how to obtain the title.
Source: Internet
Author: User
Ask a question. I don't know how to obtain the title. at that time, there was a php & nbsp; file & nbsp; for example, 1. php when someone requests this file, this file will be executed & nbsp; and then returned to the client after execution. my problem is that when client a accesses this file, 1. & nbsp; & Q: I don't know how to obtain the title.
Just 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 then returned to the client after execution
My problem is
When client a accesses php, this is not completed by the server,
Suddenly, client B also came to access the service. this is the first. php request. if a is returned, the request of client B is executed, or the request of client B can be executed at the same time.
------ Solution --------------------
Execute B's request simultaneously
------ Solution --------------------
In fact, this involves the network model.
Do you know why nginx is promoted to replace apache now? why is there a much better problem of nginx processing concurrency than apache?
Apache adopts the select Model of the earlier linux kernel version, while nginx adopts the epool model of version 2.6 +.
Back to the specific issue you mentioned, if the server waits for the processing result of customer a to accept the request of Customer B when Customer B visits, this is the way the select model works. After receiving the request, the same process always follow the entire handshake process, knowing that the response is over. This model is also vulnerable to ddos attacks.
The epool model is asynchronous. After the server receives a request, a main process is responsible for the proper division of tasks. a thread responsible for task distribution is only responsible for task distribution, and other tasks are delegated to other threads for processing, after processing is completed by other threads, the main process can be called back and then returned to the corresponding client. In this way, each request is not blocked.
However, after this explanation, you may not understand it. is it hard to say that apache cannot process concurrent tasks? A request is blocked, and other requests cannot be included? Of course not. in apache worker mode, there will be n processes. The so-called blocking will only block one process. However, the select model is very inefficient.
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.