We use the following settings for Tomcat on our production server (NixOS/Linux):
-Xms350m -Xss8m -Xmx8G -Djava.security.egd=file:/dev/./urandom -XX:MaxPermSize=512M -XX:PermSize=512M -XX:-UseGCOverheadLimit -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/tomcat/logs/heapdump.hprof
The most important setting, maximum heap space, value depends on size/number of applications, but the default setting is usually too low. If this setting is too high for your JVM, it won’t start at all.
This allows redeploying the application without running into permgenspace errors too quickly.
The default implementation for random can be too slow (java.util.UUID.randomUUID is used for entity identifiers, including RequestLogEntry) see http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom
jvisualvm to inspect the Tomcat process, this allows you to look at the heap and running threads and create dumps for later inspection. A heap dump can also be created using:
jmap -F -dump:format=b,file=<filename> <process id>
The Eclipse Memory Analyzer can be used to inspect this file, get it from http://www.eclipse.org/mat/
If the tomcat process becomes unresponsive try
kill -3 <process id>
to generate a thread dump in the catalina.out log.
See MySQL section.
See Lightweight VPS section, also contains step-by-step installation.Production Server