On Mar 7, 2008, at 12:12 PM, Jim Foster wrote:
Hi Jim,
There are a lot of knobs and switches. However, you can cause as much
harm as good trying to fine tune their settings. My advice to you is
to keep things as simple as possible until you know you have a
problem.
Hi Kevan,
Simple is good.
I will certainly take your advice. I just know from experience that
it best
to put a lasso around potential system-related problems like this
early in
the game...if not they may assume an exponential flight path.
Understood. IMO, this is a like optimizing code execution. Spend some
time with algorithmic analysis, but don't spend too much time trying
to optimize arbitrary code paths. Wait until you have actual
performance data that indicates where you will get the most bang for
your buck. Measure, then optimize.
You may find the following blog useful --
http://kirk.blog-city.com/advice_on_jvm_heap_tuning_dont_touch_that_dial.htm
Kevan Miller wrote:
The JVM can print GC statistics to STDOUT. Often I find this
sufficient for getting a broad overview of what's going on. You can
also configure the JVM to create a heapdump on OOME conditions. If
you
have a memory leak, you can then analyze the heapdump using a variety
of tools (I like YourKit). There are a number of tools which can also
perform further analysis on runtime data (memory allocations, method
execution, etc).
Something like the following should work (set max heap and max perm
to suit your environment):
-Xmx512m -XX:MaxPermSize=128m -verbose:gc -XX:+PrintGCDetails -XX:
+HeapDumpOnOutOfMemoryError
--kevan
This is good to know.
It's probably too early for me to be thinking of dropping $500 for a
profiler like YourKit, but just leveraging the command line options
as you
suggest should help in keeping things from getting out of control.
I appreciate your sharing this. Thanks!
Heh.
/me confesses that I use YourKit under an Open Source license (e.g.
free). I also mainly use it for memory leak diagnosis...
There are free tools that will analyze the GC statistics. However, I
generally just eyeball things until I'm really getting serious about
tuning... HPjtune is pretty good -- http://www.hp.com/products1/unix/java/java2/hpjtune/
--kevan
--kevan