Question

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.

Était-ce utile?

La 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!

Autres conseils

The best would be to actually enable verbosegc and test your application. There is no general rule and none policy is the best for all applications. From my experience usually gencon, if tuned correctly, behaves better. With optthruput, especially when using larger heap sizes, you may have quite long pauses when GC kicks in. These long pauses may lead to thread pool usage spikes (as application threads are frozen), which in extreme cases, may lead to server crush.

With tuned gencon, most of the collections should appear only in nursery, which are very fast. You should have very seldom or none gc in tenured. And usually the same application can use much smaller heap with gencon, than with optthruput

As I said, the best is to have some stress test and compare. You have very nice free tool Garbage Collection and Memory Visualizer, which is a plugin to another very useful tool for anyone dealing with WebSphere - IBM Support Assistant.

It will allow you to import verboseGC log, show different charts (like pause times, gc cycles, etc). It will allow you to compare your gc behavior and give some general advices how to tune it.

I am working as Java Service Engg at IBM Labs. Both the policy has its own trade off. Selecting the policy is based on the application requirement.

optthruput:

This policy could be considered when throughput is needed.

How Optthruput works??

The JVM allows object allocation continuously till it reaches the threshold value ie(<4% free java heap available). Once it reaches the threshold GC kicks on to clear the dead objects. If the Xmx is huge then there are possibilities of more pausetime but till it reaches the threshold value, application works fine. Ex: Batch processing could be effectively done using this policy.

Gencon: This policy is meant for less pause time.

How Gencon policy works?

Java heap divided into Nursery and tenture. Initial allocations done on nursery area. Once it fill nursery area Scavenge GC occurs(Partial GC on Nursery area). This moves the long lived objects to tenure area and keeps the short lived at nursery. Once nursery and tenure space filled system GC kicks on to clear dead objects.

If the nursery space is not set properly then scavenge gc occurs often which halts the performance of the system. Excess GC always lead to performance impact of the system.

Hope this information might help you in choosing the policy.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top