Recently, I was turning jvm options for getting performance improving up.
When I learned the GC option ParallelGCThreads
, I got a problem.
I think the best value of ParallelGCThreads
is the number of logical processors.But on my 32 cores machine, the default value is 23. From oracle's article Garbage First Garbage Collector Tuning, it tells that then processor count is more than 8, the default value of ParallelGCThreads
is 5/8 of processors.
So, why it is 5/8 instead of 8/8?
Asked
Active
Viewed 5,160 times
4

Expressway Retrograding
- 144
- 1
- 7
-
You want all your logical cores to run the GC? Why on earth would you want that? Do you want your CPU to be doing work or collect garbage? – Kayaman Aug 22 '18 at 12:01
-
1Yes, more cpu do gc leading to less time of stopping the world – Expressway Retrograding Aug 22 '18 at 12:21
-
Less time for the CPU to do actual work too. It would be a stupid default to use all cores for garbage collection. – Kayaman Aug 22 '18 at 12:23
-
But then the number of core is less or equals to 8, the default count of gc thread is the number of core. – Expressway Retrograding Aug 22 '18 at 12:35
-
1@Kayaman he's talking about `ParallelGCThreads`, not `ConcGCThreads` – the8472 Aug 22 '18 at 12:36
1 Answers
8
This hotspot-gc-dev thread hints that on very large CPUs or multi-CPU systems you get diminishing returns from additional threads, so the linear scaling factor is decreased beyond 8 cores.
This is likely because GCing is inherently memory-bound and enough threads will eventually saturate the memory bus and not be able to feed additional cores. Additionally coordination between GC threads (work partitioning) may become more inefficient as each thread can only work on a smaller fraction of the heap.
Anyway, this is not a one-size-fits-all rule, so you can change the setting, measure it and keep the change if you can confirm improvements.

the8472
- 40,999
- 5
- 70
- 122