My experience with the jvm has mostly been maintain a tomcat container for several applications. I find myself always not sure of the what ratio of -Xms -Xmx -Xmn -XX:PermSize -XX:MaxPermSize setting with I initialize my tomcat instance.

I know this will vary depending on the number and size of applications I am running. I'm not looking to have my hand held, but anyone have tips or resources on how to test your load needs and what a good ratio of settings is?

Thanks in advance.


In this case the box is a slicehost vps:

64bit Linux 1024 Ram, and 1.6 jdk Sun (though i might change that)

Tomcat sits behind Apache via mod_jk. I also run a mysql and a mail server (both low use).

On tomcat I just run one jruby and two railo (cfml) apps, and should add more later.

I'm looking more for tips/pointers than an exact setting spec. as almost everything is subject to change.


You need to provide a lot more information:

1) How much RAM is available on the box? Is Tomcat the only thing running?
2) Is this a 32bit or 64bit VM?
3) How many CPU's/cores are on this box?
4) What major version of the jdk are you running? 1.4, 5, or 6?

The answers to those questions will allow you to set boundaries for the heap.

Once you get past that, questions about the application may need to be answered - how many objects are long-lived (ie cache), and how many are short lived (less than 5 seconds before they go out of scope).

These questions will tell us what % of the heap can be used for Eden, and what percent needs to be used for the old generation.


Well, if your Tomcat is long-running, then adding the '-server' flag would likely be beneficial. Given your constraints, unless you know your apps inside and out, it's probably best to leave it up to ergonomics to determine the best ratios and collector. Java tuning is much more an art than it is a science. Start here: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html, then look for tools like GCHisto, and VisualGC to help you visualize what's going on inside the VM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.