0

I have installed CentOS 5.5 minimal on my VPS. Then I installed mysql (yum mysql mysql-server) and started as a service (service mysqld start) After that I installed PHP (yum install php). And finally I installed Cherokee and ProFTPD. (service cherokee start) (service proftpd start). However, it is eating about 360MB of memory! I think it should consume much less as I don't even have a website running yet. I've been reading about optimizing the server so that it would consume less memory, however I'm quite new to VPS and even though I modified some config files, it is still eating that much memory. Memory usage (top):

Mem: 508716k total, 393896k used, 114820k free, 43456k buffers

Swap: 524280k total, 0k used, 524280k free, 282408k cached

This is the process list (ps aux):

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root         1  0.0  0.1  10356   672 ?        Ss   Sep01   0:00 init [3]

root         2  0.0  0.0      0     0 ?        S    Sep01   0:00 [kthreadd]

root         3  0.0  0.0      0     0 ?        S    Sep01   0:00 [migration/0]

root         4  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksoftirqd/0]

root         5  0.0  0.0      0     0 ?        S    Sep01   0:00 [watchdog/0]

root         6  0.0  0.0      0     0 ?        S    Sep01   0:00 [migration/1]

root         7  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksoftirqd/1]

root         8  0.0  0.0      0     0 ?        S    Sep01   0:00 [watchdog/1]

root         9  0.0  0.0      0     0 ?        S    Sep01   0:00 [migration/2]

root        10  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksoftirqd/2]

root        11  0.0  0.0      0     0 ?        S    Sep01   0:00 [watchdog/2]

root        12  0.0  0.0      0     0 ?        S    Sep01   0:00 [migration/3]

root        13  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksoftirqd/3]

root        14  0.0  0.0      0     0 ?        S    Sep01   0:00 [watchdog/3]

root        15  0.0  0.0      0     0 ?        S    Sep01   0:00 [events/0]

root        16  0.0  0.0      0     0 ?        S    Sep01   0:00 [events/1]

root        17  0.0  0.0      0     0 ?        S    Sep01   0:00 [events/2]

root        18  0.0  0.0      0     0 ?        S    Sep01   0:00 [events/3]

root        19  0.0  0.0      0     0 ?        S    Sep01   0:00 [khelper]

root        22  0.0  0.0      0     0 ?        S    Sep01   0:00 [async/mgr]

root        28  0.0  0.0      0     0 ?        S    Sep01   0:00 [xenwatch]

root        29  0.0  0.0      0     0 ?        S    Sep01   0:00 [xenbus]

root        80  0.0  0.0      0     0 ?        S    Sep01   0:00 [sync_supers]

root        82  0.0  0.0      0     0 ?        S    Sep01   0:00 [bdi-default]

root        83  0.0  0.0      0     0 ?        S    Sep01   0:00 [kblockd/0]

root        84  0.0  0.0      0     0 ?        S    Sep01   0:00 [kblockd/1]

root        85  0.0  0.0      0     0 ?        S    Sep01   0:00 [kblockd/2]

root        86  0.0  0.0      0     0 ?        S    Sep01   0:00 [kblockd/3]

root        94  0.0  0.0      0     0 ?        S    Sep01   0:00 [kseriod]

root       148  0.0  0.0      0     0 ?        S    Sep01   0:00 [khungtaskd]

root       149  0.0  0.0      0     0 ?        S    Sep01   0:00 [kswapd0]

root       150  0.0  0.0      0     0 ?        S    Sep01   0:00 [aio/0]

root       151  0.0  0.0      0     0 ?        S    Sep01   0:00 [aio/1]

root       152  0.0  0.0      0     0 ?        S    Sep01   0:00 [aio/2]

root       153  0.0  0.0      0     0 ?        S    Sep01   0:00 [aio/3]

root       154  0.0  0.0      0     0 ?        S    Sep01   0:00 [crypto/0]

root       155  0.0  0.0      0     0 ?        S    Sep01   0:00 [crypto/1]

root       156  0.0  0.0      0     0 ?        S    Sep01   0:00 [crypto/2]

root       157  0.0  0.0      0     0 ?        S    Sep01   0:00 [crypto/3]

root       368  0.0  0.0      0     0 ?        S    Sep01   0:00 [khvcd]

root       444  0.0  0.0      0     0 ?        S    Sep01   0:00 [kpsmoused]

root       454  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksuspend_usbd]

root       455  0.0  0.0      0     0 ?        S    Sep01   0:00 [khubd]

root       464  0.0  0.0      0     0 ?        S    Sep01   0:00 [ata/0]

root       465  0.0  0.0      0     0 ?        S    Sep01   0:00 [ata/1]

