Aqui estão minhas especificações

Aqui estão minhas especificações

Pesquisei no Google por dias, juntei todas as sugestões de otimização e tentei.
Meus sites não estão obtendo grandes acessos.
Pode ser cerca de 100 acessos por dia [todos os meus sites combinados].

Aqui estão minhas especificações

Tenho 512 MB de RAM VPS com 1024 MB expansíveis.

Centos 5 32-bit & cPanel/WHM
Apache 2.2
MySQL 5.0
PHP 5.3.2

Aqui estão minhas configurações

Tenho 2 sites de produção WordPressMU e 1 site de teste

meu.cnf

Usei a amostra my-medium.cnf para começar

# The following options will be passed to all MySQL clients
[client]
#password   = your_password
port        = 3306
socket      = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port        = 3306
socket      = /var/lib/mysql/mysql.sock
skip-locking
skip-bdb
skip-innodb
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

#CAPitalZ
thread_cache_size=8
thread_concurrency=4
#query_cache_type=1
#query_cache_limit=1M
query_cache_size=16M
concurrent_insert=2
low_priority_updates=1
max_connections=50
tmp_table_size=16M
max_heap_table_size=16M
join_buffer_size=1M
interactive_timeout=25
wait_timeout=1000
#connect_timout=10 not able to restart mysql
max_connect_errors=10

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
# 
skip-networking

# Disable Federated by default
skip-federated

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id   = 1

[mysqld_safe]
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

httpd.conf

Desmarquei muitos módulos e recompilei usando EasyApache no WHM.
Tenha apenas os seguintes módulos construídos

