How to analyze the reasons why the php-cgi process consumes too much cpu resources and loads

Source: Internet
Author: User
In this environment, php-cgi runs very stably, but it also encounters a slow server response because php-cgi occupies too many cpu resources.

Server environment: redhat linux 5.5, nginx, phpfastcgi

In this environment, php-cgi generally runs very stably, but it has encountered that php-cgi occupies too many cpu resources, resulting in slow server response, the reasons why the php-cgi process occupies too many cpu resources are as follows:

  1. Some php extensions have problems with php version compatibility: Practice has proved that eAccelerater is compatible with some php versions. the specific manifestation is that after the php-cgi process is started, it runs for more than 10 minutes, which is extremely slow, however, static resources are accessed quickly, and the server load is normal (indicating that nginx is not a problem, but the php-cgi process is a problem). The solution is from php. disable the eAccelerater module in ini and restart the php-cgi process.
  2. There may be an endless loop in the program, resulting in extremely high server load (using the top command to view load up to 100 +), you need to use the Linux proc virtual file system to find the specific problem program.
  3. The php program improperly uses the session, which occurs in the open-source Weibo notebook dog program. the actual performance is that there are a small number of php-cgi processes (no more than 10) with a cpu usage rate of more than 98%, the server load is between 4-8. to solve this problem, you still need to use the Linux proc file system to find out the cause.
  4. There are too many time-consuming and impossible operations (or program problems) in the program ).
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.