I
I
Ivan Ivanov2017-02-28 22:12:08
Apache HTTP Server
Ivan Ivanov, 2017-02-28 22:12:08

What to do with a high load average load in top?

Actually here is the output of top

top - 22:06:33 up 65 days, 14:21,  1 user,  load average: 6.84, 5.39, 4.76
Tasks: 188 total,   3 running, 185 sleeping,   0 stopped,   0 zombie
%Cpu(s): 20.2 us, 16.1 sy,  0.0 ni, 58.8 id,  4.6 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem:  16440588 total, 16280916 used,   159672 free,    54176 buffers
KiB Swap:  7810044 total,   791412 used,  7018632 free.  2274048 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 8178 www-data  20   0  485256  37456  25008 S  30.6  0.2   0:07.88 apache2
 8454 www-data  20   0  417124  31608  21220 S  30.0  0.2   0:03.59 apache2
 8564 www-data  20   0  417224  30996  20708 S  26.0  0.2   0:02.22 apache2
 8484 www-data  20   0  482772  33440  22920 S  22.0  0.2   0:04.34 apache2
 8452 www-data  20   0  418472  35156  23420 S  20.0  0.2   0:07.98 apache2
 8475 admin     20   0  418776  34084  22436 S  19.3  0.2   0:04.16 apache2
 8573 admin     20   0  416620  24148  12596 R  16.6  0.1   0:00.50 apache2
23020 mysql     20   0 13.260g 8.727g   5736 S  16.6 55.7 215:27.55 mysqld
 8207 www-data  20   0  483176  34940  24240 S  12.6  0.2   0:08.26 apache2
 8483 admin     20   0  417456  33368  22844 S  12.0  0.2   0:03.12 apache2
 8119 admin     20   0  486564  38888  25456 S  11.6  0.2   0:17.65 apache2
 8565 admin     20   0  417120  31344  20964 S   9.7  0.2   0:01.63 apache2
 8552 www-data  20   0  482664  32924  22768 S   7.7  0.2   0:00.93 apache2
 7918 www-data  20   0  486352  38068  24752 S   7.3  0.2   0:14.41 apache2
 7375 admin     20   0  482676  36568  26096 S   7.0  0.2   0:21.93 apache2
 7914 www-data  20   0  483272  36412  25288 S   6.3  0.2   0:17.74 apache2
 8206 www-data  20   0  485564  34952  22576 S   5.7  0.2   0:06.91 apache2
 8068 admin     20   0  483128  33640  22832 S   5.0  0.2   0:10.19 apache2
 7166 admin     20   0  485576  39108  26364 S   4.7  0.2   0:33.38 apache2
 7688 www-data  20   0  486100  39448  26160 S   4.7  0.2   0:26.43 apache2
 8474 admin     20   0  482992  31636  20848 S   4.0  0.2   0:02.59 apache2
 7759 admin     20   0  484744  37908  25648 S   2.0  0.2   0:20.37 apache2
15026 www-data  20   0   65344   4880   1744 S   2.0  0.0 740:34.83 nginx
 8243 memcache  20   0 4599316 3.833g    604 S   1.7 24.4  91:11.32 memcached
15027 www-data  20   0   64880   4172   1688 S   1.7  0.0 733:59.29 nginx
 8485 www-data  20   0  417164  31268  20836 S   1.0  0.2   0:02.08 apache2
15028 www-data  20   0   65072   4380   1724 S   1.0  0.0 730:03.84 nginx
15029 www-data  20   0   64988   4520   1780 S   1.0  0.0 740:34.97 nginx
 7915 admin     20   0  484224  36504  24700 R   0.7  0.2   0:12.07 apache2
 8058 admin     20   0  483024  34948  24392 S   0.7  0.2   0:08.91 apache2
 8566 admin     20   0  482656  30828  20640 S   0.7  0.2   0:01.51 apache2
    7 root      20   0       0      0      0 S   0.3  0.0 241:18.32 rcu_sched
   13 root      20   0       0      0      0 S   0.3  0.0  51:53.96 ksoftirqd/1
 8185 admin     20   0  482668  34700  24176 S   0.3  0.2   0:10.78 apache2
 8453 admin     20   0  417444  33980  23780 S   0.3  0.2   0:06.59 apache2
 8473 admin     20   0  485996  36788  23728 S   0.3  0.2   0:04.84 apache2
 8553 admin     20   0  417700  31244  20580 S   0.3  0.2   0:01.58 apache2
 8554 admin     20   0  417484  32760  22012 S   0.3  0.2   0:01.34 apache2
 8563 admin     20   0  417224  30012  19788 S   0.3  0.2   0:01.06 apache2
    1 root      20   0   28888   3820   2268 S   0.0  0.0   2:37.56 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.30 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0  79:08.47 ksoftirqd/0
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    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:05.98 migration/0
   10 root      rt   0       0      0      0 S   0.0  0.0   0:16.75 watchdog/0
   11 root      rt   0       0      0      0 S   0.0  0.0   0:15.44 watchdog/1
   12 root      rt   0       0      0      0 S   0.0  0.0   0:05.97 migration/1
   15 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:0H
   16 root      rt   0       0      0      0 S   0.0  0.0   0:15.38 watchdog/2
   17 root      rt   0       0      0      0 S   0.0  0.0   0:04.86 migration/2
   18 root      20   0       0      0      0 S   0.0  0.0  59:03.52 ksoftirqd/2
   20 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/2:0H
   21 root      rt   0       0      0      0 S   0.0  0.0   0:14.49 watchdog/3

Is it possible to do something with this without changing the hardware? A highly visited project is located on a dedicated server.
Here is the code from /etc/apache2/apache2.conf
# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf.d
#	|	`-- *

# Global configuration
PidFile ${APACHE_PID_FILE}
Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 30

<IfModule mpm_prefork_module>
    StartServers          25
    MinSpareServers       25
    MaxSpareServers      25
    ServerLimit         50
    MaxClients          50
    MaxRequestsPerChild 0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          25
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          50
    MaxRequestsPerChild 0
</IfModule>

<IfModule mpm_event_module>
    StartServers          25
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          50
    MaxRequestsPerChild 0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
#User www-data
#Group www-data

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

DefaultType None
HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include list of ports to listen on and which to use for name based vhosts
Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%b" bytes

Include conf.d/

# Include the virtual host configurations:
#Include sites-enabled/

The server is VestaCp
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2017-02-28
@ky0

This "high load" to what symptoms leads?
Z.Y. - and why do you need nginx and apache on the same machine?

A
Alexey, 2017-03-01
@alcyone

Well, you rested on the fact that your server does not hold the load. There are two ways: to increase power and optimize the code.
Conduct profiling, find bottlenecks. If you have a php project, it is more reasonable to use the nginx + php-fpm bundle instead of nginx + apache + mod_php. Etc.
Plus, I note that load average is the average temperature in the hospital. It is not suitable for an adequate assessment, I have seen normally working servers with a load average of 77.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question