Question

I have some questions about the Garbage Collection concept of Java when working in distributed systems:

  1. Why is mark-and-sweep GC not recommended in RMI system?

  2. Is it possible to run the GCs "Reference counting"-algorithm in a parallel thread without suspending the application itself?

Thanks in advance.

Was it helpful?

Solution

Why is mark-and-sweep GC not recommended in RMI system?

I don't believe it is.

Is it possible to run the GCs "Reference counting"-algorithm in a parallel thread without suspending the application itself?

While reference counting is not forbidden as a mode of GC, it is not supported by any JVM AFAIK as it has many limitations including performance, memory usage and circular references. I know C++ uses it but is a hack by comparison to what the managed memory systems do.

Note: MappedByteBuffers use reference counts for some purposes. This is an isolated use case.

There is a purely concurrent collector, the most popular of which is available from Azul. http://www.azulsystems.com/zing/pgc Note: it should really be called "pause less" instead of "pauseless" as it dramatically reduces GC related pauses, but doesn't eliminate them completely. (It is often used for low latency trading system in Java.)

If you are really concerned about GC pauses, the best thing to do is avoid using Java RMI. It is designed to be a "full fat" fully featured RPC which does lots of things you possibly never thought of doing. The Serialization isn't very efficient and generates lots of garbage. Using a more targeted RPC solution can reduce garbage by 90 - 99% or much better.

OTHER TIPS

Check Java's web site on this: http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html

Basically there are several garbage collectors available. I've been running Parallel collector on production system for quite a while, but googling around will show you that G1 is also showing great promises.

Why is mark-and-sweep GC not recommended in RMI system?

I don't know what this means. RMI uses a distributed garbage collection algorithm (DGC), from Modula-3, which uses reference-counting, among other things, but that's completely separate from JVM garbage collection. I've never hear of the recommendation you mention. Citation please. I'm not sure the statement even makes sense. Changing 'recommended' to 'convenient' as per your comment doesn't really help.

Is it possible to run the GCs "Reference counting"-algorithm in a parallel thread without suspending the application itself?

There is no reference counting algorithm in current JVMs, but GC does run in its own thread as far as I am aware. So does RMI DGC.

In short your question doesn't make sense.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top