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 -Xmx1gto 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:gcfor GC printing to console. If using JDK 5, start the JVM with the-Dcom.sun.management.jmxremoteflag and run theconsolecommand to view JVM performance in a GUI - startup the JVM with the
-serverflag. 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.
Filed under:
Programming
Leave a comment