本文介绍了选择哪个optthruput或gencon的GC策略? IBM Websphere 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为JVM分配了4 GB的堆大小.

I have 4 GB heap size allocated to JVM .

为什么我应该为短期对象选择genconn GC策略.据我所知,genconn会将Heap分为两部分(护理和使用权),这将增加应用程序的响应时间,但不会增加吞吐量,因为我有足够的堆空间来容纳我的应用程序.但是,如果我仅关注吞吐量,则不应该使用optthruput策略,这样可以减少GC调用次数.

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.

我只能想到genconn的一个优点是避免磁盘碎片.对于上述情况,genconn还有其他优点吗?

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.

推荐答案

我不确定是否对您的问题添加一些评论,但是我还是会这样做.您已经知道optthruput和gencon之间的区别,我将介绍这些GC策略的以下方面:

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:

堆内存使用情况

如果您的应用程序流量很大,则在使用optthruput GC策略时您可能会消耗大量内存,因为JVM会一直分配内存,直到超过阈值为止,从而导致垃圾回收周期运行.

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.

相反,使用gencon GC策略,JVM首先在苗圃堆空间中分配内存,并且还执行较小的GC周期以从内存中删除未使用的对象.

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.

根据我的经验,gencon的总体堆使用量可以减少20-30%.

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

暂停时间

optthruput GC策略执行停止世界垃圾收集",这可能确实很昂贵,并且可能导致更长的暂停时间,从而导致会话或请求超时.使用gencon GC策略,您不可能获得很高的暂停时间,因为大多数垃圾回收是在运行完整的GC之前执行的. gencon的唯一缺点是它可能会遇到碎片问题,但是如果您的应用程序分配了大量的短期对象,则比使用gencon更好.

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.

如果您决定使用gencon,请先考虑使用optthruput策略获取详细的GC.您可以轻松地设置Web Sphere,以在native_stderr.log文件中吐出GC日志.您可以使用GCMV eclipse插件将GC日志提取到漂亮的图表和统计信息中.

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.

即使在上述说明之后,如果您不喜欢gencon,也至少要考虑使用optavgpause GC策略.它确实可以帮助您避免大的停顿时间.

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.

希望这会有所帮助!

这篇关于选择哪个optthruput或gencon的GC策略? IBM Websphere 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 14:32