Garbage collector problem

Discussion in 'Java' started by Colt, Nov 15, 2003.

  1. Colt

    Colt Guest

    Hi,

    I am running a java application using RMI servers and clients. Sometimes my
    server freezes during at least 1 minute and it doesn't accept connexions
    anymore during this time.
    I think it's a garbage collector problem (it executes every 2 minutes) but I
    don't know how to solve that problem. I tried to make it run every 20
    minutes but it only postpones the problem.
    Is it possible to run garbage collector in parallel without my server to
    freeze ? Also, what is the risk if I disable garbage collection ?
    The JDK I use is 1.3.1.

    Thanks for your advises,
    O.
     
    Colt, Nov 15, 2003
    #1
    1. Advertising

  2. Colt

    Ben_ Guest

    GC is not bad and you need to learn to live with it.

    A rule of thumb is:
    .. if you increase the heap size for your server, it will GC less often but
    it will take more time.
    .. if you decrease it, it will happend more frequently and take less time.

    Try to tune it (Xmx -Xms parameters on the command-line, but it may vary
    from one JDK to the other) and see the effect.
     
    Ben_, Nov 15, 2003
    #2
    1. Advertising

  3. Colt

    Filip Larsen Guest

    "Colt" wrote

    > I am running a java application using RMI servers and clients.

    Sometimes my
    > server freezes during at least 1 minute and it doesn't accept

    connexions
    > anymore during this time.
    > I think it's a garbage collector problem (it executes every 2 minutes)

    but I
    > don't know how to solve that problem. I tried to make it run every 20
    > minutes but it only postpones the problem.
    > Is it possible to run garbage collector in parallel without my server

    to
    > freeze ? Also, what is the risk if I disable garbage collection ?
    > The JDK I use is 1.3.1.


    Without knowing any more than you just stated above, I would *guess*
    that the freeze you see is not caused by garbage collection (at least
    not directly), but probably more like the accepting thread directly or
    indirectly via another thread is blocked doing I/O with a timeout of
    around a minute.

    If you really can correlate the running of GC with the freeze, then
    maybe a finalize method somewhere is doing that I/O in an attempt to
    clean up. Or perhaps it is the DGC (Distributed GC) that mess something
    up if you distribute a lot of object to your clients or clients become
    unresponsive at inappropriate times?


    Regards,
    --
    Filip Larsen
     
    Filip Larsen, Nov 15, 2003
    #3
  4. Colt

    Ben_ Guest

    FYI, IBM JDK has the ability to do a ThreadDump while the application is
    running, so you can see what each thread is doing at a given moment (I don't
    know though if other JDKs support this feature as well, nor if you can get
    one to try).
     
    Ben_, Nov 15, 2003
    #4
  5. Colt wrote:
    > I am running a java application using RMI servers and clients. Sometimes my
    > server freezes during at least 1 minute and it doesn't accept connexions
    > anymore during this time.
    > I think it's a garbage collector problem (it executes every 2 minutes) but I


    I doubt that. 2 Minutes is *way* longer than the GC usually takes. The only
    way I can imagine GC would take 2 minutes is either if it had to do a lot
    of swapping.

    > Is it possible to run garbage collector in parallel without my server to
    > freeze ?


    Yes, there is an "incremental garbage collector" which does just that.
    It can be used with a startup switch, -incgc I think it was. Not sure
    if it's available in 1.3 though.

    > Also, what is the risk if I disable garbage collection ?


    Not a risk; the *certainty* that your app will die with an OutOfMemoryError,
    probably very quickly.
     
    Michael Borgwardt, Nov 15, 2003
    #5
  6. Colt

    ak Guest

    First check your CPU load during your server freezes.

    I have seen already such problem. We had Solaris as operation system.
    It was really strange - our java server app had such "time leaks",but CPU
    usage during this was 0!
    The programm was just not sheduled for running at this time, who can say me
    why? May be Sun?


    "Colt" <> schrieb im Newsbeitrag
    news:3fb65c09$0$239$...
    > Hi,
    >
    > I am running a java application using RMI servers and clients. Sometimes

    my
    > server freezes during at least 1 minute and it doesn't accept connexions
    > anymore during this time.
    > I think it's a garbage collector problem (it executes every 2 minutes) but

    I
    > don't know how to solve that problem. I tried to make it run every 20
    > minutes but it only postpones the problem.
    > Is it possible to run garbage collector in parallel without my server to
    > freeze ? Also, what is the risk if I disable garbage collection ?
    > The JDK I use is 1.3.1.
    >
    > Thanks for your advises,
    > O.
    >
    >
     
    ak, Nov 16, 2003
    #6
  7. Colt

    Filip Larsen Guest

    "ak" wrote

    > First check your CPU load during your server freezes.
    >
    > I have seen already such problem. We had Solaris as operation system.
    > It was really strange - our java server app had such "time leaks",but

    CPU
    > usage during this was 0!
    > The programm was just not sheduled for running at this time, who can

    say me
    > why? May be Sun?


    It is almost a definition that a process or thread that is blocked on
    I/O do not use CPU. Conversely, if you see a live process or thread that
    uses no CPU at all you can be pretty sure that it is because it is
    blocked on I/O. There is nothing strange about it. Notice that blocking
    can include memory swapping done by the operating system, although this
    rarely blocks a process for long on an otherwise working machine.


    Regards,
    --
    Filip Larsen
     
    Filip Larsen, Nov 16, 2003
    #7
  8. Colt

    ak Guest

    "Filip Larsen" <> schrieb im Newsbeitrag
    news:bp7md7$1r95$...
    > "ak" wrote
    >
    > > First check your CPU load during your server freezes.
    > >
    > > I have seen already such problem. We had Solaris as operation system.
    > > It was really strange - our java server app had such "time leaks",but

    > CPU
    > > usage during this was 0!
    > > The programm was just not sheduled for running at this time, who can

    > say me
    > > why? May be Sun?

    >
    > It is almost a definition that a process or thread that is blocked on
    > I/O do not use CPU. Conversely, if you see a live process or thread that
    > uses no CPU at all you can be pretty sure that it is because it is
    > blocked on I/O.


    I/O blocking while accessing harddisk? Its really strange!

    > There is nothing strange about it. Notice that blocking
    > can include memory swapping done by the operating system, although this
    > rarely blocks a process for long on an otherwise working machine.

    Hmm, this mashine had really much memory - 1 GB I think.
     
    ak, Nov 16, 2003
    #8
  9. ak wrote:

    > "Filip Larsen" <> schrieb im Newsbeitrag
    > news:bp7md7$1r95$...


    [...]

    >>It is almost a definition that a process or thread that is blocked on
    >>I/O do not use CPU. Conversely, if you see a live process or thread that
    >>uses no CPU at all you can be pretty sure that it is because it is
    >>blocked on I/O.

    >
    >
    > I/O blocking while accessing harddisk? Its really strange!


    Not necessarilly. There are several factors that could cause something
    like that, from OS-level file locking to heavy disk activity, to
    Java-level synchronization. It could be a Java or OS bug, but there is
    nowhere near enough information for me to conclude that.

    >>There is nothing strange about it. Notice that blocking
    >>can include memory swapping done by the operating system, although this
    >>rarely blocks a process for long on an otherwise working machine.

    >
    > Hmm, this mashine had really much memory - 1 GB I think.


    Irrelevant. The question is not how much physical memory is installed,
    but how much is available, the demands of other applications, and the
    details of the OS' memory management subsystem. An OS might swap out
    portions of an idle application's code or data irregardless of other
    applications' current demand for memory.


    John Bollinger
     
    John C. Bollinger, Nov 17, 2003
    #9
  10. Colt

    Tim Ward Guest

    "Colt" <> wrote in message
    news:3fb65c09$0$239$...
    >
    > I am running a java application using RMI servers and clients. Sometimes

    my
    > server freezes during at least 1 minute and it doesn't accept connexions
    > anymore during this time.
    > I think it's a garbage collector problem (it executes every 2 minutes) but

    I
    > don't know how to solve that problem. I tried to make it run every 20
    > minutes but it only postpones the problem.
    > Is it possible to run garbage collector in parallel without my server to
    > freeze ? Also, what is the risk if I disable garbage collection ?
    > The JDK I use is 1.3.1.


    If it is the garbage collector (as others have said it might not be) then
    you have the following choices:

    (1) live with it

    (2) spend many happy hours fiddling with the garbage collector tuning
    parameters and quite possibly achieving nothing much

    (3) rewrite in a proper language.

    Seriously, if you do *not* have vast amounts of spare RAM you don't mind
    wasting and/or if you *can't* cope with garbage collection happening at
    uncontrolled, usually inconvenient, times, then learn how to do your own
    memory allocation and use a language more suited to your application's
    requirements.

    --
    Tim Ward
    Brett Ward Limited - www.brettward.co.uk
     
    Tim Ward, Nov 18, 2003
    #10
    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. Rob Tillie

    Garbage Collector Debugging

    Rob Tillie, Aug 15, 2003, in forum: ASP .Net
    Replies:
    11
    Views:
    1,772
    JerryK
    Aug 18, 2003
  2. Pyramis
    Replies:
    0
    Views:
    411
    Pyramis
    Jan 25, 2004
  3. bart59
    Replies:
    0
    Views:
    509
    bart59
    Jun 17, 2004
  4. Will Hartung

    Garbage Collector Tuning?

    Will Hartung, Sep 8, 2004, in forum: Java
    Replies:
    3
    Views:
    2,103
    Kevin McMurtrie
    Sep 11, 2004
  5. shiretu

    Strange .NET garbage collector problem

    shiretu, Jan 10, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    124
    shiretu
    Jan 10, 2006
Loading...

Share This Page