-XX:UseParallelGC和-XX:+ UseParNewGC之间的区别 [英] Difference between -XX:UseParallelGC and -XX:+UseParNewGC

查看:228
本文介绍了-XX:UseParallelGC和-XX:+ UseParNewGC之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们是年轻一代垃圾收集的算法。

They are algorithms for the young generation garbage collection.

第二个(UseParNewGC)使用并发的tenured generation垃圾回收自动激活(参见 Java并发和并行GC )但是,两个并行算法之间有区别吗?

The second one (UseParNewGC) gets activated automatically with the concurrent tenured generation garbage collection (see Java Concurrent and Parallel GC) but, is there a difference between the two parallel algorithms?

推荐答案

经过大量搜索后,我发现的最佳解释是来自Java性能调优网站月份问题:1.4.1垃圾收集算法,2003年1月29日

After a lot of searching, the best explanation I've found is from Java Performance Tuning website in Question of the month: 1.4.1 Garbage collection algorithms, January 29th, 2003


年轻代垃圾收集算法

(原始)复制收集器(默认启用)。当这个收集器启动时,所有应用程序线程都会停止,并且使用一个线程(即使在多CPU机器上只有一个CPU)进行复制收集。这被称为stop-the-world集合,因为基本上JVM会暂停其他所有内容,直到集合完成。

The (original) copying collector (Enabled by default). When this collector kicks in, all application threads are stopped, and the copying collection proceeds using one thread (which means only one CPU even if on a multi-CPU machine). This is known as a stop-the-world collection, because basically the JVM pauses everything else until the collection is completed.

并行复制收集器(使用-XX:+ UseParNewGC启用)。像原始的复制收集器一样,这是一个世界级的收藏家。但是,此收集器将复制集合并行化为多个线程,这比多CPU机器的原始单线程复制收集器更有效(尽管不适用于单CPU机器)。与原始的单线程复制收集器相比,该算法可能会使年轻代收集的速度等于可用CPU数量。

The parallel copying collector (Enabled using -XX:+UseParNewGC). Like the original copying collector, this is a stop-the-world collector. However this collector parallelizes the copying collection over multiple threads, which is more efficient than the original single-thread copying collector for multi-CPU machines (though not for single-CPU machines). This algorithm potentially speeds up young generation collection by a factor equal to the number of CPUs available, when compared to the original singly-threaded copying collector.

并行清除收集器(使用-XX:UseParallelGC启用)。这就像之前的并行复制收集器一样,但算法在多CPU机器上针对千兆字节堆(超过10GB)进行了调整。此收集算法旨在最大化吞吐量,同时最大限度地减少暂停。它有一个可选的自适应调整策略,它将自动调整堆空间的大小。如果您使用此收集器,则只能使用旧一代中的原始标记扫描收集器(即较新的旧一代并发收集器无法与此年轻代收集器一起使用)。

The parallel scavenge collector (Enabled using -XX:UseParallelGC). This is like the previous parallel copying collector, but the algorithm is tuned for gigabyte heaps (over 10GB) on multi-CPU machines. This collection algorithm is designed to maximize throughput while minimizing pauses. It has an optional adaptive tuning policy which will automatically resize heap spaces. If you use this collector, you can only use the the original mark-sweep collector in the old generation (i.e. the newer old generation concurrent collector cannot work with this young generation collector).

根据这些信息,似乎主要区别(除了CMS合作)是UseParallelGC支持人体工程学,而UseParNewGC则没有。

From this information, it seems the main difference (apart from CMS cooperation) is that UseParallelGC supports ergonomics while UseParNewGC doesn't.

这篇关于-XX:UseParallelGC和-XX:+ UseParNewGC之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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