SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
Java and Containers – Make it Awesome !
2
About Me
●
Co-Maintain the AdoptOpenJDK Community Docker Images
●
Eclipse OpenJ9 Cloud Optimization Architect
●
Interested in every aspect of running Java Apps in K8s including
Cloud Native as well as Legacy migration to Cloud
●
Ex Linux Kernel and glibc hacker
Dinakar Guniguntala (@dinogun)
IBM Runtime Technologies
3
Demo Repo
https://github.com/dinogun/watson-springboot
4
What is AdoptOpenJDK
●
AdoptOpenJDK provides prebuilt OpenJDK binaries from a
fully open source set of build scripts and infrastructure.
– https://adoptopenjdk.net
●
Extensive testing as part of the CI pipeline.
●
REST API for scriptable downloads.
Docker Images
Unofficial →
https://hub.docker.com/u/adoptopenjdk
Official →
https://hub.docker.com/_/adoptopenjdk
5
Step 1: Begin at the Beginning
Build !
6
Build Goals
●
Size Matters – Small is Better !
– Affects provisioning / deployment time
– Consider Images based on Alpine Linux (5 MB vs 80 MB for Ubuntu)
– Slim images (Cloud workloads use only a small subset)
– Use jlink to use only the required modules (Java 9 onwards)
●
Should be easy to maintain
– Consider using standard build tool docker images (Eg. maven / gradle)
– Use build tool plugins for Docker where possible
Java
Version
Latest Slim Alpine
Alpine-
Slim
8 (JDK) 338 MB 213 MB 227 MB 95 MB
11 (JDK) 423 MB 354 MB 324 MB 239 MB
7
Step 2: Expand and Flourish
Startup and Scale !
8
Startup Goals

Use of a Shared Class Cache helps reduce startup times by upto 40%

-Xshareclasses
java -Xshareclasses:cacheDir=/opt/shareclasses -jar /opt/app/japp.jar
docker run -it -v /path/on/host/shareclasses/dir:/opt/shareclasses japp

-Xquickstart mode

Good for very short running applications
9
Instant startup with CRIU !!
Startup time
checkpoint
restore
Time to
restore
Instance 1
Time to first
response
Time to first
response
Instance 2
Instance 3
Timeline
https://criu.org
https://openliberty.io/blog/2020/02/12/faster-startup-Java-applications-criu.html
10
Step 3: Keep it Steady
Container Aware !
11
Optimize at Runtime

Container Aware JVM
– -XX:+UseContainerSupport to turn on this feature. (Default now
with the latest JVM)
– Use -XX:MaxRAMPercentage and -XX:InitialRAMPercentage
instead of -Xmx and -Xms.
– Runtime.availableProcessors() based on cgroup limits.
Heap = 2.4G
Container Mem = 3G
Container Mem = 2G
Heap = 1.6G
Heap = 3.2G
Container Mem = 4G
-Xmx = 2G -Xmx = 2G
-Xmx = 2G
-XX:MaxRAMPercentage=80
https://blog.openj9.org/2018/06/12/eclipse-openj9-in-containers/
12
Kruize:
Right size and Optimize your Containers !
https://github.com/kruize/kruize
13
Step 4: Don’t Lose When You Snooze
Idle Aware !
14
Optimize at Idle Time

OpenJ9 reduces footprint on Idle
– -XX:+IdleTuningGcOnIdle and
– -XX:+IdleTuningCompactOnIdle
https://developer.ibm.com/javasdk/2017/09/25/still-paying-unused-memory-java-app-idle/
15
Step 5: Crashing in the Cloud ? NP !
Javacores and Dumps
16
Get Debugging Info on the Fly !