Deflate
Expires
Fileprotect
Imagemap
MPM Prefork
Version [default]
EAccelerator for PHP
Bcmath
Calendar
CurlSSL [I'm using Curl.  But I don't have any https sites]
Expat 
GD    [for image cropping]
Gettext 
Imap 
Mbregex [default]
Mbstring [need both Mbregex and Mbstring for utf-8]
Mysql of the system
MySQL "Improved" extension.
Sockets 
TTF (FreeType) [I'm using custom font]
Zlib 

Em configuração global

I only have FollowSymLinks enabled
I Have TraceEnable, ServerSignature, FileETag OFF
ServerTokens ProductOnly
DirectoryIndex Priority has index.php as the first one

Eu removi o Clamd [Clam Antivírus]

SpamAssasin está desativado

Nas configurações de ajustes

Default catch-all/default address behavior for new accounts.  This is set to "fail"
All stats programs turned off

Eu tenho o eAccelerator instalado e verifiquei o phpinfo e está funcionando

[Pré VirtualHost incluído no WHM]

Timeout 20
KeepAlive On
MaxKeepAliveRequests 200
KeepAliveTimeout 3
MinSpareServers 1
MaxSpareServers 3
StartServers 1
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 4000

ExtendedStatus Off

#ServerType standalone this throws error
HostnameLookups Off

<Directory "/">
AllowOverride None
</Directory>

Meus sites demoram muito para carregar e o WHM/CPanel nem carrega.
adadaa.com/
adadaa.net/
kadais.ca/

Meu consumo médio de memória é de 1000 MB! [sim, sempre estourando]
O processo que consome mais CPU e também mais memória é o mysql
Mas também recebo cerca de 15 processos httpd [quando está estourando]
Já recebi um aviso do cpuwatchcheck dizendo
"Durante o processamento, a CPU foi maximizada por mais de um período de 6 horas A linha de carga/tempo de atividade atual no servidor no momento deste e-mail é 07:00:37 até 11:30, 0 usuários, média de carga: 14,64, 16,79, 20,07"

Não sei, tentei mudar esses valores de configuração muitas vezes, mas nada parece funcionar.

Por favor, mostre um pouco de luz... Obrigado

Aqui está show processlist do mysql quando a RAM tem 800 MB

Aqui estão os processos atuais em execução do WHM quando a RAM está em torno de 800 MB

Pid     Name    File    Current Directory   Command Line ▾
11758   (httpd)         
24235   (mysqld_safe)   /bin/bash   /   /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/us.adadaa.org.pid
32254   (udevd) /sbin/udevd /   /sbin/udevd -d
3591    (simpleps)  /usr/local/bin/perl /usr/local/cpanel/whostmgr/docroot  /usr/bin/perl /scripts/simpleps --html
1393    (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
2005    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
2012    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
3399    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
3420    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
3472    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
3493    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
3494    (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
3872    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
7418    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
9482    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
9900    (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
13466   (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
13656   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
13736   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
14226   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15579   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15623   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15685   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15808   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15814   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
15919   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
16156   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
17526   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
17848   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
18159   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
19821   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
19830   (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
19962   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
19980   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
19981   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
20378   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
21595   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
22513   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
23960   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
23965   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
25862   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
26305   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
26339   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
26472   (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
27890   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
28600   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
29712   (httpd) /usr/local/apache/bin/httpd /   /usr/local/apache/bin/httpd -k start -DSSL
30478   (httpd) /usr/local/apache/bin/httpd /home/ada/public_html   /usr/local/apache/bin/httpd -k start -DSSL
1408    (leechprotect)  /usr/local/bin/perl /usr/local/cpanel/bin   /usr/local/cpanel/bin/leechprotect
1380    (dovecot)   /usr/sbin/dovecot   /var/run/dovecot    /usr/sbin/dovecot
1368    (exim)  /usr/sbin/exim  /var/spool/exim /usr/sbin/exim -bd -q180m
24275   (mysqld)    /usr/sbin/mysqld    /var/lib/mysql  /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/us.adadaa.org.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
32657   (named) /usr/sbin/named /var/named  /usr/sbin/named -u named
1868    (portsentry)    /usr/sbin/portsentry    /   /usr/sbin/portsentry -tcp
1411    (pure-authd)    /usr/sbin/pure-authd    /   /usr/sbin/pure-authd -s /var/run/ftpd.sock -r /usr/sbin/pureauth
1844    (saslauthd) /usr/sbin/saslauthd /var/run/saslauthd  /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
1845    (saslauthd) /usr/sbin/saslauthd /var/run/saslauthd  /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
11622   (sshd)  /usr/sbin/sshd  /   /usr/sbin/sshd
1668    (cpanellogd)    /usr/local/bin/perl /   cpanellogd - sleeping for logs
1645    (cpsrvd-ssl)    /usr/local/cpanel/cpsrvd-ssl    /usr/local/cpanel/base  cpsrvd - waiting for connections
1422    (crond) /usr/sbin/crond /var/spool  crond
1381    (dovecot-auth)  /usr/libexec/dovecot/dovecot-auth   /var/run/dovecot    dovecot-auth
1397    (imap-login)    /usr/libexec/dovecot/imap-login /var/run/dovecot/login  imap-login
1398    (imap-login)    /usr/libexec/dovecot/imap-login /var/run/dovecot/login  imap-login
1   (init)  /sbin/init  /   init [3]
1395    (pop3-login)    /usr/libexec/dovecot/pop3-login /var/run/dovecot/login  pop3-login
1396    (pop3-login)    /usr/libexec/dovecot/pop3-login /var/run/dovecot/login  pop3-login
1409    (pure-ftpd) /usr/sbin/pure-ftpd /   pure-ftpd (SERVER)
1592    (queueprocd)    /usr/local/bin/perl /   queueprocd - wait to process a task
32645   (syslogd)   /sbin/syslogd   /   syslogd -m 0
1618    (tailwatchd)    /usr/local/bin/perl /   tailwatchd
3589    (whostmgr)  /usr/local/cpanel/whostmgr/bin/whostmgr /usr/local/cpanel/whostmgr/docroot  whostmgr - simpleps ./simpleps
3520    (cpsrvd-ssl)    /usr/local/cpanel/cpsrvd-ssl    /usr/local/cpanel/whostmgr/docroot  whostmgrd - serving 207.219.51.3
3525    (cpsrvd-ssl)    /usr/local/cpanel/cpsrvd-ssl    /usr/local/cpanel/whostmgr/docroot  whostmgrd - serving 207.219.51.3
32690   (xinetd)    /usr/sbin/xinetd    /   xinetd -stayalive -pidfile /var/run/xinetd.pid 

================

Aqui está o uso atual da CPU quando cerca de 800 MB de RAM são usados

Pid Owner   Priority    Cpu %   Mem % ▴ Command
 25862   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.6     7.5    
 26305   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.3     6.5    
 30478   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     6.2    
 14226   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     6.1    
 28600   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     6.0    
 24275   mysql   0           /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/us.adadaa.org.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock 
             30.6    5.8    
 19980   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     3.2    
 13656   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     2.9    
 15685   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             1.6     2.9    
 2005    nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.8    
 20378   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.8    
 15579   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.8    
 18159   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.6     2.8    
 27890   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.7    
 22513   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.7    
 26339   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.4     2.7    
 13466   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.4     2.7    
 3872    nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.6    
 15623   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.6    
 17526   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.5    
 7418    nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.5    
 23960   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     2.5    
 13914   root    0           whostmgr2 - top ./top  
             0.2     2.5    
 12035   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.3     2.5    
 21595   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.3     2.5    
 13736   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.4    
 16156   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.4    
 15808   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.4    
 13557   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.6     2.4    
 3493    nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.3    
 23965   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     2.3    
 9900    nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.3    
 19962   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.2     2.3    
 12026   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.4     2.1    
 19821   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     2.0    
 15919   nobody      0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.1     2.0    
 1393    root    0           /usr/local/apache/bin/httpd -k start -DSSL 
             0.0     1.0    
 13689   root    0           whostmgrd - serving 207.219.51.3 
             0.0     0.9    
 13898   root    0           whostmgrd - serving 207.219.51.3 
             0.0     0.8    
 1645    root    0           cpsrvd - waiting for connections 
             0.0     0.7    
 1408    root    0           /usr/local/cpanel/bin/leechprotect 
             0.0     0.4    
 32657   named   0           /usr/sbin/named -u named 
             0.0     0.3    
 1592    root    0           queueprocd - wait to process a task 
             0.0     0.3    
 13698   root    0           tailwatchd 
             0.0     0.3    
 1618    root    0           tailwatchd 
             0.0     0.2    
 1668    root    18              cpanellogd - sleeping for logs 
             0.0     0.1    
 24235   root    0           /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/us.adadaa.org.pid 
             0.0     0.1    
 1422    root    0           crond  
             0.0     0.1    
 1411    root    0           /usr/sbin/pure-authd -s /var/run/ftpd.sock -r /usr/sbin/pureauth 
             0.0     0.1    
 1409    root    0           pure-ftpd (SERVER)  
             0.0     0.1    
 1398    dovecot     0           imap-login  
             0.0     0.1    
 1397    dovecot     0           imap-login  
             0.0     0.1    
 1396    dovecot     0           pop3-login  
             0.0     0.1    
 1395    dovecot     0           pop3-login  
             0.0     0.1    
 1368    mailnull    0           /usr/sbin/exim -bd -q180m 
             0.0     0.1    
 11622   root    0           /usr/sbin/sshd 
             0.0     0.1    
 32690   root    0           xinetd -stayalive -pidfile /var/run/xinetd.pid  
             0.0     0.0    
 32645   root    0           syslogd -m 0  
             0.0     0.0    
 32254   root    -4              /sbin/udevd -d 
             0.0     0.0    
 1868    root    0           /usr/sbin/portsentry -tcp 
             0.0     0.0    
 1845    root    0           /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2 
             0.0     0.0    
 1844    root    0           /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2 
             0.0     0.0    
 1381    root    0           dovecot-auth  
             0.0     0.0    
 1380    root    0           /usr/sbin/dovecot 
             0.0     0.0    
 14050   root    0           /bin/ps -ewwo pid,user,nice,pmem,pcpu,command 
             0.0     0.0    
 1   root    0           init [3]  
             0.0     0.0    

Responder1

Gostaria de saber se algo interessante está aparecendo em seus arquivos de log (talvez em /var/log/httpd ?

Quase parece que você moveu coisas do .htaccess para um arquivo /etc/httpd/conf, e isso pode ajudar a evitar que o Apache procure nos diretórios um arquivo .htaccess.

Você pode fazer login via ssh ou putty de alguma forma e obter um shell de comando onde você pode executar o top?

Um show é uma pequena quantidade de memória, mas estou executando cerca de 5 sites wpmu e um site tikiwiki com menos de 256 megas, com alguns brincando com PHPCake e Ruby on Rails. Eu estava pensando em mudar alguns sites Drupal que tenho também, mas estou com um pouco de memória.

Eu também tenho um cache APC, mas o uso estritamente para cache de código e mantenho o cache de páginas e objetos em disco, embora esteja usando o W3 Total Cache para meus sites WPMU em vez do Super Cache, que também achei muito bom.

Não estou usando nenhum painel no meu sistema VPS. Gosto da liberdade de trabalhar diretamente no Linux. Estou executando o exim para meu servidor de e-mail e o dovecot para pop3. Eu gostaria de configurar o python e o tomcat, bem como tenho uma espécie de ideia de unificação MVC que gostaria de verificar se seria uma ideia com potencial ou não.

De qualquer forma, meus sites wpmu são pequenos, mas meu VPS só tem um quarto do que o seu aparentemente tem. Pensando bem, uma das primeiras coisas que notei ao abrir o sistema é que eu tinha script kiddies e bots de spam atingindo meu VPS antes mesmo de colocá-lo no DNS! E alguns estavam fazendo ataques de força bruta, então configurei algumas detecções de intrusão e coloquei-os no firewall por alguns dias, e outros permanentemente. Também instalei muita segurança nos sites por meio do Apache e de plug-ins do WordPress para evitar inserções de SQL e lixo eletrônico.

Gostaria de saber se você está recebendo alguns ataques de força bruta através de SSL com 50 linhas Apache abertas, embora eu tenha notado que você mencionou que havia cerca de 15 conexões simultâneas, talvez?

Executar top, ps, vmstat, iostat ou qualquer outro que você tenha disponível pode dar uma ideia de onde estão os gargalos. Sua taxa de paginação ou varredura está alta? Você tem um grande número de executáveis? Qual é a carga da CPU? Se você estiver compactando e criptografando um zilhão de coisas por segundo em tempo real o tempo todo, a carga da sua CPU passaria facilmente pela estratosfera.

Ou talvez uma de suas páginas tenha se tornado popular no Digg? Desculpe. É tarde e provavelmente deveria dormir um pouco, pois estou vagando por todo o lugar e não sei se estou encontrando alguma coisa que possa lhe dar alguma ideia valiosa...

Atenciosamente, Dan

informação relacionada