0

I'm running about 450 simple webistes using Wordpress Multisite on a VPS with Debian 10. Here are some data about the resources:

root@hr711523385:~# free -mh
              total        used        free      shared  buff/cache   available
Mem:           57Gi       9,2Gi       1,2Gi       246Mi        47Gi        47Gi
Swap:          16Gi       9,9Gi       7,0Gi

root@hr711523385:~# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       40 bits physical, 48 bits virtual
CPU(s):              16
On-line CPU(s) list: 0-15
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           16
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               61
Model name:          Intel Core Processor (Broadwell, IBRS)
Stepping:            2
CPU MHz:             3000.000
BogoMIPS:            6000.00
Virtualization:      VT-x
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            4096K
L3 cache:            16384K
NUMA node0 CPU(s):   0-15
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ibrs ibpb tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat
root@hr711523385:~# 

I'm using Plesk 18.0.48 to manage the VPS. Since several weeks all my websites become very slow, sometimes I get a 504 nginx error. When I open an SSH terminal everything is slow: typing commands, editing files, downloading remote files (238.00 KiB/s!!)

This is what htop gives: enter image description here Do you see resource issues? RAM and CPU seem OK (to me)! Since the server is only used to run the wordpress network, I think WP is the problem, but I can't find how to begin: is it php-fm? apache? mysqld? ... who is the root of the problem ?

UPDATE

I aked an external sysadmin to dig deeper, he used Telegraf and sent me this : CPU usage Network usage memory usage disk i/o usage - Top : Read, Bottom : Write He said the problem is disk i/o (80 write/s) but he don't still know the reasons ! How can I find what generates so much disk i/o ? I think it's mysqld but I'm not sure (every website generates about 10 UPDATE queries, investigation in progress)

4
  • Check /var/log/apache2/access.log or /var/log/apache2/error.log. Apache2 is at 100%. Perhaps you are getting a massive number of requests coming in.
    – Stewart
    Commented Jan 9, 2023 at 16:19
  • 1
    your mysql's seem very busy too, so it could be an I/O issue -- check your storage and that the databases are running okay also. You could try iotop to check the for I/O bottlenecks too
    – Brad
    Commented Jan 9, 2023 at 21:06
  • @Stewart I thought with a 16 cores CPU it's not really a big problem if a process uses 100% of the cpu ! Sometimes apache2 uses more than 200%
    – Sami
    Commented Jan 10, 2023 at 9:37
  • have you try : chkrootkit, rkhunter or tiger, to detect possible rootkit ?
    – Ben
    Commented Jan 15, 2023 at 5:47

1 Answer 1

1

"450 Simple Websites using Wordpress Multisite": I am certain that the issue arises from PHP-FPM processes overloading the system. The root cause are most often bad bots that are hammering some domains.

  1. Check the web server logs of the domains to find out which one is getting many requests.
  2. Run (as root) ps aux | grep php-fpm to find out which PHP-FPM processes exist, which user owns them and then either take directly from the output which domain they are related to or run (also as root): strace -p <pid> where <pid> is the process id of a process and watch what they are doing (you'll find references to the domain in the output).
  3. Run (as root) watch "ps aux | sort -nrk 3,3 | head -n 20" to watch the 20 load processes to find out, which ones are most cpu hungry.

The 504 results almost certainly results from unresponsive PHP processes, too. Either there are long-running scripts that are caught in never-ending loops or the max_children setting of PHP-FPM is too low so that no new children can be spawned hence Nginx does not get a response from the website.

1
  • also worth noting: if there are a lot of log entries indicating bad bots are the problem, using fail2ban to monitor the apache or nginx logs and block repeat offenders can help a lot with with load problems caused by bots. fail2ban is packaged for debian. And both nginx and apache can also be configured to reject common bad bot requests before the request gets sent to php (won't eliminate the load, but will greatly reduce the impact). Both fail2ban and anti-bot httpd configs will require monitoring and tweaking of rules to adapt to changing attacks.
    – cas
    Commented Jan 30, 2023 at 4:07

You must log in to answer this question.

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