Java Garbage Collection closes all Java processes

We run multiple instances of the server process in a single Linux window. The box has 8 cores and 16 GB of RAM. I start each process using the -Xincgc option using Java 1.6.

We use various timers throughout the application that track the time for various tasks. When garbage collection occurs, I notice that every java process on the box prints that any task it was working with at that time was slow.

It does not linger for a long time, maybe 100-300 ms or so, but latency is a huge factor for this. He also does not stop constantly, just periodically.

When garbage collection happens, does it stop any java process from getting any time? If so, is there a way around this? Should I use different GC options?

UPDATE:

Just to be clear, it doesn't bother me that one process has stalled while the GC is going on. I can adjust the settings or optimize for this case. I'm just wondering why EVERY running Java process seems to stall at the same time that I thought they were more or less independent.

+6
source share
5 answers

when you use -Xincgc according to this sun documentation

Parallel low-level collector: this collector is used if -Xincgc ™ or -XX: + UseConcMarkSweepGC is passed on the command line. A parallel collector is used to collect the generated generation and performs most of the collection simultaneously with the execution of the application. The application is temporarily suspended during the collection .

You may need to consider other alternatives, such as a bandwidth collector. Above the documentation there is a good description when, which collection will be useful.

+3
source

Java v 1.6 should be smart and work, which GC is the best.

I would recommend reading this: Garbage collection in Java 6

Summary: try any of them (but not both):

  • -XX: + UseParallelGC
  • -XX: + ExplicitGCInvokesConcurren
+3
source

The problem you are encountering is Full Garbage Collection, also known as Stop Global GC. When this happens, the java application almost stops working. Check this topic for some pointers:

Configure garbage collection for low latency

+2
source

GC latency is one of the problems inherent in garbage collectors such as Java. This is one of the reasons that high-speed systems, such as stock trading systems, are written in C ++ rather than Java or C #. 100 ms sounds correct for a large GC operation.

0
source

If you use the JConsole tool to view the activity of your memory, you will see that garbage collection is usually a significant activity. You can do some profiling to see if there are other bottlenecks. In addition, most garbage collection algorithms have quite a few configuration options available to them.

Finally, I remember that the situation with which we had been dealing for a long time led us to the fact that the approximation of the minimum and maximum memory settings was useful (at least in our case). This caused more frequent garbage collection, but they were not so intrusive.

Hope this helps.

0
source

Source: https://habr.com/ru/post/909208/


All Articles