- Plesk Obsidian for Linux
- Plesk Onyx for Linux
- Website is slow
- High CPU and memory usage by Apache process is reported by
2043 example 20 0 0 0 0 S 100.0 70.5 0:05.43 httpd
- High CPU usage by PHP-FPM process is reported by top command:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2089 example 20 0 0 0 0 S 96.8 60.5 0:02.43 php-fpm
Apache module is used to serve PHP. It is the slowest engine available.
The best option is to switch to PHP-FPM served by nginx (it is default handler in Plesk Obsidian).
But Nginx does not support .htaccess rules. Code of some websites may not support FastCGI or PHP-FPM, so:
1. Consult with website developer if PHP-FPM and nginx are supported by the site
2. Based on the developer answer, choose further step:
Switch to FPM by nginx
Log into Plesk and switch to PHP-FPM 7.x by nginx in Domains > example.com > PHP Settings
2. Switch to PHP 7.3 or newer at Domains > example.com > PHP Settings
3. Enable to Nginx for affected domain: open Subscriptions > example.com > Apache & nginx Settings, check option Proxy mode and press OK:
Note: on servers with high load, switch to Event mode at Tools & Settings > Apache Web server > MPM Mode
Switch to FPM or FastCGI by Apache
Log into Plesk and switch websites' PHP engine to FastCGI application served by Apache or to FPM application served by Apache (better option) via the tab Domains > example.com > Hosting Settings:
Be cool if we could narrow down the cluprit/domain in the backend...
Please check the following article:
How to check which domain PHP process consumes CPU resources?
I am familiar with the -c command.
This is not helpful if, for example, I am trying to determine a server crash the night before. Also top jumps around, so it really isnt ideal for troubleshooting in real time either, although it might help narrow it down, you still have to be in a position to SSH into the server as it is happening.
Would be so much easier, and productive, to have these stats and history in the backend, no?
Indeed, in case the error happened a while ago running
top -cmight not help.
However, there is also atop, which can run as a daemon, logging all activity in the background and allowing for auditing and extracting reports from captured data. You may install, configure and use it as described here: How to monitor usage of system resources in a period of time using atop?
Reading the instructions under "Switch to FPM by Nginx", I don't see a step that states to change "run PHP as:" to "FPM application served by Nginx". Should that step be listed in there or is "run PHP as:" supposed to stay as "FPM application served by Apache"?
Please sign in to leave a comment.