We have a Tomcat6 instance running on Ubuntu 10.04LTS. Our test box was just a Windows machine running Tomcat6. Both machines (Linux and Windows) have 1GB of ram.
Via the Tomcat configuration tool in windows, I was able to set the min/max/permgen sizes of the JVM. Those were set to 256/512/128 respectively. Now on the Ubuntu box, I've tried setting the JVM options in several different places including:
Adding JAVA_OPTS & CATALINA_OPTS in /etc/environment
Adding JAVA_OPTS in $CATALINA_HOME/bin/catalina.sh
Creating setenv.sh and adding JAVA_OPTS in $CATALINA_HOME/bin
Adding JAVA_OPTS directly to /etc/init.d/tomcat6
Un-commenting the JAVA_OPTS and modifying it in /etc/default/tomcat6
Nearly all of those methods did not work, except for modifying /etc/init.d/tomcat6 directly (and possibly the /etc/default/tomcat6 change, but I just did that). However, my understanding is that when you change these settings, only one JVM should be used for the entire tomcat6 instance, and that memory is shared among the applications.
On our windows box, tomcat6 is run as a service, and appears to behave this way. However, when I look at htop on the linux box, there are 20+ tomcat6 instances (I have an app that triggers internal jobs every X seconds using chron, so maybe these are threads? Or are they actual instances) all with those memory settings. The app runs fine for a bit, but eventually ends up locking up. I'm guessing each of these apps thinks it has 512m to work with and never GC's and then locks tomcat up completely.
What is the proper way to set all of this up?