Michael Yuan’s article on Scaling Enterprise Java on 64-bit Multi-Core X86-Based Servers is quite a good read. A few potentially drop-in tips to enhance performance:

  • use the -Xms<size> (minimum memory) and -Xmx<size> (maximum memory) flags. For instance, the -Xms1g -Xmx1g to force the JVM to use a fixed amount of memory (1 GB). Apparently, resizing of heap @ runtime can cause instability
  • by default, garbage collection is single threaded. Use certain flags to let it run in multiple threads, in either background or foreground threads
  • further tune Java’s garbage collection
  • Monitor the GC and JVM. Use -verbose:gc for GC printing to console. If using JDK 5, start the JVM with the -Dcom.sun.management.jmxremote flag and run the console command to view JVM performance in a GUI
  • startup the JVM with the -server flag. Starts up slower but better runtime performance

A few other tips involves programming (using NIO, Concurrency in JDK 5, etc.) and JBoss so they’re not fast fixes. Still, go read the original article for more info. A few other gems in the article - a Java load / performance tool called Grinder and a list of JVM flags.