有没有人发现垃圾收集调整是有用的? [英] Has anyone found Garbage Collection tuning to be useful?

查看:75
本文介绍了有没有人发现垃圾收集调整是有用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了大量有关在Java中调整GC的文章,并且经常想知道有多少人真的使用了一些更高级的功能。



我总是尽可能地避免调整,并集中精力编写尽可能最简单的代码(Brian Goetz的建议) - 这对我来说目前效果很好。



这些调整策略是否能够灵活地跨VM版本进行更改,还是需要不断进行重新评估?



我使用的一个调整是服务器标志。

解决方案

我目前工作的一部分是关心和喂养一个大的java应用程序,内存容量(目前大约8GB),主要是由于大量缓存数据的持续计算。我使用标准的GC设置进行了初始部署,主要是因为没有一种简单的方法来模拟全面运行的生产环境。

在接下来的几个月里,我已经定制了GC设置。一般来说,最大的可用旋钮似乎在调整增量gc的频率和幅度 - 最大的改进是将大周期性gc用于更小更频繁的gc。但是我们一定能看到性能的提升。

我不会发布我的具体设置,因为a)他们是特定于我们的设置,b)因为我没有他们方便:)。但总的来说,我发现的是



  • 中进行了大量工作,调整了默认的gc设置。
    几乎总是默认值比我所做的任何调整都要好。
  • 至少对我来说,
    gc调整的情况是实际上值得的
    是非常足够的,以至于试图模拟
    他们是
    不合理,所以我必须通过实验和增量来做到



这里是一个很好的参考从prev。 stackoverflow讨论。

I've read plenty of articles about tuning GC in Java and have often wondered how many people really use some of the more advanced features.

I've always avoided tuning where possible and concentrated on writing the simplest possible code I can (Brian Goetz's advice) - this seems to have worked well for me so far.

Are these tuning strategies resilient to change across VM versions or do they require constant re-assessment?

The one tuning that I have made use of is the -server flag.

解决方案

Part of my current job is the care and feeding of a large java application that was designed to run with a large amount of memory (currently around 8 Gb), mostly due to ongoing calculations with lots of cached data. I did the initial deployment with the standard GC setup , mostly because there wasn't a simple way to simulate the production environment running at full tilt.

In stages, over the next few months, I've customized the GC settings. Generally, the biggest available knob seems to be adjusting the frequency and magnitude of incremental gc - the biggest improvement has been in trading off large periodic gc for smaller and more frequent ones. But we've definitely been able to see performance improvements.

I'm not going to post my specific settings because a) they're specific to our setup, and b) because I don't have them handy :). But in general, what I've found is

  • there's been a lot of work done in tuning the default gc settings. Almost always the defaults work better than any tweaks I would make.
  • At least for me, the situations where gc tuning was actually worthwhile were extreme enough that it was unreasonable to attempt to simulate them, so I had to do it experimentally and incrementally.

Here's a good reference from a prev. stackoverflow discussion.

这篇关于有没有人发现垃圾收集调整是有用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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