Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 28, 2026·3 min de lectura

GraalVM — Universal Polyglot Virtual Machine

A high-performance JDK distribution and polyglot runtime from Oracle that compiles Java applications to native executables and runs multiple languages on a shared runtime.

Introduction

GraalVM is an advanced JDK distribution by Oracle that includes a high-performance JIT compiler and a native-image tool for ahead-of-time compilation. It produces standalone executables with instant startup and low memory footprint, making it particularly suited for microservices and serverless workloads.

What GraalVM Does

  • Compiles Java applications to standalone native binaries with millisecond startup times
  • Provides a high-performance Graal JIT compiler that replaces the C2 compiler in HotSpot
  • Runs polyglot programs mixing Java, JavaScript, Python, Ruby, R, and LLVM-based languages
  • Supports embedding guest languages into Java applications via the Truffle framework
  • Offers a community edition (free) and an Oracle GraalVM edition with additional optimizations

Architecture Overview

GraalVM is built on the HotSpot JVM with the Graal compiler replacing the server-side JIT. The native-image tool performs static analysis at build time, identifies reachable code through a closed-world assumption, and compiles it ahead-of-time via the Substrate VM into a self-contained binary. The Truffle framework provides a language implementation API where partial evaluation and compilation are handled automatically.

Self-Hosting & Configuration

  • Install via SDKMAN, download from graalvm.org, or use Docker images
  • Use native-image to compile Spring Boot, Quarkus, or Micronaut apps to native binaries
  • Configure reflection, resources, and JNI via JSON metadata files or the tracing agent
  • Set heap limits with -Xmx for native images to control memory usage
  • Use GraalVM Reachability Metadata Repository for third-party library compatibility

Key Features

  • Native executables start in under 10ms with a fraction of the memory of a JVM process
  • Graal JIT compiler delivers competitive peak throughput for long-running applications
  • Profile-guided optimization (PGO) further improves native-image runtime performance
  • Closed-world analysis enables aggressive dead-code elimination and smaller binaries
  • First-class integration with Quarkus, Micronaut, Spring Boot, and Helidon frameworks

Comparison with Similar Tools

  • Standard OpenJDK — better peak throughput for long-running apps but slower startup and higher memory
  • Eclipse OpenJ9 — optimized JVM with shared classes and fast startup, but no native-image equivalent
  • CRaC (Coordinated Restore at Checkpoint) — checkpoint/restore for fast startup without AOT compilation trade-offs
  • Kotlin/Native — compiles Kotlin to native code; limited to Kotlin, not the full JVM ecosystem

FAQ

Q: Does native-image support all Java libraries? A: Most libraries work, but those using reflection, dynamic proxies, or class loading require metadata configuration. Many popular frameworks ship with built-in GraalVM support.

Q: How does startup time compare to a regular JVM? A: Native executables typically start in 5-50ms versus 1-10 seconds for a JVM application.

Q: Is GraalVM free to use? A: GraalVM Community Edition is open source under GPLv2. Oracle GraalVM is free for development and production under the GraalVM Free Terms and Conditions.

Q: Can I use GraalVM as a drop-in JDK replacement? A: Yes. GraalVM is a full JDK distribution and can run any Java application without modification.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados