客户端的最佳垃圾收集设置是什么? [英] What are the best garbage collection settings for client side?

查看:92
本文介绍了客户端的最佳垃圾收集设置是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的JVM有很多用于垃圾收集的XX参数(请参阅这里例如),但什么是可以使客户端Swing应用程序真正表现更好的选项?



我应该注意的是,在客户端真的很烦我java应用程序是停止世界垃圾回收的大拖延。在Intelli-J IDEA中,我已经看到了它三分钟或更长时间。



编辑:感谢所有的回复。为了回报,我使用了这里。我还设置了-XX:+ StringCache,以查看它是否会减少内存需求。



通常,观察结果是常规运行性能不会降低到您可以注意看它。使用字符串缓存选项可以减少内存占用量,但是CMS方法不够彻底,最终需要停止世界垃圾回收循环(回到三分钟等待)以清除内存(但是,考虑到减少的内存占用量,我可能只能放置一个较小的最大内存量,这将阻止世界的收集更小的尺寸。



IDEA 8.1.4自带JDK 1.6.0_12,所以我还没有测试过G1。另外,我的机器只有2个内核,所以G1方法不会真正实现最大化。时间打到老板为更好的机器;)。

解决方案

这个问题没有单一的答案,它是高度取决于你的应用程序在做什么以及它如何管理它的对象。也许看看垃圾回收工作并行和并发垃圾收集器了解各种选项。 然后,检查 Java SE 6 HotSpot [tm]虚拟机垃圾收集调优文档,它扩展了使用5.0 Java虚拟机调整垃圾收集文档。



如果您希望将垃圾收集暂停时间缩短,并发收集器可能是正确的方向,因为它同时执行大部分工作(即应用程序仍在运行时)。但找到最佳设置将需要分析(考虑测量GC吞吐量,最大和平均暂停时间,完整GC的频率及其持续时间)。

(编辑:在阅读了OP的评论后,我认为阅读我对JVM堆调整的建议,保持你的手指从表演大师Kirk Pepperdine那里拿出来!)


Recent JVM's have a lot of XX parameters for garbage collection (see here for example), but what are the options which can make a client side Swing application really perform better?

I should note that one of the things that really annoys me on client side java applications is the large delay in stop-the-world garbage collection. In Intelli-J IDEA I have seen it go three minutes or more.

EDIT: Thanks for all the responses. Just to report back I put on the CMS garbage collector for IDEA (which is a good common reference of the type of application that most everyone reading this question is familiar with) using the setting's suggested from here. I also set -XX:+StringCache to see if it would reduce memory requirements.

In general, the observation is that regular running performance is not degraded to the point where you can notice looking at it. The memory reduction is huge using the String Cache option, however the CMS method is not thorough and ends up requiring a stop the world garbage collection cycle (back to the three minute wait) to clear out the memory (400MB in one run).

However, given the reduced memory footprint, I might be able to just put a smaller maximum amount of memory which will keep the stop the world collections smaller in sizes.

IDEA 8.1.4 comes with JDK 1.6.0_12, so I didn't test G1 yet. Also, my machine only has 2 cores, so a G1 approach won't really be maximized. Time to hit the boss up for a better machine ;).

解决方案

There is no single answer to this question, it is highly depending on what your application is doing and how it manages its objects. Maybe have a look at How does garbage collection work and Parallel and concurrent garbage collectors to understand the various options.

Then, check the Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning document that expands on GC tuning concepts and techniques for Java SE 6 that were introduced in the Tuning Garbage Collection with the 5.0 Java Virtual Machine document.

If you want to keep garbage collection pauses short, the concurrent collector is likely the right direction as it performs most of its work concurrently (i.e., while the application is still running). But finding the best setup will require profiling (consider measuring the GC throughput, the max and average pause time, the frequency of full GCs and their duration too).

(EDIT: Having read a comment from the OP, I think that reading My advice on JVM heap tuning, keep your fingers off the knobs! from the performance guru Kirk Pepperdine would be a good idea.)

这篇关于客户端的最佳垃圾收集设置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