Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java Gargabe Collector type

Posted on 2015-01-05
1
Medium Priority
?
221 Views
Last Modified: 2015-01-09
Given the following Java contained on Red hat 6.x

java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=2147483648 -XX:MaxHeapSize=32037767584 -XX:+PrintCommandLineFlags -XX:+UseCompressedOops -XX:+UseParallelGC
java version "1.7.0_71"
OpenJDK Runtime Environment (rhel-2.5.3.1.el6-x86_64 u71-b14)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Open in new window


So this version is using Parallel GC by default.

What exactly is Parallel GC (other than a multi-threaded GC)  compared to the other types of GC?

Thanks
0
Comment
Question by:Anthony Lucia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

by:
dpearson earned 2000 total points
ID: 40532084
The classic - single threaded - Java GC works by a "stop the world" model.  This means when the GC needs to run, it stops all threads, figures out all the garbage in the system, removes it - repacking memory down, and then restarts the threads.

This works well in relatively small memory systems (e.g. 1GB or less) but as memory has risen to 32GB or 64GB systems it creates a problem because this "GC pause" gets longer and longer.  You can easily see systems waiting for 2 or 3 seconds while GC happens - which may become noticeable to users.

So the folks at Sun (Oracle) have been working on replacements.  These other algorithms are all multi-threaded and the basic idea is to try to reduce those pauses.  So they try to determine where the garbage is and clean up that garbage without having to stop all threads as much.  They still all involve some sort of pauses, but hopefully shorter ones.

The algorithms themselves can be quite complex and are interesting to delve into, but the basic idea isn't hard to grasp that you could use background threads to do some of the work.

However, the main thing to be aware of if you're running a system using one of the parallel collectors is that it involves a trade-off.  These collectors are designed so that the background threads clean up garbage more rapidly than new garbage is created.  If that assumption fails (you are creating lots of new garbage objects, there's too little CPU time assigned to the background threads etc.) then they can be required to do a "stop the world" garbage collection and that collection can be catastrophically bad - as in it could take 30 secs on a large RAM machine.

So if you see very occasional but very long pauses, this could be the cause.  Something to monitor for.
You can also turn on logging for the GC and see exactly what it's doing, how long it's pausing etc:
https://blog.codecentric.de/en/2014/01/useful-jvm-flags-part-8-gc-logging/

Doug
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question