Profile Image

What is Garbage collector tuning: -XX:MaxGCPauseMillis?

What is Garbage collector tuning: -XX:MaxGCPauseMillis? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-maxgcpausemillis

  • x-maxgcpausemillis

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky



You can set a goal for JVM for maximum pause time in milliseconds for G1 GC:


-XX:MaxGCPauseMillis=xxx, where xxx means the desired amount for pause time in milliseconds for Garbage First garbage collector




JVM allows you to tune it’s behavior during garbage collection. When JVM needs to make space because a region of memory is full a pause occurs. If the rate data is stored in memory exceeds the rate at which it is removed a region can fill up. We can tune the JVM, in order to try to minimize garbage collection pause, also known as a stop-the-world event. During a pause, all other operations are suspended. It also affects networking, so the node can appear as down to other nodes in the cluster. CRUD statements will also pause, which increases read and write latencies. It is recommended to stay within 500-2000 millis range.  This argument will set a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it.


Default Value:


Default is 500ms if G1 is enabled






Arguments related:


TODO link UseG1GC, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC


Related Posts:



If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-maxgcpausemillis

  • x-maxgcpausemillis