Heap generations and garbage collector tuning - which tools?

Discussion in 'Java' started by Federico Cozzi, May 4, 2010.

  1. 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
    Federico Cozzi, May 4, 2010
    #1
    1. Advertising

  2. Federico Cozzi

    Lew Guest

    On May 4, 5:21 am, Federico Cozzi <> 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
    Lew, May 4, 2010
    #2
    1. Advertising

  3. On 4 Mag, 21:32, Lew <> 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
    Federico Cozzi, May 4, 2010
    #3
  4. In article
    <>,
    Federico Cozzi <> wrote:

    > On 4 Mag, 21:32, Lew <> 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>
    John B. Matthews, May 5, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Blewett
    Replies:
    0
    Views:
    490
    Richard Blewett
    Oct 31, 2004
  2. oerz
    Replies:
    2
    Views:
    346
  3. Will Hartung

    Garbage Collector Tuning?

    Will Hartung, Sep 8, 2004, in forum: Java
    Replies:
    3
    Views:
    2,084
    Kevin McMurtrie
    Sep 11, 2004
  4. Nicolas Fleury

    Garbage collector and threads

    Nicolas Fleury, Mar 1, 2004, in forum: Python
    Replies:
    9
    Views:
    372
    Nicolas Fleury
    Mar 2, 2004
  5. Mohammad Javad Dousti

    Garbage collector and references

    Mohammad Javad Dousti, Oct 13, 2007, in forum: Java
    Replies:
    7
    Views:
    345
Loading...

Share This Page