Posts Tagged ‘Low Memory’

Java Web Applications and Tomcat on low memory servers

Monday, May 4th, 2009

I was helping out a family member develop a easy to manage gallery and e-commerce site.  To keep costs down and as a bit of a challenge we opted to go for a server with only 128 meg of ram (only £9 a month with a 5 meg sync line). On this we would need to deploy a jvm, tomcat, mysql database, mail server and the usual list of system applications (ssh and so on). If you add on the requirements for some chunky JAI image resizing code things were going to be tight.

The normal setup (debian) would be apache 2 serving on port 80 connected (mod_jk) to tomcat running on the Sun JVM. We would have open ssh  for remote access, mysql as the database and postfix as the mail server.  This doesnt work out of the box, the server was using swap space straight away. Java doesnt work out of swap space.

The first thing to go was the apache webserver, I just told tomcat to listen on port 80. Next we needed to tune the out of the box settings for mysql server, these two lines will save you a reasonable about of ram:

skip-bdb
skip-innodb

(more…)