> It seems the consensus is that the slow responsiveness of Java apps is
> mostly due to an issue with Swing and how it is used rather than with
> garbage collection. That sounds very encouraging.

Determining whether the GC is responsible is pretty easy. Just runt
with -verbose:gc (or -XX:+PrintGC) and watch the pauses.

Unless your application has a very big heap I highly doubt GC is the problem.

Whenever it is, you also have several options. The default GC
selection in Sun's JVM is basically not at all catered to low-latency,
instead focusing on throughput.

Sun's JVM has the CMS collector which is targetted at limiting pauses
with large heaps, and there is the upcoming G1GC collector. Non-Sun
JVM:s have their own GC:s.

In general, when people make off-hand remarks blaming the GC for
random things, they are usually wrong and do not know what they are
talking about. Until someone shows they have specifically identified
the GC, I would take it with a grain of salt.

If you do have GC problems you can select things other than the
default collector. A potentially good starting point for CMS is:

 -XX:+UseConcMarkSweepGC \
        -XX:+CMSIncrementalMode \
        -XX:+CMSIncrementalPacing \
        -XX:+PrintGCDetails \
        -XX:+PrintGCTimeStamps \
        -XX:+DisableExplicitGC \
        -XX:+CMSParallelRemarkEnabled \
        -XX:+TraceClassUnloading

And for G1GC:

 -XX:+UnlockExperimentalVMOptions \
     -XX:+UseG1GC \
     -XX:+DisableExplicitGC \
     -XX:MaxGCPauseMillis=10 \
     -XX:GCPauseIntervalMillis=20 \
     -XX:+G1ParallelRSetUpdatingEnabled \
     -XX:+G1ParallelRSetScanningEnabled \

Often you will also get better behavior by using appropriate -Xms/-Xmx
options. The above are just examples of course and not "the" way to do
it or anything.

The -XX:+DisableExplicitGC is because some software authors try to be
"smart" and insert System.gc() calls at "appropriate" points. They
tend to fail, so if you select a GC that actually does handle your
case with minimal pauses you also want to disable the artificially
induced full GC:s.

-- 
/ Peter Schuller
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to