问题描述
既然 Java 7 将默认使用新的 G1 垃圾回收,那么 Java 是否能够处理一个数量级更大的堆,而不会出现所谓的破坏性"GC 暂停时间?有没有人真正在生产环境中实现过 G1,你的经验是什么?
Since Java 7 is going to use the new G1 garbage collection by default is Java going to be able to handle an order of magnitude larger heap without supposed "devastating" GC pause times? Has anybody actually implemented G1 in production, what were your experiences?
公平地说,我唯一一次看到非常长的 GC 暂停是在非常大的堆上,比工作站要多得多.澄清我的问题;G1 会为数百 GB 的堆打开网关吗?结核病?
To be fair the only time I have seen really long GC pauses is on very large heaps, much more than a workstation would have. To clarify my question; will G1 open the gateway to heaps in the hundreds of GB? TB?
推荐答案
听起来 G1 的重点是要更短的暂停时间,甚至可以指定最大暂停时间目标.
It sounds like the point of G1 is to have smaller pause times, even to the point where it has the ability to specify a maximum pause time target.
p>
垃圾收集不再只是一个简单的嘿,它已满,让我们立即移动所有内容并重新开始"的处理方式——它是一个极其复杂的多级后台线程系统.它可以在后台完成大部分维护工作而不会暂停,并且它还利用系统运行时预期模式的知识来提供帮助——比如假设大多数对象在创建后立即死亡,等等.
Garbage collection isn't just a simple "Hey, it's full, let's move everything at once and start over" deal any more--it's fantastically complex, multi-level, background threaded system. It can do much of its maintenance in the background with no pauses at all, and it also uses knowledge of the system's expected patterns at runtime to help--like assuming most objects die right after being created, etc.
我会说 GC 暂停时间将在未来版本中继续改善,而不是恶化.
I would say GC pause times are going to continue to improve, not worsen, with future releases.
在重新阅读时,我突然想到我每天都在使用 Java——Eclipse、Azureus 和我开发的应用程序,而且我已经很久没有看到停顿了.不是很明显的停顿,但我的意思是任何停顿.
in re-reading it occurred to me that I use Java daily--Eclipse, Azureus, and the apps I develop, and it's been a LONG TIME since I saw a pause. Not a significant pause, but I mean any pause at all.
当我右键单击 Windows 资源管理器或(偶尔)当我连接某些 USB 硬件时,我看到了暂停,但使用 Java 时——根本没有.
I've seen pauses when I right-click on windows explorer or (occasionally) when I hook up certain USB hardware, but with Java---none at all.
GC 对任何人来说仍然是个问题吗?
Is GC still an issue with anyone?
这篇关于生产环境中的 Java G1 垃圾收集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!