SlideShare a Scribd company logo
1 of 45
Download to read offline
The Next Frontier in
Open Source Java Compilers:
Just-In-Time Compilation as a Service
1
Rich Hagarty
IBM Developer Advocate
3
rich.hagarty@ibm.com
@rhagarty8
https://www.linkedin.com/in/rhagarty/
Agenda
• JVM and JIT
• JIT-as-a-Service
• JITServer from Eclipse OpenJ9
• Experiment results
• Demo
• Usage and recommendations
4
JVM primer
5
JVM Interpreter
Class Loader
Bytecode Verifier
Interpreter JIT
Java Bytecode
JVM
• Java programs are converted into bytecode
by the javac compiler
• Machine independent bytecodes are
interpreted by the JVM at runtime
• This ensures portability of Java programs
across different architectures
• But it affects performance because
interpretation is relatively slow
OS
Hardware
6
Just-in-Time Compiler
Class Loader
Bytecode Verifier
Interpreter JIT
Java Bytecode
JVM
• Performance is helped by the JIT compiler, which
transforms sequences of bytecodes into optimized
machine code
• Unit of compilation is a typically a method. To
save overhead, only “hot” methods are compiled
• Compiled native machine code executes ~10x
faster than a bytecode-by-bytecode interpreter
• Generated code is saved in a "code cache" for
future use for lifetime of JVM
OS
Hardware
7
JIT advantages over static compilers
JIT compilation is performed at runtime, while the Java
application is running. The has advantages over static compilers:
• JIT can optimize generated code for the machine they are
running on
• JIT can tailor-fit code to the application that is executed and to
the input that is provided. This is done through runtime
profiling
8
JIT Compilation disadvantages
9
JIT disadvantages
•JIT compilers requires CPU and memory at runtime,
which interferes with the running Java application
•Affects application startup/ramp-up and QoS
• Most JIT compilations occur during this phase
• Worse on small containers/VMs where resources are
limited
10
JIT – CPU usage
JIT compilation creates spikes in CPU usage.
• Can slow application start-up/ramp-up
• Can create hiccups in Java applications and
lower QoS
0
50
100
150
200
250
300
350
400
0 30 60 90
CPU
utilization
(%)
Time (sec)
Daytrader7 CPU consumption
CPU spikes caused
by JIT compilation
11
JIT – memory footprint
0
100000
200000
300000
400000
500000
600000
0 30 60 90
Resident
set
size
(KB)
Time (sec)
Daytrader7 memory footprint
Footprint spikes caused
by JIT compilation
JIT compilation creates spikes in memory usage
• These can create OOM events resulting in
crashes, lower availability or lower QoS
• A way to avoid OOM is to overprovision for the
peak memory consumption – resulting in
higher costs
• Determining the amount to overprovision is
hard – JVMs have a non-deterministic behavior
12
A Solution – JIT-as-a-Service
13
JIT-as-a-Service
Decouple the JIT compiler from the JVM and let it run as an independent process
Offload JIT
compilation to
remote process
Remote
JIT
Remote
JIT
JVM
JIT
JVM
JIT
Kubernetes
Control Plane
Treat JIT
compilation as a
cloud service
• Auto-managed by orchestrator
• A mono-to-micro solution
• Local JIT still available
14
JITServer from the Eclipse OpenJ9 JVM
16
Eclipse OpenJ9
• JITServer feature is available in the Eclipse OpenJ9 JVM
• Branded name is “Semeru Cloud Compiler”
• OpenJ9 combines with OpenJDK to form a full JDK
Link to GitHub repo: https://github.com/eclipse-openj9/openj9
17
Overview of Eclipse OpenJ9
Designed from the start to span all the operating
systems needed by IBM products
This JVM can go from small to large
Can handle constrained environments or memory
rich ones
Renowned for its small footprint, fast start-up and
ramp-up time
Is used by the largest enterprises on the planet
18
Eclipse OpenJ9 Performance
19
IBM Semeru Runtimes
20
IBM Semeru Runtimes
“The part of Java that’s really in the clouds”
IBM-built OpenJDK runtimes powered by the Eclipse OpenJ9 JVM
No cost, stable, secure, high performance, cloud optimized, multi-
platform, ready for development and production use
Open Edition
• Open source license (GPLv2+CE)
• Available for Java 8, 11, 17, 18 (soon 19)
Certified Edition
• IBM license
• Java SE TCK certified.
• Available for Java 11, 17
21
IBM Semeru Runtimes
All supported architectures for both Open and Certified Editions are available at:
https://ibm.biz/GetSemeru
DockerHub official images (Open Edition only):
https://hub.docker.com/_/ibm-semeru-runtimes
IBM container registry:
icr.io/appcafe/ibm-semeru-runtimes:{open/certified}-{8/11/17/18}-{jdk/jre}-{ubi/ubi-minimal}
Red Hat Registry:
https://catalog.redhat.com/software/containers/search?q=semeru
22
Adoptium Marketplace (Certified Edition)
adoptium.net/marketplace
23
OpenJ9 JITServer Technology
24
JITServer Advantages for JVM Clients
• Less memory required
– no local JIT
compilation spikes
• Easier to size – only
consider needs of
application
RESILIENCY
PERFORMANCE
PROVISIONING
• More predictable – JIT
no longer steals CPU
cycles from the app
• Improved ramp-up
time due to JITServer
supplying extra CPU
power when the JVM
needs it the most
• Improved ramp-up
most notable in
performance of short-
lived apps
If the JITServer crashes,
the JVM can continue to
run and compile with its
local JIT
25
JITServer – natural fit for the cloud
• JITServer performs better in constrained environments
• Smaller containers increase application density and thus, reduce
operational costs
• JITServer can be easily containerized and deployed to Kubernetes,
OpenShift, etc., which makes it easier to run Java applications in
densely packed cloud environments
• Use of server-side caching can lead to better cluster-wide CPU
utilization
• Improved ramp-up time improves auto-scaling behavior
• JITServer can be scaled to match demand
26
JITServer Technology availability
• Available on
• Linux on x86-64 (GA’d with OpenJ9 release 0.29.0, Oct. 2021)
• Linux on Power (GA’d with OpenJ9 release 0.29.0, Oct. 2021)
• Linux on zSystems (GA’d with OpenJ9 release 0.32.0, Apr. 2022)
• Supported Java: Java8, Java11, Java17
• Works on bare metal, in containers, on virtual machines, and in
the cloud
• Dependencies: openssl dll, but only if using encryption
27
Performance graphs
28
Improve VM costs in Amazon EC2 with JITServer
Goal to improve throughput è Vanilla OpenJ9 must move up to
a t3.micro VM
è JITServer achieves same throughput for half the cost
Instance type vCPU Memory (GiB) Price (Linux)
t3.nano 2 0.5 $0.0052/hour
t3.micro 2 1.0 $0.0104/hour
29
0
1000
2000
3000
4000
5000
0 50 100 150 200 250 300
Throughput
(pages/sec)
Time (sec)
AcmeAir throughput
t3.nano VM (2 vCPUs, 0.5 GB)
JITServer OpenJ9
0
1000
2000
3000
4000
5000
0 50 100 150 200 250 300
Throughput
(pages/sec)
Time (sec)
AcmeAir throughput
JITServer-t3.nano OpenJ9-t3.micro
0.5 GB
1 GB
Goal to minimize cost è Use t3.nano VM with 0.5 GB
• ~200 MB needed by OS è 300 MB left for AcmeAir container
èJITServer can double the throughput of vanilla OpenJ9
JITServer value in Kubernetes
• https://blog.openj9.org/2021/10/20/save-money-with-jitserver-on-the-
cloud-an-aws-experiment/
• Experimental test bed
• ROSA (RedHat OpenShift Service on AWS)
• Demonstrate that JITServer is not tied to IBM HW or SW
• OCP cluster: 3 master nodes, 2 infra nodes, 3 worker nodes
• Worker nodes have 8 vCPUs and 16 GB RAM (only ~12.3 GB available)
• Four different applications
• AcmeAir Microservices
• AcmeAir Monolithic
• Petclinic (Springboot framework)
• Quarkus
• Low amount of load to simulate conditions seen in practice
• OpenShift Scheduler to manage pod and node deployments/placement
30
JITServer improves container density and cost
Default config
AM 500
B 550
C 550
F 450 P 450
P 450
B 550
F 450
AM 500
A 350
AM 500
M 200
Q 350
P 450
Q 350
D 600
D 1000
F 450
B 550
Q 350
AM 500
AM 500
AM 500
B 550
B 550
A 350
C 550
F 450
M 200
P 450
P 450
P 450
Q 350
Q 350
D 1000
AM 500 B 550
P 450
AM 500
B 550
B 550
C 550
C 550
F 450
F 450 P 450
Q 350
Q 350
D 1000
D 1000
Q 350
AM 250
AM 250
P 250
P 250
F 250
F 250
B 400 C 350
Q 150
Q 150
M 150
AM 250
AM 250
P 250
P 250
F 250
B 400
Q 150
Q 150
J 1200
A 250
B 400
B 400
C 350
D 1000 D 1000
D 600
AM 250
AM 250
P 250
P 250
F 250
F 250
B 400 C 350
Q 150
Q 150
M 150
AM 250
AM 250
P 250
P 250
F 250
B 400
Q 150
Q 150
J 1200
A 250
B 400
B 400
C 350
D 1000
D 1000
JITServer config
Legend:
AM: AcmeAir monolithic
A: Auth service
B: Booking service
C: Customer service
D: Database (mongo/postgres)
F: Flight service
J: JITServer
M: Main service
P: Petclinic
Q: Quarkus
Total=8250 MB Total=8550 MB Total=8600 MB
Total=9250 MB Total=9850 MB
6.3 GB less
31
Throughput comparison
0
200
400
600
800
1000
1200
0 240 480 720 960 1200 1440 1680 1920
Throughput
(pages/sec)
Time (sec)
AcmeAir Microservices
0
200
400
600
800
1000
1200
0 240 480 720 960 1200 1440 1680 1920
Throughput
(pages/sec)
Time (sec)
AcmeAir Monolithic
0
20
40
60
80
100
120
140
160
180
0 240 480 720 960 1200 1440 1680 1920
Throughput
(pages/sec)
Time (sec)
Petclinic
0
500
1000
1500
2000
2500
3000
3500
0 240 480 720 960 1200 1440 1680 1920
Throughput
(pages/sec)
Time (sec)
Quarkus
Machine load:
17.5% from apps
7% from OpenShift
32
è JITServer and default configuration achieve the same level of throughput at steady-state
JITServer Baseline
Conclusions from high density experiments
• JITServer can improve container density and reduce operational costs
of Java applications running in the cloud by 20-30%
• Steady-state throughput is the same despite using fewer nodes
33
Autoscaling in Kubernetes
• Better autoscaling behavior with JITServer due to faster ramp-up
• Less risk to fool the HPA due to transient JIT compilation overhead
34
Setup:
Single node Microk8s cluster (16 vCPUs, 16 GB RAM)
JVMs limited to 1 CPU, 500MB
JITServer limited to 8 CPUs and has AOT cache enabled
Load applied with JMeter, 100 threads, 10 ms think-time,
60s ramp-up time
Autoscaler: scales up when average CPU utilization
exceeds 0.5P. Up to 15 AcmeAir instances
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
0 60 120 180 240 300 360 420 480
Throughput
(pages/sec)
Time (sec)
AcmeAir throughput when using Kubernetes autoscaling
Baseline JITServer+AOTcache
Demo
35
Demo – Improve ramp-up time with JITServer
• Experiment in docker containers
• Show that JITServer improves ramp-up
• Show that JITServer allows a lower memory limit for JVM containers
36
OpenLiberty+
AcmeAir
1P, 400 MB
limit
OpenLiberty+
AcmeAir
1P, 200 MB
limit
OpenLiberty+
AcmeAir
1P, 200 MB
limit
MongoDB
JITServer
4P, 1GB limit
JMeter
JMeter
JMeter
InfluxDB
Grafana
Collect throughput
data from JMeter
Display throughput
data
Apply load
to AcmeAir
instances
Provide data
persistence
services
Run the AcmeAir
application
Provide JIT
compilation
services
Grafana
Prometheus
Scrap
metrics
Display
JITServer
metrics
How to use it
37
JITServer usage basics
• One JDK, three different personas
• Normal JVM: $JAVA_HOME/bin/java MyApp
• JITServer: $JAVA_HOME/bin/jitserver
• Client JVM: $JAVA_HOME/bin/java -XX:+UseJITServer MyApp
• Optional further configuration through JVM command line options
• At the server:
-XX:JITServerPort=… default: 38400
• At the client:
-XX:JITServerAddress=… default: ‘localhost’
-XX:JITServerPort=… default: 38400
• Full list of options: https://www.eclipse.org/openj9/docs/jitserver/
• Note: Java version and OpenJ9 release at client and server must match
38
JITServer usage in Kubernetes
• Typically we create/configure
• JITServer deployment
• JITServer service (clients interact with service)
• Use
• Yaml files
• Helm charts
• Operators (under development)
• Tutorial: https://developer.ibm.com/tutorials/using-openj9-jitserver-in-
kubernetes/
39
JITServer Helm Chart
• How-to
• Install repo
• helm repo add openj9 https://raw.githubusercontent.com/eclipse/openj9-utils/master/helm-chart/
• Deploy JITServer chart
• helm install SomeName openj9/openj9-jitserver-chart
• This will instantiate a “deployment” and a “service”
• Further configuration can be done with arguments given at ‘helm install’ time
--set image.tag=“MyTag”
--set image.repository= “MyRepo”
--set service.port=“MyPort“
• Passing additional options to JITServer
E.g.: --set env[0].name="OPENJ9_JAVA_OPTIONS" --set env[0].value="-XX:+JITServerLogConnections“
• Blog post: https://blog.openj9.org/2021/03/20/introducing-the-eclipse-openj9-
jitserver-helm-chart/
40
JITServer traffic encryption through TLS
• Needs additional JVM options
• Server: -XX:JITServerSSLKey=key.pem -XX:JITServerSSLCert=cert.pem
• Client: -XX:JITServerSSLRootCerts=cert.pem
• Certificate and keys can be provided using Kubernetes TLS Secrets
• Create TLS secret:
• kubectl create secret tls my-tls-secret --key <private-key-filename> --cert <certificate-filename>
• Use a volume to map “pem” files
41
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container-name
image: my-image
volumeMounts:
- name: secret-volume
mountPath: /etc/secret-volume
volumes:
- name: secret-volume
secret:
secretName: my-tls-secret
Monitoring
• Support for custom metrics for Prometheus
• Metrics scrapping: GET request to http://<jitserveraddress>:<port>/metrics
• Command line options:
-XX:+JITServerMetrics -XX:JITServerMetricsPort=<port>
• Metrics available
• jitserver_cpu_utilization
• jitserver_available_memory
• jitserver_connected_clients
• jitserver_active_threads
• Verbose logging
• Print client/server connections
-XX:+JITServerLogConnections
• Heart-beat: periodically print to verbose log some JITServer stats
• -Xjit:statisticsFrequency=<period-in-ms>
• Print detailed information about client/server behavior
-Xjit:verbose={JITServer},verbose={compilePerformance},vlog=…
42
JITServer usage recommendations
• When to use it
• JVM needs to compile many methods in a relatively short time
• JVM is running in a CPU/memory constrained environment, which can worsen interference from
the JIT compiler
• The network latency between JITServer and client VM is relatively low (<1ms)
• To keep network latency low, use “latency-performance” profile for tuned and configure your VM with SR-IOV
• Recommendations
• 10-20 client JVMs connected to a single JITServer instance
• JITServer needs 1-2 GB of RAM
• In K8s set vCPU “limits” much larger than “requests” to allow for CPU usage spikes
• Better performance if the compilation phases from different JVM clients do not overlap (stagger)
• Encryption adds to the communication overhead; avoid if possible
• In K8s use “sessionAffinity” to ensure a client always connects to the same server
• Enable JITServer AOT cache: -XX:+JITServerUseAOTCache (client needs to have shared class cache
enabled)
43
Conclusions
47
Final thoughts
• JIT provides advantage, but compilation adds overhead
• Disaggregate JIT from JVM è JIT compilation as a service
• Eclipse OpenJ9 JITServer (a.k.a Semeru Cloud Compiler)
• Available now on Linux for Java 8, Java 11 and Java 17 (IBM Semeru Runtimes)
• Retain benefit of JIT optimization. Advantage increases with life of app
• Especially good for constrained environments (micro-containers)
• Kubernetes ready (Helm chart available, Prometheus integration)
• Can improve ramp-up, autoscaling and performance of short lived applications
• Can reduce peak memory footprint, increase app density and reduce operational
costs
48
Resources
• Blogs
• JITServer - Optimize your Java cloud-native applications
• Using OpenJ9 JITServer in Kubernetes
• Connect a Kubernetes Open Liberty app to OpenJ9 JITServer
• Exploring JITServer on the new Linux on IBM z16 Platform
• Save Money with JITServer on the Cloud – an AWS Experiment
• Introducing the Eclipse OpenJ9 JITServer Helm Chart
• A glimpse into performance of JITServer technology
• Free your JVM from the JIT with JITServer technology
• Presentations
• Live Demo at Oracle Code One 2018: https://youtu.be/GmP7HBzog9Q?t=1169
• Demo setup: https://github.com/mstoodle/openj9-jitaas-demo
• CASCON 2018: https://www.youtube.com/watch?v=3gKplQqy3zo
• SPLASH 2018: https://www.slideshare.net/MarkStoodley/turbo2018-workshop-jit-as-a-service
• FOSDEM 2019: http://bofh.nikhef.nl/events/FOSDEM/2019/H.1302/jit_cloud.mp4
• USENIX ATC 2022 paper: “JITServer: Disaggregated Caching JIT Compiler for the JVM in the Cloud”
• https://www.usenix.org/system/files/atc22-khrabrov.pdf
• Documentation: https://www.eclipse.org/openj9/docs/jitserver/
49
Thank You!
Questions?
rich.hagarty@ibm.com
@rhagarty8
https://www.linkedin.com/in/rhagarty/
50

