Introduction to GraalVM
GraalVM is a high-performance VM that provides the runtime for modern cloud-native applications. Cloud-native applications are built based on the service architecture. The microservice architecture changes the paradigm of building micro applications, which challenges the fundamental way we build and run applications. The microservices runtimes demand a different set of requirements.
Here are some of the key requirements of a cloud-native application built on the microservice architecture:
- Smaller footprint: Cloud-native applications run on the "pay for what we use" model. This means that the cloud-native runtimes need to have a smaller memory footprint and should run with the optimum CPU cycles. This will help run more workloads with fewer cloud resources.
- Quicker bootstrap: Scalability is one of the most important aspects of container-based microservices architecture. The faster the application's bootup, the faster it can scale the clusters. This is even more important for serverless architectures, where the code is initialized and run and then shut down on request.
- Polyglot and interoperability: Polyglot is the reality; each language has its strengths and will continue to. Cloud-native microservices are being built with different languages. It's very important to have an architecture that embraces the polyglot requirements and provides interoperability across languages. As we move to modern architectures, it's important to reuse as much code and logic as possible, that is time-tested and critical for business.
GraalVM provides a solution to all these requirements and provides a common platform to embed and run polyglot cloud-native applications. It is built on JVM and brings in further optimizations. Before understanding how GraalVM works, it's important to understand the internal workings of JVM.
Traditional JVM (before GraalVM) has evolved into the most mature runtime implementation. While it has some of the previously listed requirements, it is not built for cloud-native applications, and it comes with its baggage of monolith design principles. It is not an ideal runtime for cloud-native applications.
This chapter will walk you through in detail how JVM works and the key components of the JVM architecture.