root       466  0.0  0.0      0     0 ?        S    Sep01   0:00 [ata/2]

root       467  0.0  0.0      0     0 ?        S    Sep01   0:00 [ata/3]

root       468  0.0  0.0      0     0 ?        S    Sep01   0:00 [ata_aux]

root       471  0.0  0.0      0     0 ?        S    Sep01   0:00 [kstriped]

root       477  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksnapd]

root       505  0.0  0.0      0     0 ?        S    Sep01   0:00 [kjournald]

root       558  0.0  0.1  12612   752 ?        S<s  Sep01   0:00 /sbin/udevd -d

root      1412  0.0  0.0      0     0 ?        S    Sep01   0:00 [kmpathd/0]

root      1413  0.0  0.0      0     0 ?        S    Sep01   0:00 [kmpathd/1]

root      1414  0.0  0.0      0     0 ?        S    Sep01   0:00 [kmpathd/2]

root      1415  0.0  0.0      0     0 ?        S    Sep01   0:00 [kmpathd/3]

root      1416  0.0  0.0      0     0 ?        S    Sep01   0:00 [kmpath_handle]

root      1708  0.0  0.1   5916   664 ?        Ss   Sep01   0:00 syslogd -m 0

root      1711  0.0  0.0   3812   432 ?        Ss   Sep01   0:00 klogd -x

root      1722  0.0  0.2  62632  1216 ?        Ss   Sep01   0:00 /usr/sbin/sshd

root      1730  0.0  0.2  19712  1148 ?        Ss   Sep01   0:00 crond

root      1799  0.0  0.2  10904  1320 ?        Ss   Sep01   0:00 /bin/sh

root      1804  0.0  0.0      0     0 ?        S    Sep01   0:00 [kauditd]

root      1993  0.0  0.2  10768  1256 ?        S    Sep01   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --l

mysql     2043  0.0  4.9 164128 25204 ?        Sl   Sep01   0:10 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run

root      2161  0.0  0.1  23836   692 ?        Ssl  Sep01   0:00 /usr/sbin/cherokee --config=/etc/cherokee/cherokee.conf -d pidfile /var/run/cherokee.pid

nobody    2220  0.0  0.3  49468  1572 ?        Ss   Sep01   0:00 proftpd: (accepting connections)

root      2325  0.0  0.6 273476  3340 ?        Sl   Sep01   0:04 /usr/sbin/cherokee-worker --config=/etc/cherokee/cherokee.conf  pidfile /var/run/cherokee.pi

root      2345  0.0  1.1  78316  5820 ?        Ss   Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root      2346  0.0  0.7  78664  3732 ?        S    Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root      2347  0.0  0.7  78600  3600 ?        S    Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root      2348  0.0  0.7  78600  3604 ?        S    Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root      2349  0.0  0.7  78664  3692 ?        S    Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root      2350  0.0  0.7  78664  3664 ?        S    Sep01   0:00 /usr/bin/php-cgi -b 127.0.0.1:47990

root     12288  0.0  0.6  90164  3392 ?        Ss   07:35   0:00 sshd: root@pts/0

root     12290  0.0  0.2  10900  1448 pts/0    Ss   07:35   0:00 -bash

root     12323  0.0  0.1  10464   900 pts/0    R+   07:53   0:00 ps aux

Can you help me to know what to configure to eat less memory?

1

You are ok. See http://www.linuxatemyram.com/.

  • Thank you! I didn't know about caching. In 7 minutes I'll accept your answer. The real RAM I have free is 430MB, and I'm only using 66MB – Ivan Sep 2 '10 at 12:04
  • Really? 114820k free, 43456k buffers - that still only gives around 160MB free – James L Sep 2 '10 at 12:06
-1

Firstly, drop your prefork values inside /etc/httpd/conf/httpd.conf. I've got a 256MB slice running similar and I'm using the values below. Also go through that file and comment out all the LoadModules and do /etc/init.d/httpd configtest and put any back in that it complains about. You can also remove PHP extensions to help a bit.

My 256MB slice is currently using the following, running MySQL and Apache with the following memory:
total used free shared buffers cached
Mem: 256 240 15 0 46 90
-/+ buffers/cache: 103 152
Swap: 511 11 500

My prefork is as low as:
<IfModule prefork.c>
StartServers 2
MinSpareServers 3
MaxSpareServers 8
ServerLimit 100
MaxClients 100
MaxRequestsPerChild 200
</IfModule>

My my.cnf is:
`[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 4M
max_allowed_packet = 1M
table_cache = 25
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-bdb
skip-innodb
query_cache_limit = 256K
query_cache_size = 4M

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk] key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout`

Obviously you will need to amend this for anything you need.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.