Tomcat : Tuning Sun JVM settings for Tomcat
This page last changed on Dec 10, 2007 by Kees de Kooter
A lot of performance of Tomcat can be gained by carefully setting JVM parameters. This article focuses on Sun's JDK 1.5 running on a Fedora Box. The main job of this box is running tomcat. We have 1GB of memory available.
Produces more efficient run-time execution over extended periods than the -client switch (which is the default). It does take some time however for the JVM to "warm up".
Of course we set the fairly well known heap size switches (initial (ms) and maximum (mx):
We set the minimum immediately to the maximum so no time is lost increasing it at runtime.
In order to decrease the dreaded OutOfMemoryErrors after a redeploy I added this:
This sets the value of a special part of memory called the Permanent Generation. This is especially useful when running multiple applications or a lot of servlets (read: jsps). Take note that permsize is additional to the heap size.
-server -Xms256M -Xmx256M -XX:PermSize=256M -XX:MaxPermSize=256M
So our server is allocated 512 MB in total.
This property can be set by adding the
JAVA_OPTS variable to
Do some more resource on garbage collection settings.