Do you have to restart your containerized Java app to dump debugging info ?
NO !
– Use OpenJ9DiagnosticMXBean instead
17
Javacore Info
1CICONTINFO Running in container : TRUE
1CICGRPINFO JVM support for cgroups enabled : TRUE
…
1CICGRPINFO Cgroup Information
NULL -------------------------------------------------
CICGRPINFO subsystem : cpu
2CICGRPINFO cgroup name : /
2CICGRPINFO CPU Period : 200000 microseconds
2CICGRPINFO CPU Quota : 100000 microseconds
2CICGRPINFO CPU Shares : 1024
2CICGRPINFO Period intervals elapsed count : 16
2CICGRPINFO Throttled count : 2
2CICGRPINFO Total throttle time : 164156409 nanoseconds
2CICGRPINFO subsystem : cpuset
2CICGRPINFO cgroup name : /
2CICGRPINFO CPU exclusive : 0
2CICGRPINFO Mem exclusive : 0
2CICGRPINFO CPUs : 0-3
2CICGRPINFO Mems : 0
2CICGRPINFO subsystem : memory
2CICGRPINFO cgroup name : /
2CICGRPINFO Memory Limit : 2147483648 bytes
2CICGRPINFO Memory + Swap Limit : 4294967296 bytes
2CICGRPINFO Memory Usage : 31182848 bytes
2CICGRPINFO Memory + Swap Usage : 31182848 bytes
2CICGRPINFO Memory Max Usage : 31277056 bytes
2CICGRPINFO Memory + Swap Max Usage : 31277056 bytes
2CICGRPINFO Memory limit exceeded count : 0
2CICGRPINFO Memory + Swap limit exceeded count : 0
2CICGRPINFO OOM Killer Disabled : 0
2CICGRPINFO Under OOM : 0
$ docker run -m2g --cpu-quota="100000" --cpu-
period="200000" -it openj9 java
-Xdump:java:events=vmstop App
18
Useful Links

Demo
– https://github.com/dinogun/watson-springboot

Eclipse OpenJ9 Sources
– https://github.com/eclipse/openj9

Kruize – Right size and optimize your containers
– https://github.com/kruize/kruize

AdoptOpenJDK Docker Images
– https://hub.docker.com/r/adoptopenjdk/openjdk8-openj9/

CRIU - https://criu.org
Build /
Package
Startup Running Idling Debugging
@dinogun
19
Qs
@dinogun

Contenu connexe

Tendances

Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native editionRichard Radics
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionJohn Archer
 
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshiftNAVER D2
 
markedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMmarkedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMtakezoe
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CIColCh
 
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)LINAGORA
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & DockerJoerg Henning
 
Docker from a team perspective
Docker from a team perspectiveDocker from a team perspective
Docker from a team perspectiveEdwin Vlieg
 
Docker at MoneyBird
Docker at MoneyBirdDocker at MoneyBird
Docker at MoneyBirdEdwin Vlieg
 
Workflows using Git GitHub | Edureka
Workflows using Git GitHub | EdurekaWorkflows using Git GitHub | Edureka
Workflows using Git GitHub | EdurekaEdureka!
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Annie Huang
 
slide-dnrdw
slide-dnrdwslide-dnrdw
slide-dnrdwYue Liu
 
Docker basic on azure
Docker basic on azureDocker basic on azure
Docker basic on azurePhilip Zheng
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseLINAGORA
 
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e DroneTDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e Dronetdc-globalcode
 
The Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPHThe Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPHLaszlo Fogas
 
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...Srijan Technologies
 

Tendances (20)

Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
 
Red Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus IntroductionRed Hat Java Update and Quarkus Introduction
Red Hat Java Update and Quarkus Introduction
 
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
 
markedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMmarkedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVM
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
 
Docker & GitLab
Docker & GitLabDocker & GitLab
Docker & GitLab
 
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
Docker from a team perspective
Docker from a team perspectiveDocker from a team perspective
Docker from a team perspective
 
Docker at MoneyBird
Docker at MoneyBirdDocker at MoneyBird
Docker at MoneyBird
 
From Java Monolith to k8s with CI/CD
From Java Monolith to k8s with CI/CD From Java Monolith to k8s with CI/CD
From Java Monolith to k8s with CI/CD
 
Workflows using Git GitHub | Edureka
Workflows using Git GitHub | EdurekaWorkflows using Git GitHub | Edureka
Workflows using Git GitHub | Edureka
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
 
slide-dnrdw
slide-dnrdwslide-dnrdw
slide-dnrdw
 
Docker basic on azure
Docker basic on azureDocker basic on azure
Docker basic on azure
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entreprise
 
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e DroneTDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
 
The Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPHThe Self-Service Developer - GOTOCon CPH
The Self-Service Developer - GOTOCon CPH
 
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
 
Why and what is go
Why and what is goWhy and what is go
Why and what is go
 

Similaire à Java and Container - Make it Awesome !

Perspectives on Docker
Perspectives on DockerPerspectives on Docker
Perspectives on DockerRightScale
 
Cloud Native Java Development Patterns
Cloud Native Java Development PatternsCloud Native Java Development Patterns
Cloud Native Java Development PatternsBilgin Ibryam
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned RightScale
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Dinakar Guniguntala
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDocker, Inc.
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For DevelopmentLaura Frank Tacho
 
Android Platform Debugging and Development at ELCE 2013
Android Platform Debugging and Development at ELCE 2013Android Platform Debugging and Development at ELCE 2013
Android Platform Debugging and Development at ELCE 2013Opersys inc.
 
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVMThe JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVMAndy Moncsek
 
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes][HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]Wong Hoi Sing Edison
 
