AWS Builder Center
Enhancing Java Performance on AWS with Azul Platform Prime

Enhancing Java Performance on AWS with Azul Platform Prime

This is a community post discussing how to deploy Azul Prime on AWS for JVM optimization.

Authors:
  • John Ceccarelli, Senior Director, Product Manager, Azul
  • Frank Delporte, Senior Technical Writer, Azul
Supporting authors:
  • Mrinali Umashankar, Partner Solutions Architect, AWS
Java applications often face performance challenges during scaling events. Traditional Java Virtual Machines (JVMs) execute code in interpreted mode initially, only optimizing after building usage-based profiles. This leads to suboptimal performance just when your application needs to scale up.
In this post, we'll provide a tutorial on implementing and exploring how Azul Optimizer Hub on AWS can significantly improve Java application performance by enhancing JVM functionality.

The Challenge with Traditional Java Execution

1. Slow initial performance due to code execution in interpreted mode (using class-files)
2. Delayed optimization until critical code paths (hotspots) are identified
3. Split CPU resources between requests and Just-In-Time (JIT) compilations
These issues result in slower response times and inefficient resource utilization during traffic spikes.

Azul Platform Prime on AWS

With Azul Platform Prime, you can optimize your Java workloads on AWS. It’s a solution that helps reduce cloud costs while improving application performance and scalability.
It consists of two key components: Optimizer Hub and Zing

Azul Optimizer Hub on Amazon EKS

Optimizer Hub accelerates Java performance across your AWS environment by centralizing and optimizing JIT compilation through two key services:
  • Automatically captures and reuses optimization profiles across your application fleet, enabling new instances to immediately start compiling the most optimal native code.
  • Offloads JIT compilation to a dedicated compilation farm on AWS, freeing up your application instances to focus on serving requests.

Azul Zing Builds of OpenJDK (Zing)

Zing is a drop-in Java runtime enhancement for AWS workloads that delivers:
Optimizer Hub runs centrally on Amazon EKS to provide fleet-wide optimization, while your Java applications can be deployed on EC2, ECS, or EKS. This AWS-optimized architecture maintains consistent performance during scaling events and ensures efficient resource utilization across your environment.

Deploying Azul Platform Prime on AWS

Azul Platform Prime seamlessly integrates with your existing AWS infrastructure to optimize Java workloads.

Architecture Overview

Architecture Diagram of Azul Prime in AWS Environment
As depicted in the above diagram:
  • Replace existing JVMs with Azul Zing on your EC2, EKS, or Fargate instances
  • Zing runtimes communicate with the nearest Optimizer Hub instance.
  • Each Optimizer Hub instance serves as a shared service for thousands of Java apps.

Compatibility

  • Works with your custom applications and third-party software like Apache Kafka.
  • Can be deployed on Amazon EC2, Amazon ECS, or Amazon EKS.
  • Supports cost-effective AWS Graviton-based instances.

Deployment Steps

Follow these steps to deploy Optimizer Hub on AWS EKS. More detailed info is available in the documentation .

Prerequisites:

  • AWS Account with appropriate permissions
  • AWS eksctl and AWS CLI tools installed
  • Helm v3.8.0 or newer
  • Existing or new Amazon EKS cluster
Optimizer Hub Deployment Specifications:
  • Instance Types: On-demand or reserved x86 EC2 instances (avoid spot instances).
  • Sizing: Minimum 8 vCPUs and 32GB RAM per node.
  • Recommended: Amazon EC2 M6 or M7 instance families

Provision a Kubernetes Cluster

You can either use an existing Kubernetes-cluster or create a new one with the AWS eksctl tool:
1. Install and configure the eksctl  and aws  command-line tools.
2. If you don’t have permissions to set up networking components, have your administrator create the Virtual Public Cloud.
3. Download the latest configuration files from this Azul Optimizer Hub documentation page .
4. In the downloaded package, navigate to the eks directory.
5. In opthub_eks.yaml, replace the placeholders {your-cluster-name}, {your-region}, and {path-to-your-key} with the correct values.
6. If you are working with an existing VPC and do not want eksctl to create one, uncomment the vpc section and replace {your-vpc} and {your-subnet} with the correct values.
7. Pass the modified opthub_eks.yaml file to eksctl to create the cluster:
1
eksctl create cluster -f opthub_eks.yaml

Install the Optimizer Hub Components on the EKS cluster

Make sure your Helm version is v3.8.0 or newer.
Add the Azul Helm repository to your Helm environment:
1
2
3
helm repo add opthub-helm
https://azulsystems.github.io/opthub-helm-charts/
helm repo update
Create a namespace (i.e. my-opthub) for Optimizer Hub.
1
kubectl create namespace my-opthub
Create a file values-override.yaml in your local directory. You can use this file to override any default value to match your use-case.
If you have a custom cluster domain name, specify it in values-override.yaml:
1
clusterName: "example.org"
If you want specific labels being added to your Kubernetes objects, define them in your values-override.yaml, for example as follows:
1
2
3
4
gateway:
applicationLabels: # Additional labels for Deployment/StatefulSet
podTemplateLabels: # Additional labels for POD
serviceLabels: # Additional labels for Service
Configure the blob storage according to your environment in your values-override.yaml file:
1
2
3
4
5
6
7
8
storage:
blobStorageService: s3
s3:
commonBucket: opthub-storage0
deployment:
serviceAccount:
annotations:
eks.amazonaws.com/role-arn:arn:aws:iam::<...>:role/opthub-s3-role
Install using Helm, passing in the values-override.yaml.
1
2
3
helm install opthub opthub-helm/azul-opthub \
-n my-opthub \
-f values-override.yaml
The command should produce output similar to this:
1
2
3
4
5
6
NAME: opthub
LAST DEPLOYED: Wed Jan 31 12:19:58 2024
NAMESPACE: my-opthub
STATUS: deployed
REVISION: 1
TEST SUITE: None
Verify that all started pods are ready:
1
kubectl get all -n my-opthub

Connecting Your Applications to Optimizer Hub

Once an Optimizer Hub instance is available within your environment, you can instruct any Java application to connect to it to store or get ReadyNow profiles, and offload its compilations:
1
2
3
4
5
6
java -XX:OptHubHost=<host>[:<port>] \
-XX:ProfileName=<value> \
-XX:+CNCEnableRemoteCompiler \
-XX:+EnableRNO
<other-options> \
-jar yourapp.jar

Monitoring Optimizer Hub Usage

The Optimizer Hub components are configured by default to expose key metrics for scraping by Prometheus. You can use your existing Prometheus and Grafana instances to monitor Optimizer Hub or install a separate instance of Prometheus and Grafana to just monitor your Optimizer Hub instance. The download with the latest configuration files we used before, contains a Grafana configuration json-file.
In addition to the performance metrics referenced in the example below, Optimizer Hub offers an API that provides detailed insights into instance usage.
Grafana Dashboard on Performance Metrics

Conclusion

Java applications on AWS traditionally face performance challenges during scaling events, as new instances must handle both JIT compilation and incoming requests. Azul Optimizer Hub addresses this by:
1. Separating compilation from execution.
2. Leveraging shared optimization profiles.
3. Using dedicated JIT compilation resources.
By implementing Azul Optimizer Hub on AWS, your Java applications will start serving traffic at peak performance, helping you maintain consistent service levels while optimizing resource utilization. Get started today by deploying Optimizer Hub on Amazon EKS and transform how your Java workloads perform on AWS.
For more insight – reach out to Frank , John , or Mrinali 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article