If your server load is high (server loads that are <= the number of CPU Cores in your server are quite normal), you need to locate the bottleneck and make optimizations targeting it.
Most of the time, high server load is caused by PHP processes and MySQL, not by the LiteSpeed Web Server process itself. No matter how fast LiteSpeed runs, it has no control over how fast a PHP script can run, or how much memory a PHP script will consume. Hence, in general, troubleshooting server load issue is not a matter of LiteSpeed Web Server's configuration, and is beyond our support scope. (Analysis of your DDoS attack is beyond our support scope as well, unless you would like to engage us through paid hourly support.)
In the spirit of helpfulness, however, we are happy to provide the following troubleshooting tips for you to use when investigating high server load.
top
or atop
command to check which processes are using a lot of CPU resources, and then figure out whether they are behaving normally. /dev/shm
. Disk I/O issue example: top -c
iowait 41.6 wa
is too high. then check further
iostat -x Linux 3.10.0-962.3.2.lve1.5.24.10.el7.x86_64 (lbr27.lalunahost.com.br) 04/18/2019 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 6.65 0.15 2.16 20.24 0.00 70.80 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sdb 0.16 7.43 16.61 1.80 74.74 78.56 16.65 2.46 133.39 8.38 1284.98 1.45 2.68 sda 28.25 134.39 93.98 54.24 1445.73 1227.69 36.07 2.11 14.18 46.67 79.17 4.86 72.08
/dev/sda
has problem with 72.08%util
, /dev/sdb
is ok.
In Use
, Idle
, and WaitQ
. For shared hosting, if one user uses too many PHP processes while others only use a few, you may adjust PHP max concurrency setting to be a smaller number. See our PHP Concurrency wiki for more information on determining if PHP SuEXEC is used and how to reduce the max concurrency of PHP. netstat -na | grep 80 | grep ESTA
. netstat -ntu | grep ESTABLISHED | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
. time_waits
as well by running the command without grep ESTABLISHED
, which is netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
. It is useful in some special situations (i.e., an attacker could make a connection and then send requests to an expensive URL, wait a little while, and then close the connection. If the server does not abort the process, the backend will be used up soon and keep serving a request that has been abandoned. Hence, you wait to analyze IP even with time_waits
). mysqladmin
and processlist
. If you have spare RAM, trying to raise database cache pool/buffer may help. No web server configuration change can help such situations and they are beyond our support scope. You can even use strace
to track your PHP processes: strace -tt -T -p <pid_of_a_php_process>
top - 15:28:56 up 1 day, 17:58, 3 users, load average: 187.42, 143.52, 109.09 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 25713 mysql 20 0 15.3g 784m 9.9m S 197.1 0.9 29:13.90 /usr/sbin/mysqld --basedir=/usr -- datadir=/var/lib/mysql --plugin- 30260 roan24pl 20 0 302m 103m 12m R 34.4 0.1 1:37.47 lsphp:/home/roan24pl/public_html/index.php 30448 roan24pl 20 0 302m 103m 12m R 26.0 0.1 1:09.17 lsphp:/home/roan24pl/public_html/index.php 30217 roan24pl 20 0 302m 102m 12m R 25.0 0.1 1:27.36 lsphp:/home/roan24pl/public_html/index.php 28755 roan24pl 20 0 291m 92m 12m R 24.0 0.1 6:52.65 lsphp:/home/roan24pl/public_html/index.php
Addressing the above may lower your server load. However, your situation may vary greatly. We recommend ordering our LiteSpeed premium support service for a professional review, fine tuning, and installation/enabling of necessary elements to reduce your server load and maximize site performance.