简体   繁体   中英

Relative Performance of Java's Garbage First (G1) Garbage Collector?

Does anyone know of any performance benchmarks of Java's new Garbage First (G1) Garbage Collector (as compared to the "old" GCs)?

In terms of GC pause times, Sun states that G1 is sometimes better and sometimes worse than CMS. While the G1 collector is successful at limiting total pause time, it's still only a soft real-time collector. In other words, it cannot guarantee that it will not impact the application threads' ability to meet its deadlines, all of the time. However, it can operate within a well-defined set of bounds that make it ideal for soft real-time systems that need to maintain high-throughput performance.

I'd like to see actual measures of throughput and latency for Java's CMS (concurrent mark sweep) and G1 (garbage first) collectors.

原始科学文章(Detlefs、Flood、Heller 和 Printezis 撰写的“垃圾优先垃圾收集” )包含有关实际措施的一些详细信息(在第 4 节中)。

UPDATED: see below

If you have a web application, or another application that handles a lot of clients/req, and the response time is important for you, then you better use CMS. this test was found in 'Java performance and scalability'

UPDATE : 18 Nov 2019

Here are compared the pauses for each garbage collector. Its 2019 and I think that best option for WebApp is still CMS, until you can switch directly to ShenandoahGC (skip G1)

link : ShenandoahGC Main

It is important to understand that GC pauses might not be the only significant contributor to response times in regular applications. Having large GC pause spells the problem with response time with a very high probability, but the absence of long GC pauses does not always mean decent response time. Queueing delays, network latencies, other services latencies, OS scheduler jitter, etc. could be the contributing cost. Running Shenandoah with response time measurement is recommended to get the full picture of what is going on in the system, which can then be used to correlate with GC pause time statistics.

For example, this is a sample report with jHiccup on one of the workloads:

CMS 与雪兰多和 G1 的比较

We have just finished a series of testing over CMS and G1, using comparable ergonomics. This is product specific and very subjective, AND we're using Java 6 (so G1 is in the "preview" build) but...

A system using CMS is 20% faster than G1. This was tested with 8GB and 12GB heap space, with 1GB and 1.5GB young space (respectively).

Again - subjective, single system, specific load - but that's our experience.

这篇Taranfx 文章(2009-08-29) 在 4 个简单的基准测试中比较了 Java 5、6 和 7 的性能。

G1 is compared to CMS mostly faster due to the idea of multi-threads. Compared to the Parallel-GC I don't know - it might be the same. Of course G1 is more real-time due to not two kinds of threads running (mostly the small one). It's faster because any thread should produce the same impact to performance. Even compacting is done only on copying. For more details have a closer look at this: http://geekroom.de/java/java-expertise-g1-fur-java-7/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM