让我们来看一下... JEP 483:提前类加载与链接!

  • "Let’s Take a Look at…​!" blog series: Explores data and streaming space projects. Java 24 was released with many JEPs.
  • JEP 483 (Ahead-of-Time Class Loading & Linking): Part of Project Leyden to reduce Java program footprint. Builds on AppCDS.

    • Requires training run to create AOT cache. Classpath must be consistent.
  • Using Apache Kafka for AOT: Download Kafka 4.0. Generate class list with -XX:AOTMode=record.

    • Produce/consume messages to trigger class loading. AOT cache size is 66 MB.
    • Using AOT cache reduces Kafka start-up time by 59% compared to no cache.
    • Disabling AOT class linking gives similar result as AppCDS. Kafka native binary takes less time.
  • Using Apache Flink for AOT: Tested with Flink mini-cluster. AOT cache reduces time-to-first-message by 51%.
  • Summary: AOT class loading and linking cuts JVM start-up time. Good for cloud-native scenarios.

    • No app code changes needed. Training run could be improved.
    • Compares to GraalVM: overlap in goals. GraalVM more advanced but requires adjustments.
    • Project Leyden is picking up with other JEPs.
阅读 8
0 条评论