My web server is slow

Issues related to configuring your network
Post Reply
hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

My web server is slow

Post by hack3rcon » 2023/09/14 11:35:07

Hello,
My server has 6 GM RAM and 4 virtual CPUs. This server hosts a WordPress website. I checked some parts of the server as follows:

Code: Select all

# free
              total        used        free      shared  buff/cache   available
Mem:        5924976     1726272     2069744      353176     2128960     3547828
Swap:       2097148           0     2097148
And:

Code: Select all

# df -ih
Filesystem              Inodes IUsed IFree IUse% Mounted on
devtmpfs                  721K   378  721K    1% /dev
tmpfs                     724K     1  724K    1% /dev/shm
tmpfs                     724K  1.5K  722K    1% /run
tmpfs                     724K    16  724K    1% /sys/fs/cgroup
/dev/mapper/centos-root    16M  952K   15M    7% /
/dev/sda2                  64K    53   64K    1% /boot
/dev/sda1                    0     0     0     - /boot/efi
/dev/loop0                256K    27  256K    1% /tmp
tmpfs                     724K     1  724K    1% /run/user/0
And:

Code: Select all

# iostat -x 5
Linux 3.10.0-1160.88.1.el7.x86_64 (MyServer.CloudServer.com)     09/13/2023     _x86_64_    (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          15.54    0.04    5.15    0.34    0.00   78.93

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.15     7.17    7.37    6.26   113.33   492.67    88.92     0.34   24.72   23.86   25.73   0.83   1.13
dm-0              0.00     0.00    7.05   12.54   111.32   489.09    61.29     0.36   18.18   33.61    9.51   0.58   1.13
dm-1              0.00     0.00    0.48    0.89     1.94     3.55     8.02     2.66 1937.14   53.13 2960.46   1.51   0.21
And:

Code: Select all

# mpstat -P ALL 5
Linux 3.10.0-1160.88.1.el7.x86_64 (MyServer.CloudServer.com)     09/13/2023     _x86_64_    (4 CPU)

02:46:44 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
02:46:49 PM  all    2.42    0.00    1.56    0.05    0.00    0.10    0.00    0.00    0.00   95.87
02:46:49 PM    0    1.61    0.00    2.21    0.00    0.00    0.00    0.00    0.00    0.00   96.18
02:46:49 PM    1    7.23    0.00    3.41    0.00    0.00    0.20    0.00    0.00    0.00   89.16
02:46:49 PM    2    0.20    0.00    0.20    0.00    0.00    0.20    0.00    0.00    0.00   99.39
02:46:49 PM    3    0.40    0.00    0.60    0.20    0.00    0.00    0.00    0.00    0.00   98.80
And:

Code: Select all

# iostat -xd -k 2 5 or iostat -p
Linux 3.10.0-1160.88.1.el7.x86_64 (MyServer.CloudServer.com)     09/13/2023     _x86_64_    (4 CPU)

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.15     7.17    7.37    6.26   113.31   492.59    88.91     0.34   24.72   23.86   25.73   0.83   1.13
sda1              0.00     0.00    0.00    0.00     0.01     0.00    31.68     0.00    0.77    0.65    2.60   0.51   0.00
sda2              0.00     0.00    0.00    0.00     0.05     0.04   182.07     0.00    7.87    8.52    5.77   5.69   0.00
sda3              0.13     6.76    0.99    2.94    23.29    56.14    40.42     0.16   40.14   45.31   38.39   1.27   0.50
sda4              0.02     0.39    6.05    2.06    73.87    88.20    39.97     0.10   12.65   13.23   10.95   0.97   0.79
sda5              0.00     0.01    0.32    1.27    16.08   348.21   459.38     0.08   48.23  159.59   20.33   2.13   0.34
scd0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-0              0.00     0.00    7.05   12.54   111.30   489.00    61.28     0.36   18.18   33.61    9.51   0.58   1.13
dm-1              0.00     0.00    0.48    0.89     1.94     3.55     8.02     2.66 1937.14   53.13 2960.46   1.51   0.21
loop0             0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
And:

Code: Select all

# pidstat 5
Linux 3.10.0-1160.88.1.el7.x86_64 (MyServer.CloudServer.com)     09/13/2023     _x86_64_    (4 CPU)

02:49:31 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
02:49:36 PM     0         9    0.00    0.80    0.00    0.80     2  rcu_sched
02:49:36 PM    99     30344    0.40    0.40    0.00    0.80     0  httpd
02:49:36 PM     0     33184    0.20    0.60    0.00    0.80     3  pidstat
02:49:36 PM     0     64839    0.20    0.20    0.00    0.40     3  cspfwd
02:49:36 PM    27     69539    3.78   14.74    0.00   18.53     2  mysqld
02:49:36 PM     0    120682    1.20    0.20    0.00    1.39     1  python3
02:49:36 PM     0    121404    0.00    0.20    0.00    0.20     2  imunify360-php-
02:49:36 PM     0    121464    0.00    0.20    0.00    0.20     2  imunify-auditd-
02:49:36 PM     0    121574    0.20    0.60    0.00    0.80     3  imunify360-unif
02:49:36 PM     0    126016    0.00    0.20    0.00    0.20     2  kworker/2:0
And:

Code: Select all

# ps -e -o pcpu,nice,state,cputime,args --sort -pcpu | head -10
%CPU  NI S TIME     COMMAND
12.7   0 S 11:50:13 /usr/sbin/mysqld
 1.4   0 S 00:01:46 /usr/sbin/imunify360-unified-access-logger
 1.2   0 S 00:01:38 /opt/imunify360/venv/bin/python3 -m im360.run
 0.7   0 S 00:15:22 /usr/sbin/pam_imunify_daemon.bin
 0.6   0 S 01:41:24 [rcu_sched]
 0.3   0 S 00:00:01 /usr/sbin/httpd -k start
 0.3   0 S 00:00:25 /usr/sbin/imunify-realtime-av
 0.2   0 S 00:00:01 /usr/sbin/httpd -k start
 0.1   0 S 00:15:11 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
The MySQL configuration is:

Code: Select all

[mysqld]
performance_schema           = 0
show_compatibility_56        = 1
datadir                      = /var/lib/mysql
socket                       = /var/lib/mysql/mysql.sock
slow-query_log_file          = /var/log/mysql-slow.log
log-error                    = /var/log/mysqld.log
max_allowed_packet=268435456
default_storage_engine         = InnoDB
max_connections                = 151
max_user_connections           = 50
thread_cache_size              = 151
query_cache_type               = 1
query_cache_size               = 64M
sort_buffer_size               = 2M
tmp_table_size                 = 32M
read_buffer_size               = 128k
read_rnd_buffer_size           = 256k
join_buffer_size               = 128k
table_definition_cache         = 400
table_open_cache               = 400


slow_query_log_file            = slow.log
slow_query_log                 = 0
log_queries_not_using_indexes  = 1
long_query_time                = 0.5
min_examined_row_limit         = 100

max_heap_table_size            = 64M

innodb_buffer_pool_size        = 10M
innodb_file_per_table          = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size         = 8M
innodb_log_file_size           = 100M

log_bin
expire_logs_days               = 7
And the important part of Apache is as follows:

Code: Select all

Timeout 45
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule mpm_prefork_module>
StartServers        3
MinSpareServers     3
MaxSpareServers     3
ServerLimit         50
MaxClients          50
MaxRequestsPerChild 1000
</IfModule>

<IfModule mpm_worker_module>
StartServers        3
MaxClients          50
MinSpareThreads     3
MaxSpareThreads     3 
ThreadsPerChild     25
MaxRequestsPerChild 1000
</IfModule>
It is not only the website that is slow, but also the system itself. MySQL seems to use more memory and CPU than other processes. What other parts should I check?

Thank you.

Post Reply