Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

G1's ParallelGCThreads

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?

like image 677
Expressway Retrograding Avatar asked Jan 28 '23 13:01

Expressway Retrograding


1 Answers

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.

like image 183
the8472 Avatar answered Jan 31 '23 07:01

the8472