Getting GC output in Tomcat

Discussion in 'Java' started by Gugle, Dec 13, 2006.

  1. Gugle

    Gugle Guest

    Hi all,
    I want to get Garbage collector ouput in Tomcat 5.x. Can someone
    explain how to get this going?
    I tried using "-verbose:gc" in CATALINA_OPTS. But it doesn't seem to
    work. Any ideas??
    Gugle, Dec 13, 2006
    #1
    1. Advertising

  2. Gugle wrote:
    ....
    > I want to get Garbage collector ouput in Tomcat 5.x.


    Why? Do you suspect an application has a
    memory leak?

    Andrew T.
    Andrew Thompson, Dec 13, 2006
    #2
    1. Advertising

  3. Gugle

    Gugle Guest

    Yes...I keep getting OutOfMemoryException...wud like to c how often the
    gc is running..


    Andrew Thompson wrote:
    > Gugle wrote:
    > ...
    > > I want to get Garbage collector ouput in Tomcat 5.x.

    >
    > Why? Do you suspect an application has a
    > memory leak?
    >
    > Andrew T.
    Gugle, Dec 14, 2006
    #3
  4. Gugle wrote:

    Please refrain from top-posting. I find it most confusing.

    > Andrew Thompson wrote:
    > > Gugle wrote:
    > > ...
    > > > I want to get Garbage collector ouput in Tomcat 5.x.

    > >
    > > Why? Do you suspect an application has a
    > > memory leak?

    ....
    > Yes...I keep getting OutOfMemoryException...


    Note that calling GC will *not* *fix* a memory leak.

    I feel the time is better spent finding the source of
    the memory leak, than worrying about when Tomcat
    is calling the (largely pointless) GC.

    What sorts of things is the server doing (accessing D/B,
    image editing etc.)?

    How fast does the problem manifest? Does it take
    101 days to hit 'max memory' and crash, or is it
    crashing every couple of hours?

    Andrew T.
    Andrew Thompson, Dec 14, 2006
    #4
  5. Gugle

    Gugle Guest

    Hi Andrew,
    Yes. I do know that calling GC will not help. But I'm facing a weird
    problem..The same app is being run on two systems and the same requests
    are made on both the systems....the amt of data handled is also the
    same in both...for e.g., if I'm sending the same 100 requests to both
    the servers, all 100 go through in one but the other crashes in between
    complaining of outOfMemoryException...both the systems have the same
    memory settings...so I was wondering if there is some problem with the
    GC on the crashing system...

    thanks for your help..
    Gugle, Dec 14, 2006
    #5
  6. Gugle wrote:
    .....
    > Yes. I do know that calling GC will not help. But I'm facing a weird
    > problem..The same app is being run on two systems and the same requests
    > are made on both the systems....the amt of data handled is also the
    > same in both...for e.g., if I'm sending the same 100 requests to both
    > the servers, all 100 go through in one but the other crashes in between
    > complaining of outOfMemoryException...both the systems have the same
    > memory settings...so I was wondering if there is some problem with the
    > GC on the crashing system...


    That seems like a much better description from
    which to start, but it now tells me I am beyond
    my area of expertise.

    It might also be relevant/helpful to add the Java
    versions and Tomcat versions on both systems,
    and a little more detail of the 'requests' and their
    responses.

    E.G. what is the format of the data being passed around?
    (Strings/form data, images, 3D models..?)
    What is the processing that is done (D/B requests,
    image translation and resizing, delivering a model as
    data to an application?).

    Andrew T.
    Andrew Thompson, Dec 14, 2006
    #6
  7. Gugle

    Daniel Dyer Guest

    On Thu, 14 Dec 2006 10:50:40 -0000, Gugle <> wrote:

    > Hi Andrew,
    > Yes. I do know that calling GC will not help. But I'm facing a weird
    > problem..The same app is being run on two systems and the same requests
    > are made on both the systems....the amt of data handled is also the
    > same in both...for e.g., if I'm sending the same 100 requests to both
    > the servers, all 100 go through in one but the other crashes in between
    > complaining of outOfMemoryException...both the systems have the same
    > memory settings...so I was wondering if there is some problem with the
    > GC on the crashing system...
    >
    > thanks for your help..
    >


    Get a profiler and find out what kind of objects are occupying all that
    memory and where they are created.

    Eclipse and NetBeans have free profilers, or you could get a trial version
    of a commercial product (such as JProfiler, JProbe or YourKit).

    Dan.

    --
    Daniel Dyer
    http://www.uncommons.org
    Daniel Dyer, Dec 14, 2006
    #7
  8. Gugle

    Gugle Guest

    Hello all,
    I've used the Eclipse profiler and confirmed that there is no memory
    leak...because it is running perfectly fine in one system....the app
    gets HTTP requests for data over a period of time....the data is in
    files which have a proprietary format(no database used)...and the data
    is returned as graphs/tables etc...

    Version of Java is 1.4.2.11 and tomcat version is 5.0.028
    Gugle, Dec 14, 2006
    #8
  9. Gugle

    Daniel Dyer Guest

    On Thu, 14 Dec 2006 13:36:45 -0000, Gugle <> wrote:

    > Hello all,
    > I've used the Eclipse profiler and confirmed that there is no memory
    > leak...because it is running perfectly fine in one system....


    Did you profile it while it was running on the system that it has been
    failing on? Profiling it on the other system wouldn't be helpful because
    you need to reproduce the problem while the profiler is attached. Finding
    out what is filling up the heap should help identify the cause of the
    problem. There is presumably some subtle difference between the two
    systems that is triggering this behaviour. It could be a bug in your
    application, or a bug in Tomcat.

    Dan.

    --
    Daniel Dyer
    http://www.uncommons.org
    Daniel Dyer, Dec 14, 2006
    #9
  10. Gugle

    Guest

    YourKit Java Profiler http://www.yourkit.com shows graph of GC
    activity: number of invocations, invocations per second (minor and
    major collections), number of invocations in last minute, etc.

    BR, Vladimir
    , Dec 15, 2006
    #10
  11. Gugle

    Juha Laiho Guest

    "Gugle" <> said:
    >Hi all,
    >I want to get Garbage collector ouput in Tomcat 5.x. Can someone
    >explain how to get this going?
    >I tried using "-verbose:gc" in CATALINA_OPTS. But it doesn't seem to
    >work. Any ideas??


    Depending on your JVM version, you can log the gc output to a separate file:
    "-Xloggc:filename" among the JVM startup options is your friend.
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
    Juha Laiho, Dec 17, 2006
    #11
  12. Gugle

    Gugle Guest

    Thanx Juha!


    Juha Laiho wrote:
    > "Gugle" <> said:
    > >Hi all,
    > >I want to get Garbage collector ouput in Tomcat 5.x. Can someone
    > >explain how to get this going?
    > >I tried using "-verbose:gc" in CATALINA_OPTS. But it doesn't seem to
    > >work. Any ideas??

    >
    > Depending on your JVM version, you can log the gc output to a separate file:
    > "-Xloggc:filename" among the JVM startup options is your friend.
    > --
    > Wolf a.k.a. Juha Laiho Espoo, Finland
    > (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    > PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    > "...cancel my subscription to the resurrection!" (Jim Morrison)
    Gugle, Dec 18, 2006
    #12
    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. %=zerointeractive.it%

    [TOMCAT] Tomcat crashes

    %=zerointeractive.it%, Jan 22, 2004, in forum: Java
    Replies:
    1
    Views:
    416
    Erwin Moller
    Jan 22, 2004
  2. Christos Gravvanis
    Replies:
    0
    Views:
    2,046
    Christos Gravvanis
    Jul 7, 2004
  3. Joe
    Replies:
    0
    Views:
    1,676
  4. Martin Eberle
    Replies:
    2
    Views:
    829
  5. Hunt Jon
    Replies:
    2
    Views:
    110
    Phlip
    Dec 18, 2008
Loading...

Share This Page