Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM G1GC's mixed gc not collecting much old regions

People also ask

What is mixed GC?

A mixed GC collects some regions (not all), some belong the young generation, at least one to the old generation. A full GC collects all regions, and, in consequence, the young and the old generation.

Does g1gc stop the world?

After space-reclamation, the collection cycle restarts with another young-only phase. As backup, if the application runs out of memory while gathering liveness information, G1 performs an in-place stop-the-world full heap compaction (Full GC) like other collectors.

What is g1heapregionsize?

The G1 GC is a regionalized and generational garbage collector, which means that the Java object heap (heap) is divided into a number of equally sized regions. Upon startup, the Java Virtual Machine (JVM) sets the region size. The region sizes can vary from 1 MB to 32 MB depending on the heap size.

What is the improvement in g1gc in Java 10?

Java 10 reduces Full GC pause times by iteratively improving on its existing algorithm. As I understood it G1 does not run its collection cycles concurrently with our application. It will still pause the application periodically and Full GC pauses increase with larger heap sizes.


well, you didnt mentioned all arguments you set, but

you could try to set

-XX:+ScavengeBeforeFullGC

and you should also think about your Objects lifecycle. how long do your applications Objects live and what size are the Objects.

think about it and take a look at the following arguments

-XX:NewRatio=n              old/new ration (default 2)
-XX:SurvivorRatio=n         eden/survivor ratio (default 8)
-XX:MaxTenuringThreshold=n  number of times, objects are moved from survivor one to survivor two and vice versa before objects are moved to old-gen (default 15)

with default values Xms and Xmx are set to 32gb -> old gen = 16gb and new gen 16gb -> eden 14gb -> survivors 2gb (there are two, each of it at the size of 1gb)

eden contains all Objects that are instantiated by new Object.

one survivor (to-survivor) is always empty. the other ones (from-survivor) contains Objects that survived a minor gc

surviving Objects from eden and from from-survivor go into to-survivor at minor gc

if the standard-size of 1gb of this 'default-configuration' exceeds, Objects go into old-gen

if it does not exceed, after 15 minor gc's (-XX:MaxTenuringThresholds default value), Objects go into old-gen

by tweaking those values, always keep in mind, old-gen has to be as large as or larger than new-gen, cause a gc can cause the whole new-gen to go into old-gen

Edit

a timeline of your first "old gen: used" picture would be helpful

keep in mind that there is no need to do a full gc until old gen doesn't exceed - a full gc causes the whole "world" to stop for a certain period of time

in this particular case, i would say you could

  1. reduce -Xms and -Xmx to 8gb
  2. set/decrease -XX:SurvivorRatios value to 2
  3. set/increase -XX:MaxTenuringThreshold to 50

and you will get an old and new gen, each sized 4gb,

eden at size of 2gb,

two survivors, each sized 1gb,

and aproximately 50 minor gc's, before Objects go into old gen