Search code examples
javaperformancewebsphere-7heap-memory

which GC Policy to choose optthruput or gencon ? IBM websphere 7


I have 4 GB heap size allocated to JVM .

why should i choose genconn GC policy for short lived object. As far as my understanding is genconn will divide the Heap into 2 parts (nursery and tenured ) which will increase the response time of the application but not throughput as i have sufficient heap size for my application. But if i am only concerned about the throughput should i not use optthruput policy so that i have less GC call.

I can only think of one advantage of genconn is to avoid fragmentation of the disk. Is there any other plus point for genconn for above scenario.


Solution

  • I am not sure if I am late in adding some comments to your question but I'll do it anyway. As you already know difference between optthruput and gencon, I'll cover the following aspects of these GC policies:

    Heap Memory usage

    If your application has heavy traffic, you are likely to consume lot of memory when using optthruput GC policy, as JVM will keep allocating memory till it crosses the threshold, causing garbage collection cycle to run.

    In contrast, with gencon GC policy JVM allocates memory in nursery heap space first and also performs small GC cycles to remove unused objects from memory.

    From my experience the overall heap usage with gencon can be reduced by 20-30%.

    Pause time

    The optthruput GC policy performs "stop the world garbage collection", it can be really expensive and can result into longer pause time resulting into session or request timeouts. With gencon GC policy, you are unlikely to get high pause time as most of the garbage collection is performed before running a full GC. The only drawback of gencon is that it can run into fragmentation issues, but if your application is allocating high amount of short lived objects than you are better off using gencon.

    If you decide to use gencon then please consider getting some GC verbose with optthruput policy first. You can easily set up web sphere to spit out GC logs in native_stderr.log file. You can use GCMV eclipse plugin to extract the GC logs into nice charts and stats.

    And suppose even after above description if you dont like gencon then at least think about using optavgpause GC policy. It can really help you avoid big pause time.

    Hope this helps!