How can i help CMS GC “die fast”

☆樱花仙子☆ 提交于 2020-01-05 04:03:13

问题


i use "-XX:+UseConcMarkSweepGC" in my application, and when Out Of Memory Error is close my application transform in weakly form of itself (in this time it logs "concurrent mode failure").In this form it can survive long time period, and that is a big trouble for me. I need to find way how to help my application to "die fast and easy".

i googled this: "-XX:GCHeapFreeLimit=nnn where nnn is a number between 0 and 100 giving the minimum percentage of the heap that must be free after the GC. The default is 2" but i have trouble with it. i configure my JVM using "-XX:GCHeapFreeLimit=50" and i think it doesn't change anything

log 2013-08-14T17:31:49.776+0400: [Full GC [CMS: 917504K->908590K(917504K), 2.8014727 secs] 1032192K->908590K(1032192K), [CMS Perm : 2071K->2071K(65536K)], 2.8015412 secs] [Times: user=2.79 sys=0.00, real=2.80 secs]

1032192K->908590K(1032192K) - this is not 50 persents


回答1:


I think you are saying that your application is spending too much time on garbage collection when the heap gets close to full.

If so, there is a simple thing that you can do that may help: add the -XX:+UseGCOverheadLimit command line option. This causes the JVM to track how much time is spent on "GC overheads". If the proportion of time exceeds a given (configurable) ratio, the JVM will raise an OutOfMemoryError exception.

Obviously, this will cause your application to die sooner. But it sounds like that what you want: a quick death, rather than a slow lingering one.


According to this page, the default ratio is 98% application, 2% gc. I might be incorrect about the ratio being tunable. If not, I suspect that it might be this one: -X:GCTimeLimit=nn



来源:https://stackoverflow.com/questions/18230489/how-can-i-help-cms-gc-die-fast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!