HomePage » Java » CoreJava » JavaOptions


Java options are often to tune java performance. Here are some frequently used options. Java options can be set to the java command, or to system's environment variable $JAVA_OPTS

Option name Sample values Meaning
-Duser.timezone Asia/Hong_Kong Start java process in the timezone specified
-Xmx 1g Specify maximum heap size for java process
-Xms 64m Specify minumum heap size for java process
-Xss 128k Specify memory allocated to each thread
-XX:+UseParallelGC - Parallel GC for throughtput
-XX:+UseConcMarkSweepGC - Concurrent GC (aka CMS) for low pause time
-XX:+UseSerialGC - Serial GC for smaller applications
-XX:ParallelGCThreads 4 GC threads, set to number of processor(s)
-Djava.awt.headless true http://www.reportmill.com/support/Headless.html

Java GC

Since JDK1.5.0, Java detects the server's memory size and number of cpu cores, and select server hotspot vm if the server has >= 2G of ram and >= 2core. It will also automatically employ the parallelGC collector. The Default mx and ms is also a calculated number. See http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html

There is one comment on this page. [Display comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki