Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Young garbage collection longer pause with java 7 vs java 6

I noticed that each young garbage collection with java 7 takes on average 10 more milliseconds than with java 6. I'm using 1.6.0_31 and 1.7.0_21. The configuration hasn't changed, neither has the hardware, JVM arguments are:

-server -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+TieredCompilation -XX:+AggressiveOpts -Xms1g -Xmx1g -XX:MaxNewSize=256m -XX:NewSize=256m
  • Java 7:
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT   
26176.0 26176.0 3531.6  0.0   209792.0 21648.8   786432.0   86777.6   49472.0 49350.1     82    1.830   0      0.000    1.
  • Java 6
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT   
26176.0 26176.0  0.0   1210.5 209792.0 95873.4   786432.0   65327.1   35968.0 35891.2     83    0.620   0      0.000    0.620

I also looked at each individual times, and with java 6, each YGC takes ~10ms vs java 7 is 20ms. Did something change between version 6 and 7 that could explain this behavior?

EDIT: I noticed that java 7 runs in 64 bits mode, whereas java 6 use a 32 bits JVM, could that explain the difference?

Thanks

like image 254
punx120 Avatar asked Dec 13 '13 21:12

punx120


People also ask

How do I fix long garbage collection time?

High Object Creation Rate A high garbage collection rate will increase the GC pause time as well. Thus, optimizing the application to create fewer objects is THE EFFECTIVE strategy to reduce long GC pauses. This might be a time-consuming exercise, but it is 100% worth doing.

Is Zgc better than G1GC?

Shenandoah GC and ZGC perform significantly better than G1GC in terms of latency, average pause time, maxi- mum pause time, and total accumulated stop-the-world time, for all evaluated applications in the study when the right tunings are applied. It is possible to achieve more than 80% improvement on latency values.

What is the best garbage collector in Java?

Z Garbage Collector (ZGC) ZGC is a low-latency garbage collector that works well with very large (multi-terabyte) heaps. Like G1, ZGC works concurrently with the application. ZGC is concurrent, single-generation, region-based, NUMA-aware, and compacting.


1 Answers

Default -XX:NewRatio for Java 6 is 8 but for the Java 7 it is 2. so in java 6 the size of young generation is less than java 7 hence the difference i feel.

Because time collecting the garbage from a city is directly proportional to how large the city is. if city size increases hence the time.

like image 81
Trying Avatar answered Nov 11 '22 03:11

Trying