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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With