Articles in this section

Plesk website is slow and CPU and memory usage by Apache or PHP processes is high in Plesk

kb: technical Plesk Obsidian for Linux ABT: Group A

Applicable to:

  • Plesk Obsidian for Linux
  • Plesk Onyx for Linux

Symptoms

  • Website is slow
  • High CPU and memory usage by Apache process is reported by top command:

    # top
    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: 

    # top
    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

Cause

Apache module is used to serve PHP. It is the slowest engine available. 

Resolution

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

1. Enable nginx web server 

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:slowCPU2.png

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:
slowCPU.png

Was this article helpful?

Comments

2 comments
Date Votes
  • Hi - is this tutorial correct. From what I know, you have to "uncheck" proxy mode to use Nginx. You are doing the opposite here.

    0
  • Unsure if this tutorial is accurate. You need to uncheck proxy made to enable Nginx. If you follow this tutorial, you will still be using Apache.

    0

Please sign in to leave a comment.