From: Federico Cozzi on
Hello,
I am trying to tune the garbage collector of a Glassfish-based web
application.
I have collected tons of gc logs and heap sizes. The logs clearly show
that minor collections (young generation) do not collect much and the
heap size keeps increasing until a full garbage collection kicks in.
The heap is 2gb (-Xms and -Xmx). Heap occupancy starts at
approximately 0.5 gb, then it ramps up to 1.5 gb until the full
garbage collection is triggered and it goes back to 0.5 gb. Minor
collections do reclaim some heap but very little: if I plot time
versus heap occupancy on a graph, I get a sawtooth wave (first picture
of http://en.wikipedia.org/wiki/Sawtooth_wave).

This of course could be due to our application's object allocation
pattern. It could be that all our objects are medium-lived, that is
they survive a few young-generation collections until they are
promoted to old-generation, and are collected only during full
collections.

Is there any tool to analyze which objects do not die young?
It would be great to plot a histogram with the average life-span of
objects (grouped by class) - is it possible?

Thanks,
Federico
From: Lew on
On May 4, 5:21 am, Federico Cozzi <f.co...(a)gmail.com> wrote:
> Hello,
> I am trying to tune the garbage collector of a Glassfish-based web
> application.
> I have collected tons of gc logs and heap sizes. The logs clearly show
> that minor collections (young generation) do not collect much and the
> heap size keeps increasing until a full garbage collection kicks in.
> The heap is 2gb (-Xms and -Xmx). Heap occupancy starts at
> approximately 0.5 gb, then it ramps up to 1.5 gb until the full
> garbage collection is triggered and it goes back to 0.5 gb. Minor
> collections do reclaim some heap but very little: if I plot time
> versus heap occupancy on a graph, I get a sawtooth wave (first picture
> ofhttp://en.wikipedia.org/wiki/Sawtooth_wave).
>
> This of course could be due to our application's object allocation
> pattern. It could be that all our objects are medium-lived, that is
> they survive a few young-generation collections until they are
> promoted to old-generation, and are collected only during full
> collections.
>
> Is there any tool to analyze which objects do not die young?
> It would be great to plot a histogram with the average life-span of
> objects (grouped by class) - is it possible?
>

<http://java.sun.com/javase/6/docs/technotes/guides/visualvm/
heapdump.html>
<http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html>

If a tenured object holds a reference to a young object the latter
will not be collected during a minor collection.

--
Lew
From: Federico Cozzi on
On 4 Mag, 21:32, Lew <l...(a)lewscanon.com> wrote:
> > Is there any tool to analyze which objects do not die young?
> > It would be great to plot a histogram with the average life-span of
> > objects (grouped by class) - is it possible?
> <http://java.sun.com/javase/6/docs/technotes/guides/visualvm/
> heapdump.html>
> <http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html>

Is heap dumping a dangerous action on a running production server?
Unfortunately we are using Java 1.5 where VisualVM is not available.
Can I attach VisualVM to a running 1.5 JVM?

> If a tenured object holds a reference to a young object the latter
> will not be collected during a minor collection.

Thanks for the tips.

Federico
From: John B. Matthews on
In article
<c0ff65a7-caf1-493b-ae22-f3ee484fe03a(a)a21g2000yqn.googlegroups.com>,
Federico Cozzi <f.cozzi(a)gmail.com> wrote:

> On 4 Mag, 21:32, Lew <l...(a)lewscanon.com> wrote:
> > > Is there any tool to analyze which objects do not die young?
> > > It would be great to plot a histogram with the average life-span of
> > > objects (grouped by class) - is it possible?
> > <http://java.sun.com/javase/6/docs/technotes/guides/visualvm/
> > heapdump.html>
> > <http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html>
>
> Is heap dumping a dangerous action on a running production server?
> Unfortunately we are using Java 1.5 where VisualVM is not available.
> Can I attach VisualVM to a running 1.5 JVM?
>
> > If a tenured object holds a reference to a young object the latter
> > will not be collected during a minor collection.
>
> Thanks for the tips.

It works on Mac OS X 10.5.8. A Java program running in a 1.5 JVM appears
promptly in the "Applications" menu, under "Local".

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>