More Related Content

What's hot

BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE Linaro
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Amazon Web Services
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Flexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkFlexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkDataWorks Summit
 
How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in muleRamakrishna kapa
 
Stream Processing with Kafka in Uber, Danny Yuan
Stream Processing with Kafka in Uber, Danny Yuan Stream Processing with Kafka in Uber, Danny Yuan
Stream Processing with Kafka in Uber, Danny Yuan confluent
 
Apache Calcite overview
Apache Calcite overviewApache Calcite overview
Apache Calcite overviewJulian Hyde
 
Integrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkIntegrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkHortonworks
 
Android chapter16-web-services
Android chapter16-web-servicesAndroid chapter16-web-services
Android chapter16-web-servicesAravindharamanan S
 
An introduction to Apache Thrift
An introduction to Apache ThriftAn introduction to Apache Thrift
An introduction to Apache ThriftMike Frampton
 
Scylla Summit 2022: ScyllaDB Embraces Wasm
Scylla Summit 2022: ScyllaDB Embraces WasmScylla Summit 2022: ScyllaDB Embraces Wasm
Scylla Summit 2022: ScyllaDB Embraces WasmScyllaDB
 

What's hot (20)

Php.ppt
Php.pptPhp.ppt
Php.ppt
 
BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE
 
Android : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using AndroidAndroid : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using Android
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
 
