What is the difference between G1GC options -XX:ParallelGCThreads vs -XX:ConcGCThreads
Asked Answered
T

2

12

When configuring the G1GC we have two kinds of thread count:

-XX:ParallelGCThreads and -XX:ConcGCThreads.

What is the difference? How they are going to impact? Any reference is appreciated.

Toluol answered 10/1, 2019 at 9:57 Comment(0)
N
23

G1 algorithm has phases which some of them are "stop the world" phases that stops the application during garbage collection, and it also has phases which happens concurrently while application is running(candidate marking etc..), with that information in mind:

ParallelGCThreads option affects the number of threads used for phases when application threads are stopped, and the ConcGCThreads flag affects the number of threads used for concurrent phases.

Novitiate answered 10/1, 2019 at 10:18 Comment(0)
P
1

It is the setting or precisely say JVM tuning settings... we inform JVM to use how many threads in that particular type of Garbage Collection.

I hope you are already aware of what is Garbage Collection, so when JVM runs Garbage Collection, it depends on what algorithm is set for your JVM as default collector.

You might already be knowing that there are various kind of Garbage collectors available, like G1, CMS, etc.

So, based on your setting (here, number of threads) GC algorithm will try to use that many threads for heap cleanup. While JVM runs FULL GC, it halts other threads processing.

Now suppose, your application is live and performing very heavy tasks, multiple users using it for multiple purpose (say very busy app), and JVM running FULL GC now, then in that case, all worker threads will come to a pause and GC will clean up. In this period, if all threads are acquired by JVM, then user will see delay in response. So, you can tell JVM, hey Use only that much (number) thread on that type (CMS or Parallel) of garbage collection run.

To get more on GC types and how they differ, whats suits your needs, refer some good article and docs from oracle.

Here is one reference for the options you mentioned.

-XX:ParallelGCThreads: Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running.

-XX:ConcGCThreads: Number of threads concurrent garbage collectors will use. The default value varies with the platform on which the JVM is running.

Puppis answered 10/1, 2019 at 10:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.