Symptoms
- A website hosted on a Plesk for Linux server performs slowly: loading takes more time than usual. Or websites fail with HTTP error 504.
- 
Some websites have database connection errors. 
- 
Load Average of the server greatly exceeds CPU cores count: # uptime 
 00:08:20 up 50 days, 21:34, 3 users, load average: 21,67, 21,59, 17,62# grep -c ^processor /proc/cpuinfo 
 1
- 
Most of the CPU power is consumed by PHP: # ps -o pcpu,cmd -e --sort pcpu | tail -n5 
 11.0 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example.com/etc/php.ini
 16.3 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example2.com/etc/php.ini
 17.2 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example3.com/etc/php.ini
 26.1 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example4.com/etc/php.ini
 29.4 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example5.com/etc/php.ini
- 
Following errors can be found in error log of the Apache for subscription, /var/www/vhosts/system/example.com/logs/error_log:mod_fcgid: read data timeout in 45 seconds 
 End of script output before headers: index.phpmod_fcgid: ap_pass_brigade failed in handle_request_ipc function 
- 
Similar errors can be found in the log file /var/log/plesk-roundcube/errors:DB Error: SQLSTATE[08004] [1040] Too many connections in /usr/share/psa-roundcube/program/lib/Roundcube/rcube_db.php on line 173 (POST /?_task=mail&_action=refresh) 
 DB Error: [1205] Lock wait timeout exceeded; try restarting transaction <...>
Cause
There are not enough resources on server, thus new visitors have to wait until CPU can generate a page for them.
This is reflected by high Load Average values, which should rarely exceed CPU cores count.
Resolution
The following options are available:
- Switch PHP to FPM served by nginx
- If WordPress, or Joomla! is used, install and set up third party static page caching plugins, such as JotCache for Joomla! and WP Super Cache for WordPress.
- Enable nginx dynamic cache to decrease calls to the PHP backend: How to enable NGINX (Byte-Range) Caching in Plesk?
- Migrate to a more powerful server, or move some websites to a different server.