Automated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build ServiceAutomated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build ServiceDani Llewellyn
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetesAndy Moncsek
 
G3 Summit 2016 - Dockerize your Grails!
G3 Summit 2016 - Dockerize your Grails!G3 Summit 2016 - Dockerize your Grails!
G3 Summit 2016 - Dockerize your Grails!Iván López Martín
 
15-ways-to-optimize-spring-boot-for-the-cloud
15-ways-to-optimize-spring-boot-for-the-cloud15-ways-to-optimize-spring-boot-for-the-cloud
15-ways-to-optimize-spring-boot-for-the-cloudBilly Korando
 
GR8Conf US 2017 - Dockerize your Grails!
GR8Conf US 2017 - Dockerize your Grails!GR8Conf US 2017 - Dockerize your Grails!
GR8Conf US 2017 - Dockerize your Grails!Iván López Martín
 
Docker Basics & Alfresco Content Services
Docker Basics & Alfresco Content ServicesDocker Basics & Alfresco Content Services
Docker Basics & Alfresco Content ServicesSujay Pillai
 
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...Cloud Native Day Tel Aviv
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containersRed Hat Developers
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9DanHeidinga
 
15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloudPolyglotMeetups
 

Similaire à Java and Container - Make it Awesome ! (20)

Perspectives on Docker
Perspectives on DockerPerspectives on Docker
Perspectives on Docker
 
Cloud Native Java Development Patterns
Cloud Native Java Development PatternsCloud Native Java Development Patterns
Cloud Native Java Development Patterns
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
 
