Database Reference
In-Depth Information
a machine capable of using more, you may want to tune this setting. Try setting the -Xmx and
-Xms options to the same value to keep Java from having to manage heap growth.
NOTE
The maximum theoretical heap size for a 32-bit JVM is 4GB. However, do not simply set your JVM
to use as much memory as you have available up to 4GB. There are many factors involved here, such
as the amount of swap space and memory fragmentation. Simply increasing the size of the heap using
-Xmx will not help if you don't have any swap available. Typically it is possible to get approximately
1.6GB of heap on a 32-bit JVM on Windows and closer to 2GB on Solaris. Using a 64-bit JVM on a
64-bit system will allow more space. See http://java.sun.com/docs/hotspot/HotSpotFAQ.html for more
information.
Tuning some of these options will make stress tests perform better. For example, I saw a 15%
performance improvement using the following settings over the defaults:
JVM_OPTS=" \
-da \
-Xms1024M \
-Xmx1024M \
-XX:+UseParallelGC \
-XX:+CMSParallelRemarkEnabled \
-XX:SurvivorRatio=4 \
-XX:MaxTenuringThreshold=0
When performance tuning, it's a good idea to set only the heap min and max options, and noth-
ing else at first. Only after real-world usage in your environment and some performance bench-
marking with the aid of heap analysis tools and observation of your specific application's beha-
vior should you dive into tuning the more advanced JVM settings. If you tune your JVM options
and see some success using a load-testing tool or something like the Python stress test in contrib,
don't get too excited. You need to test under real-world conditions; don't simply copy these set-
tings.
NOTE
For more information on Java 6 performance tuning (Java 6 operates differently than previous versions),
see http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html .
In general, you'll probably want to make sure that you've instructed the heap to dump its state if
it hits an out of memory error. This is just good practice if you've been getting out of memory
errors. You can also instruct the heap to print garbage-collection details. Also, if you have a lot
Search WWH ::




Custom Search