• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

concurrent visitors max cpu multiple php-cgi

jay em

New Pleskian
Hi everybody

I am running Plesk 12.0.18 on Centos 6.4

I have noticed that the CPU on my VPS maxes out. This occurs when there are many concurrent visitors to any of the 7 domains. 6 of the domains run Wordpress and 1 runs php-bb forum. When I run top during high cpu I see multiple "php-cgi":

32664 xxxx 30 10 211m 38m 8228 S 21.0 0.9 0:03.70 php-cgi
32675 xxxx 30 10 209m 38m 7992 S 25.8 0.9 0:02.08 php-cgi
30809 apache 30 10 422m 98m 2492 S 8.8 2.2 0:18.07 httpd

Looking at the process

PID TTY STAT TIME COMMAND
32664 ? SN 0:01 /usr/bin/php-cgi -c /var/www/vhosts/system/websitex.com/etc/php.ini

The net result is CPU hits 100% and visitors are greeted with Service Unavailable ...

I would like some advice to troubleshoot this. I currently think the problem is related to nginx, apache or php version or settings. Is there any optimisation I can do?

Output from /usr/local/psa/bin/php_handler --list
id: display name: full version: version: type: cgi-bin: php-cli: php.ini: custom:
cgi 5.3.3 5.3.3 5.3 cgi /usr/bin/php-cgi /etc/php.ini false
fastcgi 5.3.3 5.3.3 5.3 fastcgi /usr/bin/php-cgi /etc/php.ini false
module 5.3.3 5.3.3 5.3 module /usr/bin/php-cgi /etc/php.ini false

many thanks for reading

Jay
 
First, why are you using php-cgi? The recommended option would be php-fastcgi.

Secondly, check your access logs and error logs. If you see a lot of attempts to access the WP login page then what's happening is that you are effectively under a brute-force attack which can suck your resources dry. Using Fail2Ban or ASL or WordFence or some other security measure can help here.
Similarly, if you see lots of attempts to access any particular file then you may need to take action.

Using nginx with a Wordpress site is probably a very good idea. You need to take certain precautions -- nginx does not support .htaccess directly. There are many, many pages on the internet that discuss this, and I'm afraid I've not really got to the bottom it the best solution myself. Maybe someone else will add some detail.
 
Thanks Faris.
How do I switch to php-fastcgi?
Sorry if it's obvious - my google and general searches aren't getting results relevant to Plesk. I don't want to break stuff or introduce new errors.
 
Back
Top