Android Platform Debugging and Development at ELCE 2013
Android Platform Debugging and Development at ELCE 2013Android Platform Debugging and Development at ELCE 2013
Android Platform Debugging and Development at ELCE 2013
 
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVMThe JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
 
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes][HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
 
Automated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build ServiceAutomated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build Service
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetes
 
G3 Summit 2016 - Dockerize your Grails!
G3 Summit 2016 - Dockerize your Grails!G3 Summit 2016 - Dockerize your Grails!
G3 Summit 2016 - Dockerize your Grails!
 
Java 9-coding-from-zero-level-v1.0
Java 9-coding-from-zero-level-v1.0Java 9-coding-from-zero-level-v1.0
Java 9-coding-from-zero-level-v1.0
 
15-ways-to-optimize-spring-boot-for-the-cloud
15-ways-to-optimize-spring-boot-for-the-cloud15-ways-to-optimize-spring-boot-for-the-cloud
15-ways-to-optimize-spring-boot-for-the-cloud
 
GR8Conf US 2017 - Dockerize your Grails!
GR8Conf US 2017 - Dockerize your Grails!GR8Conf US 2017 - Dockerize your Grails!
GR8Conf US 2017 - Dockerize your Grails!
 
Docker Basics & Alfresco Content Services
Docker Basics & Alfresco Content ServicesDocker Basics & Alfresco Content Services
Docker Basics & Alfresco Content Services
 
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...
Kubernetes is hard! Lessons learned taking our apps to Kubernetes - Eldad Ass...
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
 
15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud
 

Dernier

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Java and Container - Make it Awesome !

  • 1. Java and Containers – Make it Awesome !
  • 2. 2 About Me ● Co-Maintain the AdoptOpenJDK Community Docker Images ● Eclipse OpenJ9 Cloud Optimization Architect ● Interested in every aspect of running Java Apps in K8s including Cloud Native as well as Legacy migration to Cloud ● Ex Linux Kernel and glibc hacker Dinakar Guniguntala (@dinogun) IBM Runtime Technologies
  • 4. 4 What is AdoptOpenJDK ● AdoptOpenJDK provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. – https://adoptopenjdk.net ● Extensive testing as part of the CI pipeline. ● REST API for scriptable downloads. Docker Images Unofficial → https://hub.docker.com/u/adoptopenjdk Official → https://hub.docker.com/_/adoptopenjdk
  • 5. 5 Step 1: Begin at the Beginning Build !
  • 6. 6 Build Goals ● Size Matters – Small is Better ! – Affects provisioning / deployment time – Consider Images based on Alpine Linux (5 MB vs 80 MB for Ubuntu) – Slim images (Cloud workloads use only a small subset) – Use jlink to use only the required modules (Java 9 onwards) ● Should be easy to maintain – Consider using standard build tool docker images (Eg. maven / gradle) – Use build tool plugins for Docker where possible Java Version Latest Slim Alpine Alpine- Slim 8 (JDK) 338 MB 213 MB 227 MB 95 MB 11 (JDK) 423 MB 354 MB 324 MB 239 MB
  • 7. 7 Step 2: Expand and Flourish Startup and Scale !
  • 8. 8 Startup Goals  Use of a Shared Class Cache helps reduce startup times by upto 40%  -Xshareclasses java -Xshareclasses:cacheDir=/opt/shareclasses -jar /opt/app/japp.jar docker run -it -v /path/on/host/shareclasses/dir:/opt/shareclasses japp  -Xquickstart mode  Good for very short running applications
  • 9. 9 Instant startup with CRIU !! Startup time checkpoint restore Time to restore Instance 1 Time to first response Time to first response Instance 2 Instance 3 Timeline https://criu.org https://openliberty.io/blog/2020/02/12/faster-startup-Java-applications-criu.html
  • 10. 10 Step 3: Keep it Steady Container Aware !
  • 11. 11 Optimize at Runtime  Container Aware JVM – -XX:+UseContainerSupport to turn on this feature. (Default now with the latest JVM) – Use -XX:MaxRAMPercentage and -XX:InitialRAMPercentage instead of -Xmx and -Xms. – Runtime.availableProcessors() based on cgroup limits. Heap = 2.4G Container Mem = 3G Container Mem = 2G Heap = 1.6G Heap = 3.2G Container Mem = 4G -Xmx = 2G -Xmx = 2G -Xmx = 2G -XX:MaxRAMPercentage=80 https://blog.openj9.org/2018/06/12/eclipse-openj9-in-containers/
  • 12. 12 Kruize: Right size and Optimize your Containers ! https://github.com/kruize/kruize
  • 13. 13 Step 4: Don’t Lose When You Snooze Idle Aware !
  • 14. 14 Optimize at Idle Time  OpenJ9 reduces footprint on Idle – -XX:+IdleTuningGcOnIdle and – -XX:+IdleTuningCompactOnIdle https://developer.ibm.com/javasdk/2017/09/25/still-paying-unused-memory-java-app-idle/
  • 15. 15 Step 5: Crashing in the Cloud ? NP ! Javacores and Dumps
  • 16. 16 Get Debugging Info on the Fly !  Do you have to restart your containerized Java app to dump debugging info ? NO ! – Use OpenJ9DiagnosticMXBean instead
  • 17. 17 Javacore Info 1CICONTINFO Running in container : TRUE 1CICGRPINFO JVM support for cgroups enabled : TRUE … 1CICGRPINFO Cgroup Information NULL ------------------------------------------------- CICGRPINFO subsystem : cpu 2CICGRPINFO cgroup name : / 2CICGRPINFO CPU Period : 200000 microseconds 2CICGRPINFO CPU Quota : 100000 microseconds 2CICGRPINFO CPU Shares : 1024 2CICGRPINFO Period intervals elapsed count : 16 2CICGRPINFO Throttled count : 2 2CICGRPINFO Total throttle time : 164156409 nanoseconds 2CICGRPINFO subsystem : cpuset 2CICGRPINFO cgroup name : / 2CICGRPINFO CPU exclusive : 0 2CICGRPINFO Mem exclusive : 0 2CICGRPINFO CPUs : 0-3 2CICGRPINFO Mems : 0 2CICGRPINFO subsystem : memory 2CICGRPINFO cgroup name : / 2CICGRPINFO Memory Limit : 2147483648 bytes 2CICGRPINFO Memory + Swap Limit : 4294967296 bytes 2CICGRPINFO Memory Usage : 31182848 bytes 2CICGRPINFO Memory + Swap Usage : 31182848 bytes 2CICGRPINFO Memory Max Usage : 31277056 bytes 2CICGRPINFO Memory + Swap Max Usage : 31277056 bytes 2CICGRPINFO Memory limit exceeded count : 0 2CICGRPINFO Memory + Swap limit exceeded count : 0 2CICGRPINFO OOM Killer Disabled : 0 2CICGRPINFO Under OOM : 0 $ docker run -m2g --cpu-quota="100000" --cpu- period="200000" -it openj9 java -Xdump:java:events=vmstop App
  • 18. 18 Useful Links  Demo – https://github.com/dinogun/watson-springboot  Eclipse OpenJ9 Sources – https://github.com/eclipse/openj9  Kruize – Right size and optimize your containers – https://github.com/kruize/kruize  AdoptOpenJDK Docker Images – https://hub.docker.com/r/adoptopenjdk/openjdk8-openj9/  CRIU - https://criu.org Build / Package Startup Running Idling Debugging @dinogun