Page 1 of 1

Apache2 slows down the entire server.

Posted: Sat Jun 20, 2020 9:40 am
by html_man
Hello, I have a server on Ubuntu 16.04 from Vesta CP. Lately my server is constantly hanging up because Apache2 is taking over all CPU resources. Rebooting Apache2 from the panel does not help, the problem is temporarily solved only by fully rebooting the server. There are only 4 simple WordPress sites on the server itself, and hardly anyone visits them.

Code: Select all

top - 11:05:11 up 4 days, 18:27,  1 user,  load average: 1.00, 1.01, 1.00
Tasks: 183 total,   2 running, 181 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us,  1.8 sy,  0.0 ni, 97.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  7945548 total,  2864276 free,   707620 used,  4373652 buff/cache
KiB Swap:  1003516 total,  1003516 free,        0 used.  6700672 avail Mem

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
135884 www-data  20   0  162008  11128   1732 R 100.0  0.1 494:50.11 apache2
   351 root      20   0       0      0      0 S   6.7  0.0   0:20.55 jbd2/dm-0+
     1 root      20   0   38168   6260   4052 S   0.0  0.1   0:26.65 systemd
     2 root      20   0       0      0      0 S   0.0  0.0   0:00.11 kthreadd
     3 root      20   0       0      0      0 S   0.0  0.0   0:02.87 ksoftirqd+
     5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0+
     7 root      20   0       0      0      0 S   0.0  0.0   1:23.40 rcu_sched
     8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
     9 root      rt   0       0      0      0 S   0.0  0.0   0:01.77 migration+
    10 root      rt   0       0      0      0 S   0.0  0.0   0:01.88 watchdog/0
    11 root      rt   0       0      0      0 S   0.0  0.0   0:01.82 watchdog/1
    12 root      rt   0       0      0      0 S   0.0  0.0   0:01.82 migration+
    13 root      20   0       0      0      0 S   0.0  0.0   0:02.66 ksoftirqd+
    15 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1+
    16 root      rt   0       0      0      0 S   0.0  0.0   0:01.89 watchdog/2
    17 root      rt   0       0      0      0 S   0.0  0.0   0:01.66 migration+
    18 root      20   0       0      0      0 S   0.0  0.0   0:02.37 ksoftirqd+
    20 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/2+
    21 root      rt   0       0      0      0 S   0.0  0.0   0:01.84 watchdog/3
    22 root      rt   0       0      0      0 S   0.0  0.0   0:01.82 migration+
    23 root      20   0       0      0      0 S   0.0  0.0   0:02.56 ksoftirqd+
    25 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/3+
    26 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kdevtmpfs
    27 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 netns
    28 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 perf
    29 root      20   0       0      0      0 S   0.0  0.0   0:00.22 khungtaskd
    30 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 writeback
    31 root      25   5       0      0      0 S   0.0  0.0   0:00.00 ksmd
    32 root      39  19       0      0      0 S   0.0  0.0   0:02.31 khugepaged
    33 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 crypto
    

Re: Apache2 slows down the entire server.

Posted: Mon Jun 22, 2020 7:23 am
by kolel
Based on your free output, I strongly suspect that your Apache processes are heavily buried in swap. The output of sar -W 1 0 will confirm (or refute) this hypothesis (run it when the machine is running slow). spotify premium
mod
If the Apache processes aren't all actually serving requests (as shown by mod_status) you should tune the number of "spare" children (with MaxSpareServers) so that they get reaped quicker (and hence don't lay around consuming RAM). If you really do need the number of children you're running to service the request load, you'll need more RAM (I'd go with another 1GB straight up; RAM is cheap, diagnosis time isn't).Showbox apk

Re: Apache2 slows down the entire server.

Posted: Tue Jun 23, 2020 3:02 am
by amaisonneuve
any further insights?

I am seeing this daily in the apache error logs

apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
[Sun Jun 21 12:10:06.476659 2020] [core:notice] [pid 1788] AH00060: seg fault or similar nasty error detected in the parent process
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
apache2: ../../../src/util/support/threads.c:380: krb5int_key_delete: Assertion `destructors_set[keynum] == 1' failed.
[Sun Jun 21 12:10:15.511252 2020] [suexec:notice] [pid 22932] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Sun Jun 21 12:10:15.642488 2020] [:notice] [pid 22933] mod_ruid2/0.9.8 enabled
[