JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)

转载请注明原创出处,谢谢!

经过 4 次跳票,历经曲折的 Java 9 正式版终于发布了!今天看着到处都是jdk9发布了,新特性说明,心想这么好的蹭热度计划能错过嘛,哈哈,所以就发了这篇文章。

目前jdk9和jvm9的规范都还没有出来,很多细节估计还不清楚,基本就是通过官方介绍,看的。

JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)_第1张图片

所以各位看官莫急

去首页下载jdk9,你会发现:

JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)_第2张图片不这么吓唬我们,我们一般不会这么快用的

之后下载页发现和以前的略有不同,没有32位了。JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)_第3张图片
下载、安装和以前没有啥区别,之后运行效果:

Java Platform, Standard Edition What’s New in Oracle JDK 9

主要是基于该地址:New in Oracle JDK 9。What’s New for JVM Tuning in JDK 9,其他内容可以自己有兴趣的看看,其他的我也没看。

JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)_第4张图片

These are the JVM tuning enhancements in JDK 9.

JVM菜鸟进阶高手之路十二(jdk9、JVM方面变化, 蹭热度)_第5张图片

改善增加G1Usability, Determinism, and Performance

就是内部改进了,详细的看下描述。

删除jdk8弃用的垃圾回收器组合

1.下面组合删除
- DefNew + CMS
- ParNew + SerialOld
- Incremental CMS

2. foreground的cms gc删除

foreground它发生的场景比如业务线程请求分配内存,但是内存不够了,于是可能触发一次cms gc,这个过程就必须是要等内存分配到了线程才能继续往下面走的,因此整个过程必须是STW的,因此CMS GC整个过程都是暂停应用的,但是为了提高效率,它并不是每个阶段都会走的,只走其中一些阶段,这些省下来的阶段主要是并行阶段,Precleaning、AbortablePreclean,Resizing这几个阶段都不会经历,其中sweep阶段是同步的,但不管怎么说如果走了类似foreground的cms gc,那么整个过程业务线程都是不可用的,效率会影响挺大。

参考:http://mp.weixin.qq.com/s?__biz=MzIzNjI1ODc2OA==&mid=403167528&idx=1&sn=915363f7daaf161c8cf8cd1953d377db&scene=19#wechat_redirect

3.一些jvm参数去掉
- -Xincgc
- -XX:+CMSIncrementalMode
- -XX:+UseCMSCompactAtFullCollection
- -XX:+CMSFullGCsBeforeCompaction
- -XX:+UseCMSCollectionPassing

4. UseParNewGC

The command line flag -XX:+UseParNewGC no longer has an effect. ParNew can only be used with CMS and CMS requires ParNew. Thus, the -XX:+UseParNewGC flag has been deprecated and will likely be removed in a future release.

5. 使用G1做为默认回收器

Risks and Assumptions
- The change is based on the assumption that limiting latency is often more important than maximizing throughput. If this assumption is incorrect then this change might need to be reconsidered.
- G1 is seen as a robust and well-tested collector. It is not expected to have stability problems, but becoming the default collector will increase its visibility and may reveal previously-unknown issues. If a critical issue is found that can’t be addressed in the JDK 9 time frame, we will revert back to use Parallel GC as the default for the JDK 9 GA.
- The resource usage of G1 is different from Parallel. When resource usage overhead needs to be minimized a collector other than G1 should be used, and after this change the alternate collector will have to be specified explicitly.
简单意思就是,与CMS类似,G1更关注的是延迟,如果更关注吞吐量还是建议ps吧,G1已经足够健壮了,可能有未知没预测到的,如果解决不了就默认换会PS。

6. 统一GC日志

Reimplements Garbage Collection (GC) logging using the unified JVM logging framework introduced in JEP 158. GC logging is re-implemented in a manner consistent with the current GC logging format; however, some differences exist between the new and old formats.

7. 废弃CMS

  • Deprecates the Concurrent Mark Sweep (CMS) garbage collector. A warning message is issued when it is requested on the command line, using the -XX:+UseConcMarkSweepGC option. The Garbage-First (G1) garbage collector is intended to be a replacement for most uses of CMS.
  • 其实通过上面好多项都可以看见把CMS参数去掉很多,之后一些相关也废弃了,就是想让G1替代CMS,由于CMS采用的是标记清除,而G1使用的是标记整理所以G1在若干次GC后,不需要类似CMS那样必须进行一次碎片整理。
  • G1垃圾回收器并没有特别研究就仅仅了解使用标记整理,后面会有空进行学习、分享。

今天大概就这么多了,也是才出来很多不熟悉,而且只是一点点小部分,后续有空多写写,后续Java 将每半年发布一个版本(压力大啊),我想想JVM后续会越来完善的。希望大家对我多多关注,多多支持,点赞点赞,谢谢。


个人公众号

匠心零度公众号.jpg

你可能感兴趣的:(jvm,java,JVM菜鸟进阶高手之路)