1

I have 10 wordpress sites that is joined into a dedicated server. The main problem it gets slower than before. I have no idea why. I am trying to use top

top - 04:05:52 up 123 days,  2:38,  1 user,  load average: 2.08, 2.11, 2.34
Tasks: 915 total,   5 running, 909 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.1 us,  0.6 sy,  5.3 ni, 94.0 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem : 128259.9 total,  40947.6 free,  14620.3 used,  72692.1 buff/cache
MiB Swap:   4096.0 total,   3068.7 free,   1027.2 used. 108475.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                             
2990823 user  30  10  518652 120496  24104 R 100.0   0.1   0:00.52 php-fpm                                             
2990789 user  30  10  604468 239928 132724 R  94.1   0.2   0:06.29 php-fpm                                             
2990816 user  30  10  569976 161748  89012 R  88.2   0.1   0:01.42 php-fpm                                             
2990821 user  30  10  478804  82436  24500 R  88.2   0.1   0:00.96 php-fpm                                             
2990614 user  30  10  610628 211532  98144 S  23.5   0.2   0:03.54 php-fpm                                             
   1981 mysql     20   0 5328392   2.6g  13348 S   5.9   2.1   6935:15 mysqld                                              
2990825 root      20   0   55344   5344   3580 R   5.9   0.0   0:00.02 top                                                 
      1 root      20   0  238960  11528   8288 S   0.0   0.0  96:29.69 systemd                                             
      2 root      20   0       0      0      0 S   0.0   0.0   0:10.52 kthreadd                                            
      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                              
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp    

I have no idea why a wordpress site can be opened for 40 seconds

Here is result of

ps -aux

user 2992194  0.0  0.0 188188 28144 ?        SN   04:09   0:00 /usr/local/apps/apache2/bin/httpd -k graceful
user 2992204 44.2  0.1 604516 239472 ?       SN   04:09   0:11 php-fpm: pool user-user
root     2992244  0.0  0.0      0     0 ?        I    04:09   0:00 [kworker/29:3-mm_percpu_wq]
root     2992245  0.0  0.0 189452  9700 ?        SN   04:09   0:00 php-fpm: pool index
root     2992248  0.0  0.0  44148  3428 ?        S    04:10   0:00 /usr/sbin/CROND -n
root     2992251  0.0  0.0  95596  6588 ?        S    04:10   0:00 /usr/sbin/CROND -n
root     2992252  0.0  0.0  12800  3112 ?        Ss   04:10   0:00 /bin/sh -c /usr/local/emps/bin/php /usr/local/webuzo/cro
root     2992254  0.3  0.0 196032 33104 ?        S    04:10   0:00 /usr/local/emps/bin/php /usr/local/webuzo/crons.php
user 2992257  0.0  0.0  12800  3036 ?        Ss   04:10   0:00 /bin/sh -c cd /home/user/public_html/v2 && php artis
user 2992258  2.1  0.0 500592 67244 ?        S    04:10   0:00 php artisan schedule:run
root     2992262  0.0  0.0      0     0 ?        I    04:10   0:00 [kworker/32:2-mm_percpu_wq]
root     2992406  0.4  0.0 195660 33244 ?        S    04:10   0:00 /usr/local/emps/bin/php -d auto_prepend_file=none -d aut
root     2992414  0.0  0.0  11996  2788 ?        S    04:10   0:00 sh -c /usr/local/emps/bin/php /usr/local/webuzo/cli.php 
root     2992415  3.4  0.0 195836 33992 ?        D    04:10   0:00 /usr/local/emps/bin/php /usr/local/webuzo/cli.php --exim
user 2992420 79.7  0.1 607628 201180 ?       RN   04:10   0:11 php-fpm: pool user-user
user 2992425 89.4  0.1 534164 205828 ?       RN   04:10   0:11 php-fpm: pool user-user
root     2992441  0.2  0.0 121496  8432 ?        Ss   04:10   0:00 sshd: root [priv]
sshd     2992442  0.0  0.0  76724  2920 ?        S    04:10   0:00 sshd: root [net]
user 2992447 89.0  0.0 525656 128952 ?       RN   04:10   0:05 php-fpm: pool user-user
root     2992452  0.0  0.0  52748  3936 pts/1    R+   04:10   0:00 ps -aux
nobody   3275399  0.0  0.0 114496  5968 ?        SN   Jan07   0:05 nginx: cache manager process
nobody   3303798  0.0  0.0 114988  9492 ?        S    Jan07   0:06 nginx: cache manager process
named    3349620  0.0  0.6 5764496 799796 ?      Ssl   2023   8:07 /usr/sbin/named -u named -c /etc/named.conf
root     3420043  0.0  0.0 204652  2864 ?        S<sl  2023  11:39 /sbin/auditd
root     3456246  0.0  0.0  89556  8180 ?        Ss    2023   3:10 /usr/lib/systemd/systemd --user
root     3456248  0.0  0.0 285088  3484 ?        S     2023   0:00 (sd-pam)
root     3474540  0.0  0.0 169048  1200 ?        Ss    2023   1:54 gpg-agent --homedir /var/cache/dnf/remi-modular-6408ecca
root     3474597  0.0  0.0 169048  1304 ?        Ss    2023   1:55 gpg-agent --homedir /var/cache/dnf/remi-safe-ff04689114f
nobody   3832703  0.0  0.0 114660  5364 ?        SN   Jan09   0:04 nginx: cache manager process
root     3853593  0.0  0.0 166376 31076 ?        SNs  Jan09   0:41 /usr/local/apps/apache2/bin/httpd -k graceful

FYI, the site has low traffic, around 5k for all sites.

11
  • 1
    Your server isn't utilizing its resources properly. 94% CPU idle and 40 GB out of 128 GB RAM free. At least give some memory to MySQL.
    – AlexD
    Commented Jan 30 at 10:22
  • Do you mean about this one? innodb_buffer_pool_size? Anyway what is the ideal amount to set if there is 128GB? I am thinking about alocating 40% of RAM Commented Jan 30 at 10:27
  • 2
    Check your database size and set innodb pool size to min(DB size, 50% RAM).
    – AlexD
    Commented Jan 30 at 10:34
  • I checked all the database and accumulate its only ~2GB. The default innodb 1024MB. I thought its already 50% of the size. Commented Jan 30 at 10:38
  • 1
    Set your cache to 4GB then. Doesn't hurt when you have 128GB RAM, and allows for growth. As to why it's slow, you have to profile your scripts and figure out what they spend time on.
    – vidarlo
    Commented Jan 30 at 10:45

1 Answer 1

3

Wordpress is slow. Wordpress + plugins is very slow and probably insecure.

Your biggest win will be to flatten the sites to static files - there are plenty of tools available off the shelf for this.

Failing that, in order:

  1. Remove any wp plugins not CRITICAL for site operation (remove - not disable)
  2. Check you've got sensible limits set in the php-fpm config (pm=dynamic, pm.max_spare_servers > pm.min_spare_servers + ~10% of pm.max_children,pm.max_children set appropriately)
  3. ensure opcache is enabled and properly sized
  4. enable the MySQL slow query log and action what it's telling you (you seem to have plenty of free memory - you might consider upping the innodb buffer pool).
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .