August 5th, 2024

JEP 483: Ahead-of-Time Class Loading and Linking

JEP 483 introduces an Ahead-of-Time class loading feature to enhance Java application startup times, achieving up to 42% performance improvements without altering application code, relying on consistent training runs.

Read original articleLink Icon
JEP 483: Ahead-of-Time Class Loading and Linking

JEP 483 introduces an Ahead-of-Time (AOT) class loading and linking feature aimed at improving the startup time of Java applications. By monitoring an application during a single run, the HotSpot Java Virtual Machine (JVM) can cache the loaded and linked forms of classes for future executions. This approach leverages the repetitive nature of application startups, where similar classes are loaded and linked each time. The AOT cache allows for a significant reduction in startup time without requiring changes to application code or command-line execution methods. The process involves two main steps: first, a training run to record the application's configuration, and second, the creation of the cache based on this configuration. The AOT cache can lead to performance improvements of up to 42%, as demonstrated with applications like Spring PetClinic. However, it is important that the training run closely resembles production runs to maximize the cache's effectiveness. The feature is built on the existing class-data sharing (CDS) mechanism, enhancing it by not only caching class metadata but also the actual loading and linking processes. This development aims to provide a foundation for further optimizations in both startup and warmup times for Java applications.

- JEP 483 aims to improve Java application startup times through AOT class loading and linking.

- The AOT cache stores loaded and linked class forms for faster access in subsequent runs.

- Performance improvements of up to 42% have been observed with applications using the AOT cache.

- The feature does not require changes to application code or command-line execution.

- Consistency between training and production runs is crucial for the effectiveness of the AOT cache.

Related

Moving to Java 17 or how I learned to stop worrying and love NoSuchMethodError

Moving to Java 17 or how I learned to stop worrying and love NoSuchMethodError

Icon Solutions upgraded to Java 17 in IPF 2024.1 for Spring 6 and Spring Boot 3 compatibility. Challenges included plugin and dependency adjustments, emphasizing centralized management and code cleanliness post-upgrade for smoother transitions.

JEP 401: Value Classes and Objects (Preview)

JEP 401: Value Classes and Objects (Preview)

JEP 401 introduces value classes and objects in Java, focusing on optimizing memory efficiency by distinguishing objects solely by their field values, not identity. This feature enhances performance for simple domain values.

New AI Training Technique Is Drastically Faster, Says Google

New AI Training Technique Is Drastically Faster, Says Google

Google's DeepMind introduces JEST, a new AI training technique speeding up training by 13 times and boosting efficiency by 10 times. JEST optimizes data selection, reducing energy consumption and improving model effectiveness.

The Cost of JavaScript

The Cost of JavaScript

JavaScript significantly affects website performance due to download, execution, and parsing costs. Optimizing with strategies like code-splitting, minification, and caching is crucial for faster loading and interactivity, especially on mobile devices. Various techniques enhance JavaScript delivery and page responsiveness.

Java Virtual Threads: A Case Study

Java Virtual Threads: A Case Study

Java Virtual Threads are a new feature in Java for concurrency. A study by Liberty's team found they don't outperform autonomic thread pools in cloud-native workloads. Virtual threads show faster ramp-up but lower CPU-intensive workload throughput. Memory usage reduction is inconsistent. Collaboration with OpenJDK Community is ongoing.

Link Icon 3 comments
By @crummy - 9 months
I'd love to have this out of the box with Java. I know it's possible already with other tooling but it seemed complicated or came with downsides.
By @robertlagrant - 9 months
> Conversations with some potential users suggest that they are willing to accept fixed class paths and module configurations, and thus a fixed set of built-in class loaders, and to use specialized class loaders only when that flexibility is required

I might be misunderstanding the level of difficulty of this, but I'm surprised that a custom location/locations would need to be out of scope.