Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Garbage collector problem

Reply
Thread Tools

Garbage collector problem

 
 
Colt
Guest
Posts: n/a
 
      11-15-2003
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.


 
Reply With Quote
 
 
 
 
Ben_
Guest
Posts: n/a
 
      11-15-2003
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.


 
Reply With Quote
 
 
 
 
Filip Larsen
Guest
Posts: n/a
 
      11-15-2003
"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


 
Reply With Quote
 
Ben_
Guest
Posts: n/a
 
      11-15-2003
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).


 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      11-15-2003
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.

 
Reply With Quote
 
ak
Guest
Posts: n/a
 
      11-16-2003
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.
>
>



 
Reply With Quote
 
Filip Larsen
Guest
Posts: n/a
 
      11-16-2003
"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


 
Reply With Quote
 
ak
Guest
Posts: n/a
 
      11-16-2003

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


 
Reply With Quote
 
John C. Bollinger
Guest
Posts: n/a
 
      11-17-2003
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


 
Reply With Quote
 
Tim Ward
Guest
Posts: n/a
 
      11-18-2003
"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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange .NET garbage collector problem shiretu ASP .Net Building Controls 0 01-10-2006 05:40 PM
JNI problem with Garbage Collector ? bart59 Java 0 06-17-2004 07:34 AM
OutOfMemoryException Error: Garbage Collector doesn't release memory to OS Pyramis ASP .Net 0 01-25-2004 04:37 PM
DVD Verdict reviews: ALIEN: COLLECTOR'S EDITION, ALIEN3: COLLECTOR'S EDITION, and more! DVD Verdict DVD Video 0 12-15-2003 10:05 AM
Garbage Collector Debugging Rob Tillie ASP .Net 11 08-18-2003 10:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57