Last modified 11 years ago Last modified on 03/14/08 14:06:06

Local Variable Usage

If need temporary local variable, use the less expensive version, but if you are passing the object around use the concurrent version:

Local only Thread-safe
ArrayList Vector
HashMap Hashtable
StringBuilder StringBuffer

This and other hints are available in the Java Anti-Patterns article.

JVM Options

Here's a way to make the Sun server JVM take some extra time reserving memory (used in MindSeer and some Tomcats):

JAVA_OPTS="-server -Xmx384m -Xms384m -XX:GCTimeLimit=95 -XX:GCTimeRatio=49"

Another problem is webapps using up the perm gen space, see #15; you can increase with

JAVA_OPTS="-XX:PermSize=128m -XX:MaxPermSize=256m"