Acabei de comprar meu primeiro VPS com 2 GB de RAM. Eu tinha instalado o Apache + mySQL e 1 site principalmente estático e site 2 wordpress (para teste). No começo, meu pico de memória é de 1 GB, o que indica que ele precisa de configuração adicional.
Here is the result for running ps -ylC httpd --sort:rss
S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD
S 0 20729 1 0 80 0 10032 69902 poll_s ? 00:00:00 httpd
S 48 20770 20729 0 80 0 22768 73372 inet_c ? 00:00:00 httpd
S 48 20735 20729 0 80 0 24020 73897 inet_c ? 00:00:00 httpd
S 48 20740 20729 0 80 0 26524 74302 inet_c ? 00:00:00 httpd
S 48 20733 20729 0 80 0 27792 74831 inet_c ? 00:00:00 httpd
Aqui está o resultado usando o topo do comando
top - 15:42:01 up 18 days, 15:45, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 26 total, 1 running, 24 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2097152k total, 837604k used, 1259548k free, 0k buffers
Swap: 4194304k total, 15836k used, 4178468k free, 679184k cached
1 root 20 0 19208 416 292 S 0.0 0.0 0:00.01 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd/179
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper/179
491 root 20 0 80300 776 468 S 0.0 0.0 0:18.75 sendmail
540 smmsp 20 0 76024 388 260 S 0.0 0.0 0:00.08 sendmail
556 root 20 0 114m 368 284 S 0.0 0.0 0:02.47 crond
726 root 16 -4 10660 8 4 S 0.0 0.0 0:00.00 udevd
876 root 20 0 64272 8 4 S 0.0 0.0 0:00.00 saslauthd
877 root 20 0 64272 8 4 S 0.0 0.0 0:00.00 saslauthd
908 root 20 0 181m 864 416 S 0.0 0.0 0:00.04 rsyslogd
928 root 20 0 22092 8 4 S 0.0 0.0 0:00.00 xinetd
2100 root 20 0 105m 1180 1176 S 0.0 0.1 0:00.00 mysqld_safe
2189 mysql 20 0 679m 19m 3888 S 0.0 0.9 0:41.22 mysqld
18759 root 20 0 94084 4772 3420 S 0.0 0.2 0:01.03 sshd
18761 root 20 0 105m 1952 1488 S 0.0 0.1 0:00.16 bash
20729 root 20 0 273m 9.8m 5124 S 0.0 0.5 0:00.04 httpd
20733 apache 20 0 292m 27m 4804 S 0.0 1.3 0:00.54 httpd
Aqui estão as alterações que fiz no httpd.conf
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 15
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5
Aqui está a minha configuração do prefork-MPM
# 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
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 2
MinSpareServers 3
MaxSpareServers 3
ServerLimit 35
MaxClients 35
Inicialmente, queria apenas ter o MongoDB aqui. Mas estou planejando mover minhas instalações do WP da hospedagem compartilhada também. No geral, terei de 2 a 5 sites de wp, 1 aplicativo da CodeIgniter na Web (No DB), 2 futuros aplicativos Web no fuelphp executando o MongoDB.
Eu gosto de manter o RAM no máximo de 1,2 GB, se possível. Alguma sugestão para mais ajustes no lado do apache? Vou ver se consigo reduzir a pegada do mysql.