Server environment: Redhat Linux 5.5, Nginx, phpfastcgi
In this environment, the general php-cgi run is very stable, but also encountered php-cgi take up too much CPU resources and cause the server response is too slow, encountered php-cgi process too much CPU resources are due to:
Some PHP extensions are compatible with the PHP version of the problem: Practice has proved that eaccelerater with some version of PHP compatibility problems, the specific performance is to start the php-cgi process, run more than 10 minutes, very slow, but static resources access quickly, the server load is also very normal ( Explain Nginx no problem, but the php-cgi process of the problem), the solution is to ban the Eaccelerater module from the php.ini, and then restart the php-cgi process.
There may be a dead loop in the program, causing the server to be overloaded (using the top command to see the load up to 100+) and need to use the Linux proc virtual file system to find specific problem programs.
PHP program unreasonable use of session, this occurs in the open source micro-blog Diary Dog program, the specific performance is a small number of php-cgi process (not more than 10) CPU utilization up to 98%, server load between 4-8, the problem of resolution, Still need to use the Linux proc file system to find out why.
There is an overly time-consuming and impossible operation in the program (or a problem with the program).