I have a fresh server running Ubuntu 11.04 (Natty) (64-bit). I started off by installing
tomcat6. When the Tomcat server starts up, it immediately uses 480+ MB of memory. This seems way out of proportion and I'm wondering if anyone has a solution to get Tomcat to use 200-300 MB (or less) memory.
I used memtop to see this: (Note: I removed all but the large entries. The 499MB entry is Tomcat)
user@xyz:~# python memtop-0.9.py PID | private/writ. mem |command | current | previous |(truncated) 19776 | 499.3 MB | +++++ |/usr/lib/jvm/java-6-openjdk/bin/java-Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties-Djava.awt.headless=true-Xm 18082 | 148.6 MB | +++++ |/usr/sbin/mysqld 1385 | 3.6 MB | ++ |pythonmemtop-0.9.py RAM usage: ============================================== 69.3 %
Furthermore, you can see what JDK and Tomcat packages I have installed:
user@xyz:~# dpkg --get-selections | grep jdk default-jdk install openjdk-6-jdk install openjdk-6-jre install openjdk-6-jre-headless install openjdk-6-jre-lib install user@xyz:~# dpkg --get-selections | grep tomcat libtomcat6-java install tomcat6 install tomcat6-admin install tomcat6-common install tomcat6-user install
The startup script for Tomcat sets
Xmx to 128M:
Does anyone have any ideas on what I could do to knock the memory consumption down to something more reasonable? I do not understand why the JVM and Tomcat together would need to consume this much memory.
For the heck of it, I downloaded Tomcat 6 directly and ran the startup script. Keep in mind that no Xmx value was set this time. When running this, memtop shows that Tomcat is using 737 MB's worth of memory!
This leads me to believe that there is an issue with openjdk using a serious amount of memory for the JVM.
I tried the same thing with a fresh .zip download of Tomcat 7 -- same issue. It was using 740 MB of memory.
I installed the Sun JRE/JDK. Memory consumption dropped to around 400 MB (down from almost 500 MB). This is still more memory usage than what I would prefer!
(sun-java6-bin, sun-java6-jdk, sun-java6-jre)
When I run
top, I get this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 13749 tomcat6 20 0 481m 68m 9892 S 0 7.4 0:02.85 java
I realize and expect that a 64-bit machine/JVM will use more memory, but I did not expect it to be this high. I'm running on a VM that is only guaranteeing me 512MB.