Posted in

提前加载和链接类提案将加速 Java 启动时间_AI阅读总结 — 包阅AI

包阅导读总结

1.

关键词:Java 、启动速度、动态特性、提前加载、优化

2.

总结:本文提出提前类加载提案以加快 Java 启动速度,在保留平台动态性的同时降低成本,旨在利用应用每次启动相似性来改善,且不要求代码等改变,为启动和预热时间的持续改进奠定基础。

3.

主要内容:

– 提前类加载提案目的

– 加快 Java 启动速度

– 保留 Java 平台动态性,降低其成本

– 动态特性的影响

– 动态类加载、动态链接和动态反射等使开发者有表达力

– 但动态性有代价,JVM 在服务器应用启动时工作多,导致启动慢

– 提案的关键与目标

– 关键:提前做部分工作而非即时做

– 目标:改善启动时间,无需改代码、启动方式、不用特定工具,为启动和预热时间优化奠定基础

– 相关背景

– 此提案基于之前 JVM 的提前编译提案,后者处于草案状态

思维导图:

文章地址:https://www.infoworld.com/article/3482187/ahead-of-time-class-loading-proposal-would-speed-java-startups.html

文章来源:infoworld.com

作者:InfoWorld

发布时间:2024/8/7 15:00

语言:英文

总字数:467字

预计阅读时间:2分钟

评分:87分

标签:Java,OpenJDK,JVM,性能优化,类加载


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

Motivating the proposal is the desire to preserve the dynamism of the Java platform while reducing the cost of that dynamism, which must be paid every time an application starts, the proposal says. The highly dynamic Java platform has features such as dynamic class loading, dynamic linkage, and dynamic reflection, which give expressive power to developers. Java developers can, for example, write libraries that dynamically load and then link to plug-in components at run time, or assemble applications by composing libraries that dynamically link to other libraries. However, all that dynamism comes at a price, meaning the JVM does a lot of work during the startup of a typical server application, such as scanning JAR files on disk and loading parsed data into class objects. And it does this work on demand, lazily, just in time. As a result, a large server application may require seconds or even minutes to start up.

The key to improving startup time is to do some of this work ahead of time, rather than just in time. A specific goal of the proposal is improving startup time by exploiting the fact that most applications start up in roughly the same way every time they run. Other goals include:

  • Not requiring any changes to the code applications, libraries or frameworks.
  • Not requiring any change to how applications are started from the command line with the Java launcher, beyond the command-line options related directly to this feature.
  • Not requiring the use of the jlink or jpackage tools.
  • Laying a foundation for continued improvements to startup time and also to warmup time, i.e., the time needed for the HotSpot JVM to optimize an application’s code for peak performance.

The ahead-of-time proposal for class-loading and linking follows a previous proposal for ahead-of-time compilation for the JVM. That proposal is listed as being in draft status.