Javascript-If AJAX is used to frequently request servers, what will PHP do?

Source: Internet
Author: User
For the same interface, the client sends two AJAX requests in a short time. When the first request has not been returned, how does the PHP server handle the second request? For the same interface, the client sends two AJAX requests in a short time.
When the first request has not been returned, how does the PHP server handle the second request?

Reply content:

For the same interface, the client sends two AJAX requests in a short time.
When the first request has not been returned, how does the PHP server handle the second request?

Currently, server programs that support PHP on the market generally run in multi-process mode, that is, there will be multiple PHP processes to process requests at the same time. When a request is still being processed and another request arrives, the request is sent to other processes for processing. Wait in queue until the number of concurrent processes exceeds the configured number of concurrent requests.

Taking PHP-FPM as an example, it is a multi-process FastCGI service embedded with PHP interpreter implemented by C. A worker process can only process one request at a time. Other requests enter the listen. the queue is waiting for processing in the backlog (511 by default) queue. i/O intensive operations with Nginx can be separated to the PHP-FPM specific process pool for operations, computation intensive operation FPM process number can be set to 2 times the number of CPU cores, i/O-intensive resources can be multiple points. therefore, only a small amount of PHP code can achieve high performance. Obviously, many PHP frameworks are contrary to this. This is why the father of PHP does not like the framework, because his original intention of developing PHP is to encapsulate a set of C APIs for convenient Web development, it can be considered that PHP is the Web framework implemented by C.

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.