I just purchased my first VPS with 2GB of RAM. I had installed Apache + mySQL and 1 mainly static site and 2 wordpress site (for testing). At first, my memory peak at 1GB, which indicates that it needs further configuration.
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
Here it the result using the command top
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
Here are the changes I made in 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
Here is my prefork-MPM setting
# 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
I initially wanted to only have MongoDB in here. But I am planning on moving my WP installs from the shared hosting as well. All in all, I will have 2-5 wp site, 1 CodeIgniter Web app (No DB), 2 future Web App on fuelphp running MongoDB.
I like to keep the ram at max of 1.2GB if possible. Any suggestions for further tuning in apache side? I will see if I can reduce mysql footprint.