Jsf presentation
Jsf presentationJsf presentation
Jsf presentation
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
EVCache at Netflix
EVCache at NetflixEVCache at Netflix
EVCache at Netflix
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Flexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkFlexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache Flink
 
How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in mule
 
Stream Processing with Kafka in Uber, Danny Yuan
Stream Processing with Kafka in Uber, Danny Yuan Stream Processing with Kafka in Uber, Danny Yuan
Stream Processing with Kafka in Uber, Danny Yuan
 
Apache Calcite overview
Apache Calcite overviewApache Calcite overview
Apache Calcite overview
 
Introduction to Apache Beam
Introduction to Apache BeamIntroduction to Apache Beam
Introduction to Apache Beam
 
Testing in airflow
Testing in airflowTesting in airflow
Testing in airflow
 
Integrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkIntegrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache Flink
 
Android chapter16-web-services
Android chapter16-web-servicesAndroid chapter16-web-services
Android chapter16-web-services
 
An introduction to Apache Thrift
An introduction to Apache ThriftAn introduction to Apache Thrift
An introduction to Apache Thrift
 
Scylla Summit 2022: ScyllaDB Embraces Wasm
Scylla Summit 2022: ScyllaDB Embraces WasmScylla Summit 2022: ScyllaDB Embraces Wasm
Scylla Summit 2022: ScyllaDB Embraces Wasm
 
