Relative Performance of Java's Garbage First (

2019-03-08 14:34发布

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.

5条回答
Fickle 薄情
2楼-- · 2019-03-08 14:44

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-08 14:54

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/

查看更多
来,给爷笑一个
4楼-- · 2019-03-08 14:58

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'

查看更多
仙女界的扛把子
5楼-- · 2019-03-08 15:05

This Taranfx article (2009-08-29) compares Java 5, 6, and 7 performance on 4 simple benchmarks.

查看更多
一夜七次
6楼-- · 2019-03-08 15:07

The original scientific article ("Garbage-First Garbage Collection" by Detlefs, Flood, Heller and Printezis) contains some details on actual measures (in section 4).

查看更多
登录 后发表回答