Optimizing a VPS

Status
Not open for further replies.

Hyperz

Active Member
Veteran
2,473
2009
608
20,695
Ok so I have my small VPS set up. It only has 256MiB RAM so optimizing some setting and tweaking some stuff would be advised in my case.

I installed Webmin, Virtualmin, MySQL, Litespeed (standard), php5 with eAccelerator, BIND, Postfix, etc. All the needed stuff for a webserver basically. Everything seems to be running OK but I want to tweak some stuff to keep mem usage as low as possible.

I think MySQL could do with less RAM and that I can disable some unneeded processes. Here's what runs after a fresh boot:

Code:
2414     mysql     128196 kB     /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file ...
2318     bind     41344 kB     /usr/sbin/named -u bind
2281     root     27536 kB     /usr/sbin/rsyslogd -c3
3658     root     14068 kB     /usr/share/webmin/proc/index_size.cgi
3051     code-projects     12864 kB     lsphp5
3052     www-data     12864 kB     lsphp5
3104     www-data     12864 kB     lsphp5
3646     root     9608 kB     /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
3647     root     9608 kB     /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
3648     root     9608 kB     /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
3106     root     9596 kB     /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
2964     snmp     9124 kB     /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid
3638     lsadm     7040 kB     admin_php -c ../conf/php.ini
3050     www-data     6192 kB     ./lshttpd
2962     postfix     5680 kB     qmgr -l -t fifo -u
2961     postfix     5636 kB     pickup -l -t fifo -u -c
2952     root     5624 kB     /usr/lib/postfix/master
3046     root     5568 kB     ./lshttpd
2332     root     5416 kB     /usr/sbin/sshd
2979     haldaemon     5388 kB     /usr/sbin/hald
3026     proftpd     5256 kB     proftpd: (accepting connections)
3085     root     3456 kB     /usr/sbin/cron
2999     root     3388 kB     hald-addon-input: Listening on /dev/input/event2 /dev/input/event1 /dev/input/ev ...
3008     root     3388 kB     hald-addon-storage: no polling on /dev/fd0 because it is explicitly disabled
3010     root     3388 kB     hald-addon-storage: polling /dev/hda (every 2 sec)
2980     root     3324 kB     hald-runner
2968     root     3272 kB     /usr/sbin/famd -T 0
2833     root     3224 kB     /usr/lib/vmware-tools/sbin32/vmware-guestd --background /var/run/vmware-guestd.p ...
2375     root     2832 kB     /bin/sh /usr/bin/mysqld_safe
2302     messagebus     2620 kB     /usr/bin/dbus-daemon --system
1108     root     2292 kB     udevd --daemon
3007     haldaemon     2272 kB     hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
1     root     2100 kB     init [2]
3065     daemon     2048 kB     /usr/sbin/atd
2081     statd     1956 kB     /sbin/rpc.statd
2070     daemon     1892 kB     /sbin/portmap
3049     root     1768 kB     httpd (lscgid)
2292     root     1764 kB     /usr/sbin/acpid
3107     root     1764 kB     /sbin/getty 38400 tty1
3109     root     1764 kB     /sbin/getty 38400 tty2
3111     root     1764 kB     /sbin/getty 38400 tty3
3113     root     1764 kB     /sbin/getty 38400 tty4
3115     root     1764 kB     /sbin/getty 38400 tty5
3116     root     1764 kB     /sbin/getty 38400 tty6
2416     root     1748 kB     logger -p daemon.err -t mysqld_safe -i -t mysqld
2     root     0 kB     [kthreadd]
3     root     0 kB     [migration/0]
4     root     0 kB     [ksoftirqd/0]
5     root     0 kB     [watchdog/0]
6     root     0 kB     [events/0]
7     root     0 kB     [khelper]
39     root     0 kB     [kblockd/0]
41     root     0 kB     [kacpid]
42     root     0 kB     [kacpi_notify]
170     root     0 kB     [kseriod]
207     root     0 kB     [pdflush]
208     root     0 kB     [pdflush]
209     root     0 kB     [kswapd0]
210     root     0 kB     [aio/0]
757     root     0 kB     [ata/0]
758     root     0 kB     [ata_aux]
934     root     0 kB     [scsi_eh_0]
1036     root     0 kB     [kjournald]
1587     root     0 kB     [kpsmoused]
2638     root     0 kB     [vmmemctl]
Code:
Real memory: 250.39 MB total / 186.29 MB free   Swap space: 486.33 MB total / 486.33 MB free
Any suggestions?
 
8 comments
Thanks for the offer, appreciate it. But I need to get familiar with this stuff so I can do it again in the future if needed. So if you could give me tips or something on how to improve it's performance/reduce mem usage that would be awesome.
 
Nice, that config reduced my total RAM usage with about 10MiB, now at 65 roughly. Thanks William :).

Anyone any idea's about the processes? Any I don't need?
 
Sure, this is my current MySQL config:

Code:
[mysqld]
max_connections = 400
key_buffer = 16M
myisam_sort_buffer_size = 32M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 286
interactive_timeout = 25
wait_timeout = 1000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 16M
query_cache_type = 1
tmp_table_size = 16M
skip-innodb
 
[mysqld_safe]
open_files_limit = 8192
 
[mysqldump]
quick
max_allowed_packet = 16M
 
[myisamchk]
key_buffer = 32M
sort_buffer = 32M
read_buffer = 16M
write_buffer = 16M

There's also some tips on the Virtualmin site: http://www.virtualmin.com/documenta..._systems#optimize_mysql_for_low_memory_server
 
Status
Not open for further replies.
Back
Top