Xml parsers
Xml parsersXml parsers
Xml parsers
 

Similar to JITServerTalk.pdf

JITServerTalk-OSS-2023.pdf
JITServerTalk-OSS-2023.pdfJITServerTalk-OSS-2023.pdf
JITServerTalk-OSS-2023.pdfRichHagarty
 
USAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdfUSAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdfRichHagarty
 
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...RichHagarty
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxGrace Jansen
 
JITServerTalk Nebraska 2023.pdf
JITServerTalk Nebraska 2023.pdfJITServerTalk Nebraska 2023.pdf
JITServerTalk Nebraska 2023.pdfRichHagarty
 
JITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfJITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfRichHagarty
 
JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptxGrace Jansen
 
Java-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfJava-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfRichHagarty
 
javalightspeed-jakartatech-2023.pdf
javalightspeed-jakartatech-2023.pdfjavalightspeed-jakartatech-2023.pdf
javalightspeed-jakartatech-2023.pdfRichHagarty
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceAmazon Web Services
 
z/VM Performance Analysis
z/VM Performance Analysisz/VM Performance Analysis
z/VM Performance AnalysisRodrigo Campos
 
Presentation v mware performance overview
Presentation   v mware performance overviewPresentation   v mware performance overview
Presentation v mware performance overviewsolarisyourep
 
