Garbage collector problem

C

Colt

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.
 
B

Ben_

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.
 
F

Filip Larsen

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,
 
B

Ben_

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).
 
M

Michael Borgwardt

Colt said:
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.
 
A

ak

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?
 
F

Filip Larsen

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,
 
A

ak

Filip Larsen said:
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.
 
J

John C. Bollinger

ak said:
[...]
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.
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
(e-mail address removed)
 
T

Tim Ward

Colt said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top