THREAD DUMP ANALYSIS PATTERN – Several Scavengers

Description

Based on the type of GC algorithm (Serial, parallel, G1, CMS) used, default number of garbage collection threads gets created. Details on default number of threads that will be created is documented below. Sometimes too many extraneous GC threads would get created based on the default configuration. We have seen scenarios where 128, 256, 512  GC threads got created based on default configuration. These many GC threads are injurious to JVM health. So GC thread count should be carefully configured.

Parallel GC

If you are using Parallel GC algorithm then number of GC threads is controlled by -XX:ParallelGCThreads propertyDefault value for -XX:ParallelGCThreads on Linux/x86 machine is derived based on the formula:

if (num of processors <=8) {

   return num of processors;
} else {

  return 8+(num of processors-8)*(5/8);

}

So if your JVM is running on server with 32 processors, then ParallelGCThread value is going to be: 23 (i.e. 8 + (32 – 8)*(5/8)).

CMS GC

If you are using CMS GC algorithm then number of GC threads is controlled by -XX:ParallelGCThreads and -XX:ConcGCThreads properties. Default value of -XX:ConcGCThreads is derived based on the formula:

max((ParallelGCThreads+2)/4, 1)

So if your JVM is running on server with 32 processors, then

  • ParallelGCThread value is going to be: 23 (i.e. 8 + (32 – 8)*(5/8))
  • ConcGCThreads value is going to be: 6.
  • So total GC thread count is: 29 (i.e. ParallelGCThread  count + ConcGCThreads  i.e. 23 + 6)

G1 GC

If you are using G1 GC algorithm then number of GC threads is controlled by -XX:ParallelGCThreads, -XX:ConcGCThreads, -XX:G1ConcRefinementThreads properties. Default value of -XX:G1ConcRefinementThreads is derived based on the formula:

ParallelGCThreads+1

So if your JVM is running on server with 32 processors, then

  • ParallelGCThread value is going to be: 23 (i.e. 8 + (32 – 8)*(5/8))
  • ConcGCThreads value is going to be: 6
  • G1ConcRefinementThreads value is going to be 24 (i.e. 23 + 1)
  • So total GC thread count is: 53 (i.e. ParallelGCThread  count + ConcGCThreads + G1ConcRefinementThreads i.e. 23 + 6 + 24)

53 threads for GC is quite high number. It should be tuned down appropriately.

Why named as Several Scavengers?

Scavenger is a person who searches for and cleans-up discarded items. GC threads also does exactly same thing. Too many Scavengers in one single spot doesn’t yield productive result. Similarly too many GC threads wouldn’t help JVM either.

Advertisements

One thought on “THREAD DUMP ANALYSIS PATTERN – Several Scavengers

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: