Optimizacija VPS servera

Desava se velik load CPU-a od strane Apache procesa. Interesuje me da li su ovo ok postavke servera ili treba nesto da menjam. Vps je 2gb (4gb brust) rama i quad core i7-970 na 2.93Ghz. Na vpsu 2 wordpress sajta (10k poseta ukupno) i 2 skripte za wallpapere (3k poseta ukupno)
ssh top

top - 16:54:06 up 50 min,  1 user,  load average: 3.07, 1.61, 1.13
Tasks:  95 total,   1 running,  93 sleeping,   1 stopped,   0 zombie
Cpu(s): 13.9%us,  0.6%sy,  0.0%ni, 72.2%id, 13.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,  2205272k used,  1989032k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3198 apache    17   0  227m  38m 4056 S 60.6  0.9   0:01.82 httpd
 1973 apache    16   0  230m  42m 4604 D  8.3  1.0   0:07.33 httpd
 3171 apache    16   0  216m  27m 4064 D  7.3  0.7   0:00.23 httpd
 3152 apache    16   0  228m  40m 4324 D  7.0  1.0   0:02.17 httpd
 3180 apache    15   0  228m  38m 3864 D  6.3  0.9   0:00.19 httpd
 3125 apache    15   0  229m  41m 4584 D  5.3  1.0   0:02.21 httpd
 2041 apache    16   0  231m  42m 4352 D  5.0  1.0   0:02.53 httpd
 3202 apache    18   0  219m  29m 3880 S  5.0  0.7   0:00.15 httpd
 3162 apache    16   0  228m  39m 4496 D  4.3  1.0   0:00.64 httpd
 3197 apache    16   0  213m  24m 4048 D  4.0  0.6   0:00.12 httpd
 3172 apache    18   0  213m  25m 4184 D  0.3  0.6   0:00.26 httpd
15572 mysql     15   0 2611m 121m 6228 S  0.3  3.0   0:10.45 mysqld
    1 root      15   0 19232 1460 1232 S  0.0  0.0   0:00.00 init
 1743 root      15   0  140m 4096 2712 T  0.0  0.1   0:00.02 vim
 1841 root      21   0  198m  10m 4576 S  0.0  0.3   0:00.08 httpd
 3076 apache    18   0  232m  44m 6136 D  0.0  1.1   0:03.73 httpd
 3124 apache    15   0  231m  42m 4252 S  0.0  1.0   0:01.10 httpd
 3140 apache    15   0  230m  41m 4364 D  0.0  1.0   0:01.32 httpd
 3141 apache    18   0  228m  40m 5604 S  0.0  1.0   0:00.93 httpd
 3149 apache    16   0  228m  39m 4200 D  0.0  1.0   0:00.41 httpd
 3150 apache    16   0  231m  42m 4252 D  0.0  1.0   0:00.87 httpd
 3153 apache    15   0  230m  41m 4172 D  0.0  1.0   0:00.87 httpd
 3158 apache    15   0  227m  39m 4392 D  0.0  1.0   0:01.47 httpd
 3159 apache    17   0  228m  39m 4072 D  0.0  1.0   0:00.51 httpd
 3160 apache    15   0  225m  36m 4184 D  0.0  0.9   0:00.58 httpd
 3161 apache    15   0  228m  39m 4084 D  0.0  1.0   0:00.42 httpd
 3164 apache    16   0  228m  39m 4280 D  0.0  1.0   0:01.03 httpd
 3168 apache    16   0  213m  25m 4048 D  0.0  0.6   0:00.16 httpd
 3169 apache    16   0  231m  42m 4348 D  0.0  1.0   0:00.58 httpd
 3170 apache    16   0  230m  41m 4168 D  0.0  1.0   0:01.12 httpd
 3173 apache    16   0  231m  42m 4280 D  0.0  1.0   0:00.65 httpd
 3174 apache    15   0  227m  38m 4164 D  0.0  0.9   0:00.72 httpd
 3175 apache    15   0  227m  39m 4292 D  0.0  1.0   0:00.83 httpd
 3185 root      15   0 15028 1296 1000 R  0.0  0.0   0:00.00 top
 3190 apache    15   0  200m  11m 3388 D  0.0  0.3   0:00.00 httpd
 3201 apache    18   0  199m 8196 1896 D  0.0  0.2   0:00.00 httpd
 3203 apache    18   0  198m 7304 1116 S  0.0  0.2   0:00.00 httpd
 3204 apache    18   0  198m 7304 1116 S  0.0  0.2   0:00.00 httpd
13820 root      14  -4 10664  572  316 S  0.0  0.0   0:00.00 udevd
14159 root      18   0  179m 1420 1036 S  0.0  0.0   0:00.01 rsyslogd
14174 root      16   0 22396 1096  808 S  0.0  0.0   0:00.00 dovecot
14184 dovecot   17   0 44644 3028 2332 S  0.0  0.1   0:00.00 pop3-login
14185 dovecot   17   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14186 dovecot   17   0 44644 3036 2332 S  0.0  0.1   0:00.00 pop3-login
14187 dovecot   16   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14188 dovecot   18   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14189 dovecot   18   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14190 dovecot   18   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14191 dovecot   18   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14192 dovecot   18   0 44644 3028 2332 S  0.0  0.1   0:00.00 pop3-login
14193 dovecot   17   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14194 dovecot   18   0 44644 3028 2332 S  0.0  0.1   0:00.00 pop3-login
14195 dovecot   17   0 44644 3032 2332 S  0.0  0.1   0:00.00 pop3-login
14196 dovecot   17   0 44644 3028 2332 S  0.0  0.1   0:00.00 pop3-login
14197 dovecot   17   0 44644 3028 2332 S  0.0  0.1   0:00.00 pop3-login

my.cnf

# The MySQL server
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
event_scheduler=ON
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

httpd-mpm.conf

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          8
    MinSpareServers       5
    MaxSpareServers      20
    ServerLimit         256
    MaxClients          256
    MaxRequestsPerChild  4000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    ServerLimit         450
    MaxClients          450
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   10000
</IfModule>

Pretpostavljam da se događa zbog “dohvačenja” datoteka (.js, .css, fotografije…).

Da li si dobro konfigurirao PHP APC (Alternative PHP Cache), te fastcgi modul?

Provjeri glavni (general query log) log MySQL-a.

Opet, ukoliko su fotografije VELIKE, što može uzrokovati tzv. “high load CPU-a”.
Također, nadam se da imaš dovoljno RAM memorije (barem koliko si naveo trebalo bi biti dovoljno).
Pokušaj ih optimizirati za Web, odnosno koristiti DEFLATE modul.

Nadam se da će pomoći. :wink:

zamijeni apache sa nginx serverom… puno bolje performanse i puno manji load cpu-a…

Nemoj menjati, stavi nginx ispred apache-a…

Ukoliko stavim ngix ispred apacha da li mi ostaju url isti ? I da li treba da menjam w3 total cache podesavanja ?

ne moras…

Definitivno bi trebao nginx gore i ubij ove procese mailservera, mysql treba jos malo presloziti, isto tako nesto ti nonstop pise po disku sto je lose, 2 gb rama je skoro na knap

Instalirao sam Danginx za Direct Admin i nisam verovao nakon instalacije da u Solusu u onom grafikonu postoji 200m 400m… :smiley: Do sada je bilo 5-30
Zahvaljujem se svima mnogo ste mi pomogli


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja