Optimizing Virtualmin on Centos 5.5 with 376 MB Ram

We have a server on a cloud host with the following config

CentOS Linux 5.5
Webmin version 1.530
Virtualmin version 3.84.gpl GPL
Kernel and CPU Linux 2.6.18-194.32.1.el5xen on x86_64
Real memory 376 MB tota
Virtual memory 203.91 MB total

We’ve setup the server to run a dynamic website with a user profile system where users register, login, upload content and chat with each other live.

Services we need are
Apache
MySQL
Cron
FTP
PHP

We use Google apps for email and use the system’s sendmail for notifications.

Our server constantly hovers between 170mb and 270mb ram. As activity increases on the server, it crashes because it runs out of RAM. Below are the list of services we’re currently running on the server at boot.

anacron
yum-updatesd
mdmonitor
xe-linux-distribution
mcstrans
webmin
usermin
atop
syslog
sshd
lvm2-monitor
atd
lm_sensors
kudzu
acpid
avahi-daemon
saslauthd
isdn
rpcidmapd
rpcgssd
restorecond
irqbalance
readahead_early
crond
rawdevices
iptables
proftpd
ip6tables
postfix
portmap
pcscd
httpd
cpuspeed
autofs
nfslock
haldaemon
gpm
network
firstboot
netfs
auditd
named
mysqld
/etc/rc.d/rc.local
microcode_ctl
messagebus
dovecot

Would appreciate any advice we can receive.

Howdy,

Well, you may not need portmap and nfslock (unless you’re using the NFS filesystem, that is).

However, 376MB is certainly on the low end of things… you may need to make some tweaks to the daemons that are running in order to limit their memory consumption.

Also, if possible, you may want to bump up how much swap is available.

There’s some documentation here that should get you started on how to setup a server with limited available RAM:

http://www.virtualmin.com/documentation/system/low-memory

Hey Andrey

Thanks, we have upgraded our RAM to 752 MB. Our hosts informed us that the main issue lies with the MYSQL Sever. We use live chat on the site and have over 10000 members. The chat database is heavily queried and thats where the problem occurs.

Any tips of optimizing or tuning the MYSQL server? Also, wont a larger swap mean a slower server? if not, how do we increase the swap size?

Also currently the following are our Apache Webserver > Processes and Limits under webmin

Maximum headers in request Default
Maximum request header size Default
Maximum request line size Default
Display extended status information No
Maximum requests per server process Default
Maximum spare server processes 5
Minimum spare server processes 1
Initial server processes 2

And our MySQL Database server configuration is

MySQL server port Default
MySQL server listening address Any
Skip locking of table files? No
Allow big tables? No
MySQL Unix socket Default
Databases files directory Default
Default table storage engine Default
Separate file for each InnoDB table? No
Key buffer size 64MB
Maximum packet size Default
Sort buffer size 4MB
Network buffer size Default
MyISAM sort buffer size Default
Tables to cache 512
Maximum number of connections Default

What are the ideal settings for a server running 1 main site and 4 dependent websites, the main one receiving around a 1000 unique visitors a day with about 40,000 pageviews a day. Also, we’re running cometchat, which is really heavy on the mysql server.

Also, wont a larger swap mean a slower server?

Yes, as you use more swap, your server will be slower.

However, swap is mostly used in the case where your main memory runs out… if you don’t have enough RAM, you need to use swap. Without enough swap, your services will begin crashing :slight_smile:

However, now that you’ve bumped up your RAM, you hold off on changing your swap, and keep an eye on how much RAM/swap you’re using after a few days.

What are the ideal settings for a server running 1 main site and 4 dependent websites, the main one receiving around a 1000 unique visitors a day with about 40,000 pageviews a day. Also, we’re running cometchat, which is really heavy on the mysql server.

As far as MySQL goes – you may want to work with the folks who make the software you’ll be running to see if they have any suggestions for any specific tuning or tweaks they’d recommend.

For Apache, I’d suggest making sure that you’re only loading the PHP and Apache modules you require for your apps. But the Virtualmin on low-memory systems covers all that.

-Eric

We built the app inhouse and it works really well with the default mysql values. However, when we populate the test server with the members database (10000+) thats when it crashes

Okay… did you by chance attempt populating the database since upgrading your RAM?

If so, what’s crashing specifically, is it MySQL?

If you run the command “dmesg” from the command line, do you see any errors towards the end of the output? Kernel errors would show up there, including any out of memory problems.

You could beef up the available swap, which would keep processes from dieing. But as you mentioned earlier, that would cause things to run slower if the swap is being heavily used.

Tuning MySQL is a complex topic, and you might be better served by just making more RAM/swap available to it. However, there’s a lot of articles around the Net about how to do some tuning. Here’s an example of one over at IBM which discusses some memory settings.

Note, of course, than lowering any of the memory usage settings of MySQL will slow down it’s performance… they’re set that way for a reason :slight_smile: But if increasing your RAM further isn’t an option, perhaps you’ll get some ideas from this article that will help you out:

http://www.ibm.com/developerworks/library/l-tune-lamp-3.html