(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep DiveAmazon Web Services
 
SemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSumanMitra22
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a ServiceMark Stoodley
 
Enhanced Live Migration for Intensive Memory Loads
Enhanced Live Migration for Intensive Memory LoadsEnhanced Live Migration for Intensive Memory Loads
Enhanced Live Migration for Intensive Memory LoadsSamsung Open Source Group
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfSumanMitra22
 
CMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesCMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesAmazon Web Services
 
20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWSAmazon Web Services Korea
 
Nytro-XV_NWD_VM_Performance_Acceleration
Nytro-XV_NWD_VM_Performance_AccelerationNytro-XV_NWD_VM_Performance_Acceleration
Nytro-XV_NWD_VM_Performance_AccelerationKhai Le
 

Similar to JITServerTalk.pdf (20)

JITServerTalk-OSS-2023.pdf
JITServerTalk-OSS-2023.pdfJITServerTalk-OSS-2023.pdf
JITServerTalk-OSS-2023.pdf
 
USAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdfUSAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdf
 
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...
DevNexus 2024: Just-In-Time Compilation as a Service for cloud-native Java mi...
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptx
 
JITServerTalk Nebraska 2023.pdf
JITServerTalk Nebraska 2023.pdfJITServerTalk Nebraska 2023.pdf
JITServerTalk Nebraska 2023.pdf
 
JITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfJITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdf
 
JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptx
 
Java-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfJava-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdf
 
javalightspeed-jakartatech-2023.pdf
javalightspeed-jakartatech-2023.pdfjavalightspeed-jakartatech-2023.pdf
javalightspeed-jakartatech-2023.pdf
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance Performance
 
z/VM Performance Analysis
z/VM Performance Analysisz/VM Performance Analysis
z/VM Performance Analysis
 
Presentation v mware performance overview
Presentation   v mware performance overviewPresentation   v mware performance overview
Presentation v mware performance overview
 
(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive
 
SemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptx
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a Service
 
Enhanced Live Migration for Intensive Memory Loads
Enhanced Live Migration for Intensive Memory LoadsEnhanced Live Migration for Intensive Memory Loads
Enhanced Live Migration for Intensive Memory Loads
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdf
 
CMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesCMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 Instances
 
20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS
 
Nytro-XV_NWD_VM_Performance_Acceleration
Nytro-XV_NWD_VM_Performance_AccelerationNytro-XV_NWD_VM_Performance_Acceleration
Nytro-XV_NWD_VM_Performance_Acceleration
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

JITServerTalk.pdf

  • 1. The Next Frontier in Open Source Java Compilers: Just-In-Time Compilation as a Service 1
  • 2. Rich Hagarty IBM Developer Advocate 3 rich.hagarty@ibm.com @rhagarty8 https://www.linkedin.com/in/rhagarty/
  • 3. Agenda • JVM and JIT • JIT-as-a-Service • JITServer from Eclipse OpenJ9 • Experiment results • Demo • Usage and recommendations 4
  • 5. JVM Interpreter Class Loader Bytecode Verifier Interpreter JIT Java Bytecode JVM • Java programs are converted into bytecode by the javac compiler • Machine independent bytecodes are interpreted by the JVM at runtime • This ensures portability of Java programs across different architectures • But it affects performance because interpretation is relatively slow OS Hardware 6
  • 6. Just-in-Time Compiler Class Loader Bytecode Verifier Interpreter JIT Java Bytecode JVM • Performance is helped by the JIT compiler, which transforms sequences of bytecodes into optimized machine code • Unit of compilation is a typically a method. To save overhead, only “hot” methods are compiled • Compiled native machine code executes ~10x faster than a bytecode-by-bytecode interpreter • Generated code is saved in a "code cache" for future use for lifetime of JVM OS Hardware 7
  • 7. JIT advantages over static compilers JIT compilation is performed at runtime, while the Java application is running. The has advantages over static compilers: • JIT can optimize generated code for the machine they are running on • JIT can tailor-fit code to the application that is executed and to the input that is provided. This is done through runtime profiling 8
  • 9. JIT disadvantages •JIT compilers requires CPU and memory at runtime, which interferes with the running Java application •Affects application startup/ramp-up and QoS • Most JIT compilations occur during this phase • Worse on small containers/VMs where resources are limited 10
  • 10. JIT – CPU usage JIT compilation creates spikes in CPU usage. • Can slow application start-up/ramp-up • Can create hiccups in Java applications and lower QoS 0 50 100 150 200 250 300 350 400 0 30 60 90 CPU utilization (%) Time (sec) Daytrader7 CPU consumption CPU spikes caused by JIT compilation 11
  • 11. JIT – memory footprint 0 100000 200000 300000 400000 500000 600000 0 30 60 90 Resident set size (KB) Time (sec) Daytrader7 memory footprint Footprint spikes caused by JIT compilation JIT compilation creates spikes in memory usage • These can create OOM events resulting in crashes, lower availability or lower QoS • A way to avoid OOM is to overprovision for the peak memory consumption – resulting in higher costs • Determining the amount to overprovision is hard – JVMs have a non-deterministic behavior 12
  • 12. A Solution – JIT-as-a-Service 13
  • 13. JIT-as-a-Service Decouple the JIT compiler from the JVM and let it run as an independent process Offload JIT compilation to remote process Remote JIT Remote JIT JVM JIT JVM JIT Kubernetes Control Plane Treat JIT compilation as a cloud service • Auto-managed by orchestrator • A mono-to-micro solution • Local JIT still available 14
  • 14. JITServer from the Eclipse OpenJ9 JVM 16
  • 15. Eclipse OpenJ9 • JITServer feature is available in the Eclipse OpenJ9 JVM • Branded name is “Semeru Cloud Compiler” • OpenJ9 combines with OpenJDK to form a full JDK Link to GitHub repo: https://github.com/eclipse-openj9/openj9 17
  • 16. Overview of Eclipse OpenJ9 Designed from the start to span all the operating systems needed by IBM products This JVM can go from small to large Can handle constrained environments or memory rich ones Renowned for its small footprint, fast start-up and ramp-up time Is used by the largest enterprises on the planet 18
  • 19. IBM Semeru Runtimes “The part of Java that’s really in the clouds” IBM-built OpenJDK runtimes powered by the Eclipse OpenJ9 JVM No cost, stable, secure, high performance, cloud optimized, multi- platform, ready for development and production use Open Edition • Open source license (GPLv2+CE) • Available for Java 8, 11, 17, 18 (soon 19) Certified Edition • IBM license • Java SE TCK certified. • Available for Java 11, 17 21
  • 20. IBM Semeru Runtimes All supported architectures for both Open and Certified Editions are available at: https://ibm.biz/GetSemeru DockerHub official images (Open Edition only): https://hub.docker.com/_/ibm-semeru-runtimes IBM container registry: icr.io/appcafe/ibm-semeru-runtimes:{open/certified}-{8/11/17/18}-{jdk/jre}-{ubi/ubi-minimal} Red Hat Registry: https://catalog.redhat.com/software/containers/search?q=semeru 22
  • 21. Adoptium Marketplace (Certified Edition) adoptium.net/marketplace 23
  • 23. JITServer Advantages for JVM Clients • Less memory required – no local JIT compilation spikes • Easier to size – only consider needs of application RESILIENCY PERFORMANCE PROVISIONING • More predictable – JIT no longer steals CPU cycles from the app • Improved ramp-up time due to JITServer supplying extra CPU power when the JVM needs it the most • Improved ramp-up most notable in performance of short- lived apps If the JITServer crashes, the JVM can continue to run and compile with its local JIT 25
  • 24. JITServer – natural fit for the cloud • JITServer performs better in constrained environments • Smaller containers increase application density and thus, reduce operational costs • JITServer can be easily containerized and deployed to Kubernetes, OpenShift, etc., which makes it easier to run Java applications in densely packed cloud environments • Use of server-side caching can lead to better cluster-wide CPU utilization • Improved ramp-up time improves auto-scaling behavior • JITServer can be scaled to match demand 26
  • 25. JITServer Technology availability • Available on • Linux on x86-64 (GA’d with OpenJ9 release 0.29.0, Oct. 2021) • Linux on Power (GA’d with OpenJ9 release 0.29.0, Oct. 2021) • Linux on zSystems (GA’d with OpenJ9 release 0.32.0, Apr. 2022) • Supported Java: Java8, Java11, Java17 • Works on bare metal, in containers, on virtual machines, and in the cloud • Dependencies: openssl dll, but only if using encryption 27
  • 27. Improve VM costs in Amazon EC2 with JITServer Goal to improve throughput è Vanilla OpenJ9 must move up to a t3.micro VM è JITServer achieves same throughput for half the cost Instance type vCPU Memory (GiB) Price (Linux) t3.nano 2 0.5 $0.0052/hour t3.micro 2 1.0 $0.0104/hour 29 0 1000 2000 3000 4000 5000 0 50 100 150 200 250 300 Throughput (pages/sec) Time (sec) AcmeAir throughput t3.nano VM (2 vCPUs, 0.5 GB) JITServer OpenJ9 0 1000 2000 3000 4000 5000 0 50 100 150 200 250 300 Throughput (pages/sec) Time (sec) AcmeAir throughput JITServer-t3.nano OpenJ9-t3.micro 0.5 GB 1 GB Goal to minimize cost è Use t3.nano VM with 0.5 GB • ~200 MB needed by OS è 300 MB left for AcmeAir container èJITServer can double the throughput of vanilla OpenJ9
  • 28. JITServer value in Kubernetes • https://blog.openj9.org/2021/10/20/save-money-with-jitserver-on-the- cloud-an-aws-experiment/ • Experimental test bed • ROSA (RedHat OpenShift Service on AWS) • Demonstrate that JITServer is not tied to IBM HW or SW • OCP cluster: 3 master nodes, 2 infra nodes, 3 worker nodes • Worker nodes have 8 vCPUs and 16 GB RAM (only ~12.3 GB available) • Four different applications • AcmeAir Microservices • AcmeAir Monolithic • Petclinic (Springboot framework) • Quarkus • Low amount of load to simulate conditions seen in practice • OpenShift Scheduler to manage pod and node deployments/placement 30
  • 29. JITServer improves container density and cost Default config AM 500 B 550 C 550 F 450 P 450 P 450 B 550 F 450 AM 500 A 350 AM 500 M 200 Q 350 P 450 Q 350 D 600 D 1000 F 450 B 550 Q 350 AM 500 AM 500 AM 500 B 550 B 550 A 350 C 550 F 450 M 200 P 450 P 450 P 450 Q 350 Q 350 D 1000 AM 500 B 550 P 450 AM 500 B 550 B 550 C 550 C 550 F 450 F 450 P 450 Q 350 Q 350 D 1000 D 1000 Q 350 AM 250 AM 250 P 250 P 250 F 250 F 250 B 400 C 350 Q 150 Q 150 M 150 AM 250 AM 250 P 250 P 250 F 250 B 400 Q 150 Q 150 J 1200 A 250 B 400 B 400 C 350 D 1000 D 1000 D 600 AM 250 AM 250 P 250 P 250 F 250 F 250 B 400 C 350 Q 150 Q 150 M 150 AM 250 AM 250 P 250 P 250 F 250 B 400 Q 150 Q 150 J 1200 A 250 B 400 B 400 C 350 D 1000 D 1000 JITServer config Legend: AM: AcmeAir monolithic A: Auth service B: Booking service C: Customer service D: Database (mongo/postgres) F: Flight service J: JITServer M: Main service P: Petclinic Q: Quarkus Total=8250 MB Total=8550 MB Total=8600 MB Total=9250 MB Total=9850 MB 6.3 GB less 31
  • 30. Throughput comparison 0 200 400 600 800 1000 1200 0 240 480 720 960 1200 1440 1680 1920 Throughput (pages/sec) Time (sec) AcmeAir Microservices 0 200 400 600 800 1000 1200 0 240 480 720 960 1200 1440 1680 1920 Throughput (pages/sec) Time (sec) AcmeAir Monolithic 0 20 40 60 80 100 120 140 160 180 0 240 480 720 960 1200 1440 1680 1920 Throughput (pages/sec) Time (sec) Petclinic 0 500 1000 1500 2000 2500 3000 3500 0 240 480 720 960 1200 1440 1680 1920 Throughput (pages/sec) Time (sec) Quarkus Machine load: 17.5% from apps 7% from OpenShift 32 è JITServer and default configuration achieve the same level of throughput at steady-state JITServer Baseline
  • 31. Conclusions from high density experiments • JITServer can improve container density and reduce operational costs of Java applications running in the cloud by 20-30% • Steady-state throughput is the same despite using fewer nodes 33
  • 32. Autoscaling in Kubernetes • Better autoscaling behavior with JITServer due to faster ramp-up • Less risk to fool the HPA due to transient JIT compilation overhead 34 Setup: Single node Microk8s cluster (16 vCPUs, 16 GB RAM) JVMs limited to 1 CPU, 500MB JITServer limited to 8 CPUs and has AOT cache enabled Load applied with JMeter, 100 threads, 10 ms think-time, 60s ramp-up time Autoscaler: scales up when average CPU utilization exceeds 0.5P. Up to 15 AcmeAir instances 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 0 60 120 180 240 300 360 420 480 Throughput (pages/sec) Time (sec) AcmeAir throughput when using Kubernetes autoscaling Baseline JITServer+AOTcache
  • 34. Demo – Improve ramp-up time with JITServer • Experiment in docker containers • Show that JITServer improves ramp-up • Show that JITServer allows a lower memory limit for JVM containers 36 OpenLiberty+ AcmeAir 1P, 400 MB limit OpenLiberty+ AcmeAir 1P, 200 MB limit OpenLiberty+ AcmeAir 1P, 200 MB limit MongoDB JITServer 4P, 1GB limit JMeter JMeter JMeter InfluxDB Grafana Collect throughput data from JMeter Display throughput data Apply load to AcmeAir instances Provide data persistence services Run the AcmeAir application Provide JIT compilation services Grafana Prometheus Scrap metrics Display JITServer metrics
  • 35. How to use it 37
  • 36. JITServer usage basics • One JDK, three different personas • Normal JVM: $JAVA_HOME/bin/java MyApp • JITServer: $JAVA_HOME/bin/jitserver • Client JVM: $JAVA_HOME/bin/java -XX:+UseJITServer MyApp • Optional further configuration through JVM command line options • At the server: -XX:JITServerPort=… default: 38400 • At the client: -XX:JITServerAddress=… default: ‘localhost’ -XX:JITServerPort=… default: 38400 • Full list of options: https://www.eclipse.org/openj9/docs/jitserver/ • Note: Java version and OpenJ9 release at client and server must match 38
  • 37. JITServer usage in Kubernetes • Typically we create/configure • JITServer deployment • JITServer service (clients interact with service) • Use • Yaml files • Helm charts • Operators (under development) • Tutorial: https://developer.ibm.com/tutorials/using-openj9-jitserver-in- kubernetes/ 39
  • 38. JITServer Helm Chart • How-to • Install repo • helm repo add openj9 https://raw.githubusercontent.com/eclipse/openj9-utils/master/helm-chart/ • Deploy JITServer chart • helm install SomeName openj9/openj9-jitserver-chart • This will instantiate a “deployment” and a “service” • Further configuration can be done with arguments given at ‘helm install’ time --set image.tag=“MyTag” --set image.repository= “MyRepo” --set service.port=“MyPort“ • Passing additional options to JITServer E.g.: --set env[0].name="OPENJ9_JAVA_OPTIONS" --set env[0].value="-XX:+JITServerLogConnections“ • Blog post: https://blog.openj9.org/2021/03/20/introducing-the-eclipse-openj9- jitserver-helm-chart/ 40
  • 39. JITServer traffic encryption through TLS • Needs additional JVM options • Server: -XX:JITServerSSLKey=key.pem -XX:JITServerSSLCert=cert.pem • Client: -XX:JITServerSSLRootCerts=cert.pem • Certificate and keys can be provided using Kubernetes TLS Secrets • Create TLS secret: • kubectl create secret tls my-tls-secret --key <private-key-filename> --cert <certificate-filename> • Use a volume to map “pem” files 41 apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: my-container-name image: my-image volumeMounts: - name: secret-volume mountPath: /etc/secret-volume volumes: - name: secret-volume secret: secretName: my-tls-secret
  • 40. Monitoring • Support for custom metrics for Prometheus • Metrics scrapping: GET request to http://<jitserveraddress>:<port>/metrics • Command line options: -XX:+JITServerMetrics -XX:JITServerMetricsPort=<port> • Metrics available • jitserver_cpu_utilization • jitserver_available_memory • jitserver_connected_clients • jitserver_active_threads • Verbose logging • Print client/server connections -XX:+JITServerLogConnections • Heart-beat: periodically print to verbose log some JITServer stats • -Xjit:statisticsFrequency=<period-in-ms> • Print detailed information about client/server behavior -Xjit:verbose={JITServer},verbose={compilePerformance},vlog=… 42
  • 41. JITServer usage recommendations • When to use it • JVM needs to compile many methods in a relatively short time • JVM is running in a CPU/memory constrained environment, which can worsen interference from the JIT compiler • The network latency between JITServer and client VM is relatively low (<1ms) • To keep network latency low, use “latency-performance” profile for tuned and configure your VM with SR-IOV • Recommendations • 10-20 client JVMs connected to a single JITServer instance • JITServer needs 1-2 GB of RAM • In K8s set vCPU “limits” much larger than “requests” to allow for CPU usage spikes • Better performance if the compilation phases from different JVM clients do not overlap (stagger) • Encryption adds to the communication overhead; avoid if possible • In K8s use “sessionAffinity” to ensure a client always connects to the same server • Enable JITServer AOT cache: -XX:+JITServerUseAOTCache (client needs to have shared class cache enabled) 43
  • 43. Final thoughts • JIT provides advantage, but compilation adds overhead • Disaggregate JIT from JVM è JIT compilation as a service • Eclipse OpenJ9 JITServer (a.k.a Semeru Cloud Compiler) • Available now on Linux for Java 8, Java 11 and Java 17 (IBM Semeru Runtimes) • Retain benefit of JIT optimization. Advantage increases with life of app • Especially good for constrained environments (micro-containers) • Kubernetes ready (Helm chart available, Prometheus integration) • Can improve ramp-up, autoscaling and performance of short lived applications • Can reduce peak memory footprint, increase app density and reduce operational costs 48
  • 44. Resources • Blogs • JITServer - Optimize your Java cloud-native applications • Using OpenJ9 JITServer in Kubernetes • Connect a Kubernetes Open Liberty app to OpenJ9 JITServer • Exploring JITServer on the new Linux on IBM z16 Platform • Save Money with JITServer on the Cloud – an AWS Experiment • Introducing the Eclipse OpenJ9 JITServer Helm Chart • A glimpse into performance of JITServer technology • Free your JVM from the JIT with JITServer technology • Presentations • Live Demo at Oracle Code One 2018: https://youtu.be/GmP7HBzog9Q?t=1169 • Demo setup: https://github.com/mstoodle/openj9-jitaas-demo • CASCON 2018: https://www.youtube.com/watch?v=3gKplQqy3zo • SPLASH 2018: https://www.slideshare.net/MarkStoodley/turbo2018-workshop-jit-as-a-service • FOSDEM 2019: http://bofh.nikhef.nl/events/FOSDEM/2019/H.1302/jit_cloud.mp4 • USENIX ATC 2022 paper: “JITServer: Disaggregated Caching JIT Compiler for the JVM in the Cloud” • https://www.usenix.org/system/files/atc22-khrabrov.pdf • Documentation: https://www.eclipse.org/openj9/docs/jitserver/ 49