SlideShare a Scribd company logo
1
Java and Containers:
Christine H. Flood
Senior Principal Software Engineer
What’s there to Think About?
2
Adventures with Containers
for JVM Hackers
Christine H. Flood
Senior Principal Software Engineer
3
Evolution of Java (1990s)
Safe Duke
4
Evolution of Java (2000s)
Fast Duke
5
Evolution of Java (2010s)
Smooth Duke
6
Evolution of Java (2020s)
Packed Duke
7
What are we optimizing for now?
Smaller Footprint
Faster Startup
Smaller Image Size
8
Command Line Parameters
Smaller Footprint Old School
-XX:+UseSerialGC
SerialGC has lower overhead than any of the other collectors
-XX:MinHeapFreeRatio
Default is 40 <=> Grow the heap if occupancy is > 60%
Recommend 20
-XX:MaxHeapFreeRatio
Default is 70 <=> Shrink the heap if occupancy is < 30%
Recommend 40
-XX:GCTimeRatio
Default is 99 <=> Target 1% of time in GC
Recommend 4 <=> 25%
-XX:AdaptiveSizePolicyWeight
Default is 10 <=> Scale of 0 to 100
Recommend 90
9
Command Line Parameters
Smaller Footprint Old School
-XX:+UnlockDiagnosticVMOptions
-XX:NativeMemoryTracking=”summary”
-XX:+PrintNMTStatistics These options will print out the non-heap memory usage of your JVM.
-Xss228k This will decrease the size of your Java Stacks. The default is 1024.
java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version
10
Containerized TestRandom
FROM openjdk:16
WORKDIR /
Add TestRandom.class TestRandom.class
CMD ["java" , "-XshowSettings:system", "TestRandom", "100000", "10000000000"]
podman build -f OpenJDKDockerFile -t openjdk
podman run openjdk
11
-XshowSettings:system
Operating System Metrics:
Provider: cgroupv2
Effective CPU Count: 8
CPU Period: -1
CPU Quota: -1
CPU Shares: -1
List of Processors: N/A
List of Effective Processors: N/A
List of Memory Nodes: N/A
List of Available Memory Nodes: N/A
Memory Limit: Unlimited
Memory Soft Limit: 0.00K
Memory & Swap Limit: Unlimited
12
TestRandom 5 100
20
20
20
20
20
13
What Can We Do?
Command Line Parameters
Checkpoint/Restore
SubstrateVM
14
Checkpoint/Restore
Copies entire container to disk and can quickly restore it.
Avoids class initialization.
Can checkpoint after JIT is warmed up, classes are loaded, heap is fully gc’d.
15
Checkpoint/Restore
sudo podman build -f OpenJDKDockerFile -t openjdk
sudo podman run openjdk
sudo podman container checkpoint -l
Stops the container
sudo podman container restore -l
Restarts the container
16
Checkpoint/Restore
Doesn’t currently work with Fedora 31 due to Cgroups V2.
sudo dnf install grubby
sudo grubby --update-kernel=ALL –args="systemd.unified_cgroup_hierarchy=0"
Reboot
To run with Cgroups V1
17
SubstrateVM
FROM quay.io/quarkus/ubi-quarkus-mandrel:20.2-java11
WORKDIR /tmp
ADD TestRandom.class TestRandom.class
RUN native-image -H:+ReportExceptionStackTraces -H:Name=TestRandom.out -H:Class=TestRandom.class TestRandom
RUN chmod +x /tmp/TestRandom.out
ENTRYPOINT ["/tmp/TestRandom.out", "10000", "1000000000"]
And then
Podman build -f MyDockerFile -t mydockerimage
Podman run mydockerimage
Or
podman run -v ./:/project:z --env LANG=C --user 1000:1000 --userns=keep-id --rm quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11 -H:
+ReportExceptionStackTraces -H:Name=./TestRandom3.out -H:Class=./TestRandom.class TestRandom
18
SubstrateVM vs OpenJDK
/usr/bin/time podman run nativeimage
Testing random number generator with upper bound = 10000 and sample size 1000000000
Max bin size = 101185 Min bin size = 10000 median bin size = 100000.0
0.11user 0.04system 0:28.63elapsed 0%CPU (0avgtext+0avgdata 58488maxresident)k
0inputs+656outputs (0major+9497minor)pagefaults 0swaps
[/usr/bin/time podman run openjdkbig
Testing random number generator with upper bound = 10000 and sample size 1000000000
Max bin size = 101305 Min bin size = 10000 median bin size = 100000.0
0.15user 0.05system 0:25.69elapsed 0%CPU (0avgtext+0avgdata 58388maxresident)k
0inputs+656outputs (0major+9500minor)pagefaults 0swaps
19
Podman ps
[chf@dhcp111 containers]$ podman ps -as
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
b83a9c004dd0 localhost/nativeimage:latest ./TestRandom.out ... 47 seconds ago Up 47 seconds ago relaxed_torvalds 0B (virtual 1.74GB)
ccbdb549ecf3 localhost/openjdkbig:latest java TestRandom 1... 51 seconds ago Exited (0) 23 seconds ago priceless_herschel 0B (virtual
502MB)
20
Questions I didn’t address
What does it mean if you give podman constraints that the JVM doesn’t understand
Partial Share of a Processor
Run ParallelGC on a Single processor
21
Contact Info
CHF@Redhat.com
CONFIDENTIAL Designator
linkedin.com/company/red-hat
youtube.com/user/
RedHatVideos
facebook.com/redhatinc
twitter.com/RedHat
22
Thank you
Red Hat is the world’s leading provider of
enterprise open source software solutions.
Award-winning support, training, and
consulting services make
Red Hat a trusted adviser to the Fortune 500.

More Related Content

What's hot

DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
DevOps_Fest
 

What's hot (20)

OpenNebulaConf 2016 - Measuring and tuning VM performance by Boyan Krosnov, S...
OpenNebulaConf 2016 - Measuring and tuning VM performance by Boyan Krosnov, S...OpenNebulaConf 2016 - Measuring and tuning VM performance by Boyan Krosnov, S...
OpenNebulaConf 2016 - Measuring and tuning VM performance by Boyan Krosnov, S...
 
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
 
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, KyivKubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
 
Kubernetes and the hybrid cloud with Skupper | DevNation tech talk
Kubernetes and the hybrid cloud with Skupper | DevNation tech talkKubernetes and the hybrid cloud with Skupper | DevNation tech talk
Kubernetes and the hybrid cloud with Skupper | DevNation tech talk
 
Docker in the Wild
Docker in the WildDocker in the Wild
Docker in the Wild
 
Deploy Prometheus - Grafana and EFK stack on Kubic k8s Clusters
Deploy Prometheus - Grafana and EFK stack on Kubic k8s ClustersDeploy Prometheus - Grafana and EFK stack on Kubic k8s Clusters
Deploy Prometheus - Grafana and EFK stack on Kubic k8s Clusters
 
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
 
Kubernetes based Cloud-region support in ONAP to bring up VM and container ba...
Kubernetes based Cloud-region support in ONAP to bring up VM and container ba...Kubernetes based Cloud-region support in ONAP to bring up VM and container ba...
Kubernetes based Cloud-region support in ONAP to bring up VM and container ba...
 
[OpenInfra Days Korea 2018] (Track 3) - CephFS with OpenStack Manila based on...
[OpenInfra Days Korea 2018] (Track 3) - CephFS with OpenStack Manila based on...[OpenInfra Days Korea 2018] (Track 3) - CephFS with OpenStack Manila based on...
[OpenInfra Days Korea 2018] (Track 3) - CephFS with OpenStack Manila based on...
 
Kubernetes Failure Stories - KubeCon Europe Barcelona
Kubernetes Failure Stories - KubeCon Europe BarcelonaKubernetes Failure Stories - KubeCon Europe Barcelona
Kubernetes Failure Stories - KubeCon Europe Barcelona
 
Quarkus Denmark 2019
Quarkus Denmark 2019Quarkus Denmark 2019
Quarkus Denmark 2019
 
[OpenInfra Days Korea 2018] Day 2 - E3-2: "핞슈옚 ì›ŒíŹìƒ”: Kubespray, Helm, Armadaë„Œ ...
[OpenInfra Days Korea 2018] Day 2 - E3-2: "핞슈옚 ì›ŒíŹìƒ”: Kubespray, Helm, Armadaë„Œ ...[OpenInfra Days Korea 2018] Day 2 - E3-2: "핞슈옚 ì›ŒíŹìƒ”: Kubespray, Helm, Armadaë„Œ ...
[OpenInfra Days Korea 2018] Day 2 - E3-2: "핞슈옚 ì›ŒíŹìƒ”: Kubespray, Helm, Armadaë„Œ ...
 
DCUS17 : Docker networking deep dive
DCUS17 : Docker networking deep diveDCUS17 : Docker networking deep dive
DCUS17 : Docker networking deep dive
 
[2018.10.19] êč€ìš©êž° 부임 - IAC on OpenStack (feat. ansible)
[2018.10.19] êč€ìš©êž° 부임 - IAC on OpenStack (feat. ansible)[2018.10.19] êč€ìš©êž° 부임 - IAC on OpenStack (feat. ansible)
[2018.10.19] êč€ìš©êž° 부임 - IAC on OpenStack (feat. ansible)
 
Integrate Openshift with Cloudforms
Integrate Openshift with CloudformsIntegrate Openshift with Cloudforms
Integrate Openshift with Cloudforms
 
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
 
Ensuring Kubernetes Cost Efficiency across (many) Clusters - DevOps Gathering...
Ensuring Kubernetes Cost Efficiency across (many) Clusters - DevOps Gathering...Ensuring Kubernetes Cost Efficiency across (many) Clusters - DevOps Gathering...
Ensuring Kubernetes Cost Efficiency across (many) Clusters - DevOps Gathering...
 
Developer Experience at Zalando - CNCF End User SIG-DX
Developer Experience at Zalando - CNCF End User SIG-DXDeveloper Experience at Zalando - CNCF End User SIG-DX
Developer Experience at Zalando - CNCF End User SIG-DX
 
Dockerizing OpenStack for High Availability
Dockerizing OpenStack for High AvailabilityDockerizing OpenStack for High Availability
Dockerizing OpenStack for High Availability
 
DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
DevOps Fest 2020. ХДргіĐč ĐšĐ°Đ»Ń–ĐœĐ”Ń†ŃŒ. Building Data Streaming Platform with Apac...
 

Similar to Java and Containers: What's there to think about? | DevNation Tech Talk

Similar to Java and Containers: What's there to think about? | DevNation Tech Talk (20)

Adopting GraalVM - NE Scala 2019
Adopting GraalVM - NE Scala 2019Adopting GraalVM - NE Scala 2019
Adopting GraalVM - NE Scala 2019
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Adopting GraalVM - Scala eXchange London 2018
Adopting GraalVM - Scala eXchange London 2018Adopting GraalVM - Scala eXchange London 2018
Adopting GraalVM - Scala eXchange London 2018
 
[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdf[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdf
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !
 
Docker tips-for-java-developers
Docker tips-for-java-developersDocker tips-for-java-developers
Docker tips-for-java-developers
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupal
 
Stop Being Lazy and Test Your Software
Stop Being Lazy and Test Your SoftwareStop Being Lazy and Test Your Software
Stop Being Lazy and Test Your Software
 
MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Oracle cluster installation with grid and iscsi
Oracle cluster  installation with grid and iscsiOracle cluster  installation with grid and iscsi
Oracle cluster installation with grid and iscsi
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
DockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing AureaDockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing Aurea
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
 
Adrian Mouat - Docker Tips and Tricks
 Adrian Mouat - Docker Tips and Tricks Adrian Mouat - Docker Tips and Tricks
Adrian Mouat - Docker Tips and Tricks
 

More from Red Hat Developers

More from Red Hat Developers (20)

DevNation Tech Talk: Getting GitOps
DevNation Tech Talk: Getting GitOpsDevNation Tech Talk: Getting GitOps
DevNation Tech Talk: Getting GitOps
 
Exploring the power of OpenTelemetry on Kubernetes
Exploring the power of OpenTelemetry on KubernetesExploring the power of OpenTelemetry on Kubernetes
Exploring the power of OpenTelemetry on Kubernetes
 
GitHub Makeover | DevNation Tech Talk
GitHub Makeover | DevNation Tech TalkGitHub Makeover | DevNation Tech Talk
GitHub Makeover | DevNation Tech Talk
 
Quinoa: A modern Quarkus UI with no hassles | DevNation tech Talk
Quinoa: A modern Quarkus UI with no hassles | DevNation tech TalkQuinoa: A modern Quarkus UI with no hassles | DevNation tech Talk
Quinoa: A modern Quarkus UI with no hassles | DevNation tech Talk
 
Extra micrometer practices with Quarkus | DevNation Tech Talk
Extra micrometer practices with Quarkus | DevNation Tech TalkExtra micrometer practices with Quarkus | DevNation Tech Talk
Extra micrometer practices with Quarkus | DevNation Tech Talk
 
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
 
Integrating Loom in Quarkus | DevNation Tech Talk
Integrating Loom in Quarkus | DevNation Tech TalkIntegrating Loom in Quarkus | DevNation Tech Talk
Integrating Loom in Quarkus | DevNation Tech Talk
 
Quarkus Renarde đŸŠŠâ™„: an old-school Web framework with today's touch | DevNatio...
Quarkus Renarde đŸŠŠâ™„: an old-school Web framework with today's touch | DevNatio...Quarkus Renarde đŸŠŠâ™„: an old-school Web framework with today's touch | DevNatio...
Quarkus Renarde đŸŠŠâ™„: an old-school Web framework with today's touch | DevNatio...
 
Containers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech TalkContainers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech Talk
 
Distributed deployment of microservices across multiple OpenShift clusters | ...
Distributed deployment of microservices across multiple OpenShift clusters | ...Distributed deployment of microservices across multiple OpenShift clusters | ...
Distributed deployment of microservices across multiple OpenShift clusters | ...
 
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
DevNation Workshop: Object detection with Red Hat OpenShift Data Science [Mar...
 
Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...
Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...
Dear security, compliance, and auditing: We’re sorry. Love, DevOps | DevNatio...
 
11 CLI tools every developer should know | DevNation Tech Talk
11 CLI tools every developer should know | DevNation Tech Talk11 CLI tools every developer should know | DevNation Tech Talk
11 CLI tools every developer should know | DevNation Tech Talk
 
A Microservices approach with Cassandra and Quarkus | DevNation Tech Talk
A Microservices approach with Cassandra and Quarkus | DevNation Tech TalkA Microservices approach with Cassandra and Quarkus | DevNation Tech Talk
A Microservices approach with Cassandra and Quarkus | DevNation Tech Talk
 
GitHub Actions and OpenShift: ​​Supercharging your software development loops...
GitHub Actions and OpenShift: ​​Supercharging your software development loops...GitHub Actions and OpenShift: ​​Supercharging your software development loops...
GitHub Actions and OpenShift: ​​Supercharging your software development loops...
 
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
To the moon and beyond with Java 17 APIs! | DevNation Tech TalkTo the moon and beyond with Java 17 APIs! | DevNation Tech Talk
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
 
Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...
Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...
Profile your Java apps in production on Red Hat OpenShift with Cryostat | Dev...
 
Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...
Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...
Kafka at the Edge: an IoT scenario with OpenShift Streams for Apache Kafka | ...
 
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
 
Level-up your gaming telemetry using Kafka Streams | DevNation Tech Talk
Level-up your gaming telemetry using Kafka Streams | DevNation Tech TalkLevel-up your gaming telemetry using Kafka Streams | DevNation Tech Talk
Level-up your gaming telemetry using Kafka Streams | DevNation Tech Talk
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

Java and Containers: What's there to think about? | DevNation Tech Talk

  • 1. 1 Java and Containers: Christine H. Flood Senior Principal Software Engineer What’s there to Think About?
  • 2. 2 Adventures with Containers for JVM Hackers Christine H. Flood Senior Principal Software Engineer
  • 3. 3 Evolution of Java (1990s) Safe Duke
  • 4. 4 Evolution of Java (2000s) Fast Duke
  • 5. 5 Evolution of Java (2010s) Smooth Duke
  • 6. 6 Evolution of Java (2020s) Packed Duke
  • 7. 7 What are we optimizing for now? Smaller Footprint Faster Startup Smaller Image Size
  • 8. 8 Command Line Parameters Smaller Footprint Old School -XX:+UseSerialGC SerialGC has lower overhead than any of the other collectors -XX:MinHeapFreeRatio Default is 40 <=> Grow the heap if occupancy is > 60% Recommend 20 -XX:MaxHeapFreeRatio Default is 70 <=> Shrink the heap if occupancy is < 30% Recommend 40 -XX:GCTimeRatio Default is 99 <=> Target 1% of time in GC Recommend 4 <=> 25% -XX:AdaptiveSizePolicyWeight Default is 10 <=> Scale of 0 to 100 Recommend 90
  • 9. 9 Command Line Parameters Smaller Footprint Old School -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=”summary” -XX:+PrintNMTStatistics These options will print out the non-heap memory usage of your JVM. -Xss228k This will decrease the size of your Java Stacks. The default is 1024. java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version
  • 10. 10 Containerized TestRandom FROM openjdk:16 WORKDIR / Add TestRandom.class TestRandom.class CMD ["java" , "-XshowSettings:system", "TestRandom", "100000", "10000000000"] podman build -f OpenJDKDockerFile -t openjdk podman run openjdk
  • 11. 11 -XshowSettings:system Operating System Metrics: Provider: cgroupv2 Effective CPU Count: 8 CPU Period: -1 CPU Quota: -1 CPU Shares: -1 List of Processors: N/A List of Effective Processors: N/A List of Memory Nodes: N/A List of Available Memory Nodes: N/A Memory Limit: Unlimited Memory Soft Limit: 0.00K Memory & Swap Limit: Unlimited
  • 13. 13 What Can We Do? Command Line Parameters Checkpoint/Restore SubstrateVM
  • 14. 14 Checkpoint/Restore Copies entire container to disk and can quickly restore it. Avoids class initialization. Can checkpoint after JIT is warmed up, classes are loaded, heap is fully gc’d.
  • 15. 15 Checkpoint/Restore sudo podman build -f OpenJDKDockerFile -t openjdk sudo podman run openjdk sudo podman container checkpoint -l Stops the container sudo podman container restore -l Restarts the container
  • 16. 16 Checkpoint/Restore Doesn’t currently work with Fedora 31 due to Cgroups V2. sudo dnf install grubby sudo grubby --update-kernel=ALL –args="systemd.unified_cgroup_hierarchy=0" Reboot To run with Cgroups V1
  • 17. 17 SubstrateVM FROM quay.io/quarkus/ubi-quarkus-mandrel:20.2-java11 WORKDIR /tmp ADD TestRandom.class TestRandom.class RUN native-image -H:+ReportExceptionStackTraces -H:Name=TestRandom.out -H:Class=TestRandom.class TestRandom RUN chmod +x /tmp/TestRandom.out ENTRYPOINT ["/tmp/TestRandom.out", "10000", "1000000000"] And then Podman build -f MyDockerFile -t mydockerimage Podman run mydockerimage Or podman run -v ./:/project:z --env LANG=C --user 1000:1000 --userns=keep-id --rm quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11 -H: +ReportExceptionStackTraces -H:Name=./TestRandom3.out -H:Class=./TestRandom.class TestRandom
  • 18. 18 SubstrateVM vs OpenJDK /usr/bin/time podman run nativeimage Testing random number generator with upper bound = 10000 and sample size 1000000000 Max bin size = 101185 Min bin size = 10000 median bin size = 100000.0 0.11user 0.04system 0:28.63elapsed 0%CPU (0avgtext+0avgdata 58488maxresident)k 0inputs+656outputs (0major+9497minor)pagefaults 0swaps [/usr/bin/time podman run openjdkbig Testing random number generator with upper bound = 10000 and sample size 1000000000 Max bin size = 101305 Min bin size = 10000 median bin size = 100000.0 0.15user 0.05system 0:25.69elapsed 0%CPU (0avgtext+0avgdata 58388maxresident)k 0inputs+656outputs (0major+9500minor)pagefaults 0swaps
  • 19. 19 Podman ps [chf@dhcp111 containers]$ podman ps -as CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE b83a9c004dd0 localhost/nativeimage:latest ./TestRandom.out ... 47 seconds ago Up 47 seconds ago relaxed_torvalds 0B (virtual 1.74GB) ccbdb549ecf3 localhost/openjdkbig:latest java TestRandom 1... 51 seconds ago Exited (0) 23 seconds ago priceless_herschel 0B (virtual 502MB)
  • 20. 20 Questions I didn’t address What does it mean if you give podman constraints that the JVM doesn’t understand Partial Share of a Processor Run ParallelGC on a Single processor
  • 22. CONFIDENTIAL Designator linkedin.com/company/red-hat youtube.com/user/ RedHatVideos facebook.com/redhatinc twitter.com/RedHat 22 Thank you Red Hat is the world’s leading provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500.