[EMAIL PROTECTED] wrote:

> I know this question is a bit general. but I am very interested in which
> Sun Hotspot  jvm options you are using to start up tomcat.
> (like -server -Xincgc ...........)
> And what impact they had/have on performance.
>
> I am trying to tune garbage collection and performance and am a bit lost
> ;>)

Except for -Xms and -Xmx, my recommendation is that twiddling with JVM
command-line parameters should be the *last* thing you try.  (Assuming that
you have access to the source code of your servlet classes, of course.)

I would set -Xmx as high as reasonable for your physical memory
configuration.  And definitely use -server.

Other than that, IMHO you're going to get a *lot* more improvement by
focusing on your code, and many JVM command-line parameters will in fact
hurt performance unless you really know what you're doing.

What problems are you encountering?  Is your servlet just slow, or does it
run out of memory?  If the former, you really need to get one of the
optimizing tools available (several have free evaluation periods) or you can
use -Xrunhprof and crawl through the profiler output yourself (I'm getting
very good at that <grin>).

If it runs out of memory, same approach, actually.  Either a profiling tool
or -Xrunhprof will let you identify where your memory consumption is going.
We have a servlet application that was running out of memory, which we
addressed by using soft references to let the GC reclaim objects that we
were willing to recreate if necessary.

Also, keep in mind Hotspot usually gets better the longer it runs; don't
time the first few requests you make from it...

A colleague actually recently asked about documentation about soft
references and GC in general; this is what I sent him:

<http://www.artima.com/insidejvm/ed2/ch09GarbageCollection01.html> This is
really good.  Skip forward to part 14 and the following parts (although the
whole chapter is pretty good).

<http://developer.java.sun.com/developer/technicalArticles/ALT/RefObj/> Also
pretty good.

Some interesting papers about GC, GC algorithms, HotSpot performance:

<http://java.sun.com/docs/hotspot/gc/index.html>
<http://java.sun.com/docs/hotspot/PerformanceFAQ.html>
<http://java.sun.com/products/hotspot/2.0/docs.html>
<http://developer.java.sun.com/developer/technicalArticles/Networking/HotSpot/>

dwh

Reply via email to