本文介绍了JVM垃圾收集和分页内存体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最近10年讨论Java和/或垃圾收集时,我无法抵御的唯一性能损失是垃圾收集算法在分页内存体系结构中运行时或多或少会中断,而部分



Unix系统(尤其是Linux)大量地分页出内存,这些内容在一段时间内一直没有被触及,虽然这有利于平均泄漏c应用程序,它会在内存紧张的情况下杀死javas性能。



我知道最佳做法是让最大堆小于物理内存。 (或者你会看到你的应用程序交换到死亡),但这个想法 - 至少在unix世界中,是内存可以更好地用于文件系统缓存等。



我的问题是:
是否有任何分页(意识到)的垃圾收集算法?

解决方案

你是对的,垃圾收集器和虚拟内存管理器必须协作,否则GC将垃圾系统。 Matthew Hertz,Yi Feng和Emery D. Berger对此类GC /内核协作进行了调查。为了获得良好的性能,他们不得不稍微扩展内核,并调整垃圾收集器。



在高内存压力下,他们的基准测试使用了更长的160倍GenMS Java GC。使用新的页面感知GC,基准测试速度只降低了1.6倍。换句话说,通过适当调整的GC,性能提高了100倍。


In the recent 10 year when discussing java and/or garbage collection, the only performance penalty that I have not been able to defend is that garbage collection algorithms more or less breaks when running in a paged memory architecture, and parts of the heap is getting paged out.

Unix systems (and especially Linux) agressively pages out memory that has not been touched for a while, and while that is good for your average leaking c application, it kill javas perfomance in memory tight situations.

I know the best practice is to keep the max heap less than the physical memory. (Or you will see your application swap to death) but the idea - at least in the unix world, is that the memory could be better spent for filesystem caches etc.

My question is:Are there any paging (aware) garbage collecting algorithms?

解决方案

You are correct, the garbage collector and the virtual memory manager have to collaborate otherwise the GC will trash the system. Such a GC/kernel collaboration has been investigated by Matthew Hertz, Yi Feng and Emery D. Berger. In order to obtain good performance, they had to extend the kernel slightly and also tweak the garbage collector.

Under high memory pressure, their benchmark took something like 160x longer using the GenMS Java GC. With the new, page-aware GC, the benchmark was only 1.6 times slower. In other words, with a properly tuned GC, there is a 100x performance gain.

http://lambda-the-ultimate.org/node/2391

这篇关于JVM垃圾收集和分页内存体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 06:55