Developing Cloud Native Applications with GraalVM
This is a guest blog post by Eric Gadbois.
I’m thrilled to introduce a new set of demonstration examples that use GraalVM Native Image to build and deploy Java applications to multiple cloud platforms! These self-guided demonstrations provide you with all the instructions and resources you need to leverage GraalVM to build and run an application as a native executable on a variety of clouds.
GraalVM and Cloud Platforms
I’ve provided the examples in the GraalVM Demos GitHub repository. They cover the following popular cloud platforms. The code provided in each of these demos is built using the Micronaut® framework, which continues to be an excellent framework for the creation of programs that are compatible with GraalVM Native Image that can be easily compiled into efficient native executables.
- GraalVM on Oracle Cloud Infrastructure (OCI) Container Instances — Build a containerized native executable, then deploy it to OCI Container Instances
- GraalVM on AWS Fargate — Build a containerized native executable, then deploy to it to AWS Fargate
- GraalVM on AWS Lambda — Build a simple Java function, and a native executable, then deploy them both to AWS Lambda
- GraalVM on Google Cloud Run — Build a containerized native executable, then deploy to it to Google Cloud Run.
Smaller Applications
In each of the examples, I describe how to use the GraalVM Native Image ahead-of-time compiler to package the code for a simple HTTP “Hello World” Micronaut application into a native executable that contains just the classes and methods from the application and dependent libraries that are required.
Faster Response Times
The other characteristic which often determines the cost of running your application on the cloud is the amount of time required to start the application and then respond to requests. Typically, this not only includes the time your application is actually running, but even the time it takes for it to initialize and start up! By using a native executable built by GraalVM Native Image, you can achieve significantly improved application startup times and thus reduce your cloud costs.
Getting Started
With GraalVM Native Image supported by the SDKs of all the leading cloud platforms, it’s ideal for the development and deployment of efficient microservices and functions. To get started, check out the GraalVM Demos GitHub repository and scroll to the “Native Image on Cloud Platforms” section to a view a full list of the demos available for you to try!