Project Leyden: Improving Java’s Startup Time by Per Minborg, Sébastien Deleuze

Learn how Project Leyden accelerates Java startup time and performance using CDS/AOT caching, with real examples showing 2-4x faster startup and better memory usage.

Key takeaways
  • Project Leyden aims to improve Java startup time, warm-up performance, and memory footprint while maintaining Java’s dynamic capabilities

  • CDS (Class Data Sharing) and AOT (Ahead of Time) cache are key components that allow:

    • 2-4x faster startup times
    • Better initial performance without waiting for JIT compilation
    • 20% reduced memory consumption for Spring applications
  • Main constraints for using CDS/AOT cache:

    • Must use consistent classpath between training and deployment
    • Need to perform training runs to generate optimization data
    • Limited to JAR files (no directories, wildcards, or nested JARs)
  • Project Leyden vs alternatives:

    • More compatible than GraalVM Native Image
    • Simpler to implement than Project CRaC
    • Maintains Java’s dynamic features
    • Requires minimal code changes
  • Spring Boot 3.3 integration:

    • Built-in support for CDS and AOT cache
    • Automatic training run execution
    • Container-friendly deployment
    • Simple flag-based activation
  • Key benefits demonstrated:

    • Pet Clinic sample starts in 800ms vs 3.2s
    • Reaches peak performance faster
    • No significant performance tradeoffs
    • Works with existing applications
  • Future developments:

    • More optimization opportunities being explored
    • Better integration with build tools
    • Improved memory consumption focus
    • Additional performance improvements planned