JDK9 已经出来好几个月了,这两天整理了一下JDK9的一些新特性,我们打开JDK官方的下载页会发现只有64位,没有32位了。
哈哈看到上图,意外不意外,惊喜不惊喜!
好了,不废话了直接来看jdk9吧。
jdk9下载和安装
jdk9的下载和安装和以前没有什么区别,下图是运行效果:
标准版的jdk9
What’s New for JVM Tuning in JDK 9,主要看这个,其他的内容可以根据自己的兴趣和爱好看。
改善增加G1Usability, Determinism, and Performance
去掉了jdk8弃用的垃圾回收器组合
下面组合删除
DefNew + CMSParNew + SerialOld
Incremental CMS
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
去掉一些jvm参数
-Xincgc-XX:+CMSIncrementalMode-XX:+UseCMSCompactAtFullCollection-XX:+CMSFullGCsBeforeCompaction-XX:+UseCMSCollectionPassing
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.
使用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。
统一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.
废弃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垃圾回收器并没有特别研究就仅仅了解使用标记整理,后面会有空进行学习、分享。
JDK9的关键更改
Java平台模块化系统:引入了一种新的Java编程组件模块,它是一个命名的、自描述的代码和数据集合。
JDK 9中的新工具
Java Shell
添加更多的诊断命令
删除启动时间JRE版本选择
link:Java连接器
多版本兼容Jar
JDK 9中新的安全性:
1、数据报传输层安全性(DTLS)
2、禁用sha - 1证书
想要体验更多的JDK9 的新特性,赶紧去下载吧!
更多精彩内容请关注“IT实战联盟”公众号哦~~~
注意:本文归作者所有,未经作者允许,不得转载