从Java虚拟机小测的结果来看JVM | KAAAsS's blog



从Java虚拟机小测的结果来看JVM | KAAAsS's blog

不仅如此,CMS还有很多其他的缺点。不过这里空白太小,我写不下。而且,虽然CMS+ParNew依然是很常用的一种搭配,CMS也将步入历史的尘埃了。JEP 291[1]提到了在未来Java版本中去除CMS收集器的计划,而且该JEP已经被列入JDK 9[2]中。现在你使用CMS收集器的话将会得到一句警告。而废弃CMS的原因很幽默,就是现任维护者Christoph Engelbert看不懂原先CMS复杂晦涩的代码(参见邮件[3])。(话说我在领英上看到,CMS的自适应freelist是JEP的提出者Jon Masamitsu制作的,你为啥不接锅?)不过这个JEP也激起了广泛的讨论。CMS如今在一些内存较小的设备(如树莓派)中有非常不错的性能,而作为替代的G1收集器(后文介绍)在这种情况下的性能并不好。而且由于CMS的侧重点不同,CMS的收集时间比G1要更少。不过随着G1的逐渐改善,相信这种差距会逐渐缩小,甚至于G1完全替代CMS。不过其实除了早期Sun实验室的吹笔论文[4],似乎也没有完整的针对JDK 9的CMS与G1对比,我在StackOverflow和Reddit上看了很多讨论,基本上都是嘴巴压测。(而且就算是Sun的论文,CMS也是有优势。不过,我这里倒是找到一篇简单对比的[5],可惜比较早)嘛,我在此号召各位有志青年与各路大神快去阅读OpenJDK,然后发起#Save CMS#。好在另一份邮件[6]提到移除CMS是一个漫长的过程,所以暂时似乎还能用着CMS过日子?

G1收集器是全新的,也是最新的收集器,在JDK 7u4之后已经完全开放商用了。它是标记-整理算法与复制算法的一种结合,而这种结合建立在将内存分为一个个Region的基础上。G1能同时作用于新生代和老年代,而且进一步的讲,G1收集器直接作用于整个Java堆!从上面那些邮件中,开发者吹爆G1的态度可以看出,众开发者可是对G1寄予厚望的。不过我看到吐槽G1的声音依然不少(甚至有说"Use G1 when you have tons of memory and don't care about burning CPU… 😉


Read full article from 从Java虚拟机小测的结果来看JVM | KAAAsS's blog


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts