1

I am currently using Wildlfly 10.1. in production and just discovered that we have a lot of gc pause times. Analysis of the gc log exposed that 95% of the gc runs are triggered by System.gc() calls. Our application code does not invoke any of them.

Is this a Wildfly feature?

Or can someone point me in the right direction to figure out if these System.gc() invokations make sense?

Of course, I am aware that there is a number of measures to optimize gc behavoir. I am just asking myself why there are so many System.gc() calls.

Thomas
  • 620
  • 7
  • 19

2 Answers2

2

System.gc() is called by Java RMI or more specifically by sun.misc.GC class - Sourcecode

Default interval is 1 hour. You can set it by using these parameters:

-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000

Setting -XX:+DisableExplicitGC can make your application slower and slower over time.

See also: What is the default Full GC interval in Java 8

alex
  • 8,904
  • 6
  • 49
  • 75
  • For completeness: note that the option "-XX:+ExplicitGCInvokesConcurrent" in combination with G1GC or Parallell GC will make the System.gc() calls less harmful by making the GC work in concurrent mode instead of causing "stop the world" situations. This was very helpful to me. – Thomas Apr 11 '18 at 07:54
1

If you want to find callers for System.gc the most reliable method is to attach a debugger and set a method entry breakpoint on it.

the8472
  • 40,999
  • 5
  • 70
  • 122