SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
Elastic JVM
Automatic Vertical Scaling
of the Java Heap
Java Can Be Greedy!
Java Memory Consumption Problems
Java Memory Consumption Problems
Difficult to Scale
Costs Too Much
Consumes a Lot
Technical Reasons to
Make Java Flexible
Horizontal Scaling Is Not Always a Solution
Better Elasticity & Density with Containers
Reducing Memory Usage to Speed Up Live Migration
https://www.youtube.com/watch?v=HfN4L6RFL10
Overpayment for
Java Cloud Hosting
Pay per Usage as for Electricity
Reserved vs Consumed
Real statistics of defined limits and actually consumed resources
Wasted Resources Used Resources
Are JVM-Based
Applications Fully
Container-Ready?
Blockers for JVM Automatic Vertical Scaling
Unreleased Heap Memory Restart for Xmx Resize
Garbage Collectors
Testing
G1 Garbage Collector: Fast Memory Usage Growth
java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 0
Memory grew from 32 MB to 1 GB in 25 seconds
https://github.com/jelastic/java-vertical-scaling-test
G1: Medium Memory Usage Growth
java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 10
Memory grew from 32 MB to 1 GB in 90 seconds during 4 cycles
G1: Slow Memory Usage Growth
java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 100
Memory grew from 32 MB to 1 GB with delta time growth of about 300 seconds
G1: Aggressive Heap = No Vertical Scaling
java -XX:+UseG1GC -Xmx2g -Xms2g
or
java -XX:+UseG1GC -Xmx2g -XX:+AggressiveHeap
Parallel Garbage Collector
java -XX:+UseParallelGC -Xmx2g -Xms32m -jar app.jar 10
The unused but committed RAM is never released back to OS
Serial Garbage Collector
java -XX:+UseSerialGC -Xmx2g -Xms32m -jar app.jar 10
It requires 4 Full GC cycles to release all unused resources
ConcMarkSweep Garbage Collector
java -XX:+UseConcMarkSweepGC -Xmx2g -Xms32m -jar app.jar 10
It requires 4 Full GC cycles to release all unused resources
Calling Full GC On-Time
https://github.com/jelastic-jps/java-memory-agent
1. Full GC is not triggered automatically and must be executed explicitly
2. Can lead to significant performance degradation
Workaround:
inject an agent which monitors the memory usage and calls System.gc()
periodically:
-javaagent:jelastic-gc-agent.jar=period=300,debug=true
Shenandoah Garbage Collector
java -Xmx2g -Xms32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC
-XX:ShenandoahUncommitDelay=1000 -XX:ShenandoahGuaranteedGCInterval=10000 -jar app.jar 10
It releases unused RAM back to OS on the fly without Full GC calls
https://wiki.openjdk.java.net/display/shenandoah/Main
The Z Garbage Collector
java -XX:+UnlockExperimentalVMOptions -XX:+UseZGC
http://cr.openjdk.java.net/~pliden/slides/ZGC-FOSDEM-2018.pdf
OpenJ9
Command-line options to enable automatic vertical scaling:
● -XX:+IdleTuningGcOnIdle
● -XX:+IdleTuningCompactOnIdle
● -XX:IdleTuningMinIdleWaitTime=<secs>
● Low memory footprint
● Fast startup time
● High application throughput
● Smoother ramp-up in the cloud
https://www.eclipse.org/openj9/
New Patch for
Garbage-First
Collector in
OpenJDK 9
Started in 2011
● Initiated investigation (at first, worked out only with SerialGC)
● Built cloud business model on vertical scaling
● Started to promote in the community
Credits To
● Ruslan Synytsky, Tetiana Fydorenchyk: Jelastic
● Rodrigo Bruno, Paulo Ferreira: INESC-ID / Instituto Superior Técnico,
University of Lisbon
● Jia Rao: The University of Texas at Arlington
● Hang Huang, Song Wu: Huazhong University of Science and Technology
● Thomas Schatzl: Oracle
Timely Reduce Unused Committed Memory
Make the G1 garbage collector automatically give back Java heap memory
to the operating system when idle
● G1PeriodicGCInterval
● G1PeriodicGCSystemLoadThreshold
● G1PeriodicGCInvokesConcurrent
http://openjdk.java.net/jeps/8204089
Dynamic Max Memory Limit
Allow a user to increase / decrease the amount of Java heap memory
available to the application at runtime http://openjdk.java.net/jeps/8204088
jinfo -flag CurrentMaxHeapSize=1g <java_pid>
Extra Tips Not to
Lose Your Memory
Improving Memory Compaction
-XX:-ShrinkHeapInSteps
● disable 4 full GC cycles
● release unused RAM resources faster
● minimize the Java heap size usage in applications with variable load
Tracking Native Non-Heap Memory Usage
-XX:NativeMemoryTracking=summary
5-10% performance hit if this option is enabled
http://trustmeiamadeveloper.com/2016/03/18/where-is-my-memory-java/
Java SE Support for Docker CPU and RAM Limits
CPU (Java SE 8u131+)
-XX:ParalllelGCThreads or
-XX:CICompilerCount
if not specified → Docker CPU limit
RAM
Java heap via -Xmx
if not specified →
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
https://jelastic.com/blog/java-and-memory-li
mits-in-containers-lxc-docker-and-openvz
https://blogs.oracle.com/java-platform-group
/java-se-support-for-docker-cpu-and-memor
y-limits
Make Your Java Elastic
Learn More
Get In Touch

Contenu connexe

Plus de Jelastic Multi-Cloud PaaS

Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageJelastic Multi-Cloud PaaS
 
SaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationSaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationJelastic Multi-Cloud PaaS
 
State of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityState of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityJelastic Multi-Cloud PaaS
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersJelastic Multi-Cloud PaaS
 
Multi-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceMulti-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceJelastic Multi-Cloud PaaS
 
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationFrom VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationJelastic Multi-Cloud PaaS
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsJelastic Multi-Cloud PaaS
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsJelastic Multi-Cloud PaaS
 
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowCloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowJelastic Multi-Cloud PaaS
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Jelastic Multi-Cloud PaaS
 
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic Multi-Cloud PaaS
 
Auto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyAuto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyJelastic Multi-Cloud PaaS
 
Jelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic Multi-Cloud PaaS
 
Онлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриОнлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриJelastic Multi-Cloud PaaS
 
Jelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic - DevOps PaaS Business with Docker Support for Service ProvidersJelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic - DevOps PaaS Business with Docker Support for Service ProvidersJelastic Multi-Cloud PaaS
 
Jelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the SceneJelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the SceneJelastic Multi-Cloud PaaS
 
Jelastic Reselling Option for Hosting Providers and MSPs
Jelastic Reselling Option for Hosting Providers and MSPsJelastic Reselling Option for Hosting Providers and MSPs
Jelastic Reselling Option for Hosting Providers and MSPsJelastic Multi-Cloud PaaS
 
Docker and DevOps Trends in Hosting Industry
Docker and DevOps Trends in Hosting IndustryDocker and DevOps Trends in Hosting Industry
Docker and DevOps Trends in Hosting IndustryJelastic Multi-Cloud PaaS
 

Plus de Jelastic Multi-Cloud PaaS (20)

Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
 
SaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy TransformationSaaSification in Action. Attracting Software Vendors with Easy Transformation
SaaSification in Action. Attracting Software Vendors with Easy Transformation
 
State of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS FunctionalityState of the Art UI - Overview of Jelastic PaaS Functionality
State of the Art UI - Overview of Jelastic PaaS Functionality
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting CustomersHow to Make Money Solving 5 Major Problems of Cloud Hosting Customers
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
 
Multi-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a ServiceMulti-Cloud Lightweight Platform as a Service
Multi-Cloud Lightweight Platform as a Service
 
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE ApplicationFrom VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to GrowCloud Hosting Business in Africa: Market Specifics and Ways to Grow
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
 
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service ProvidersJelastic DevOps Platform Product Overview for Service Providers
Jelastic DevOps Platform Product Overview for Service Providers
 
Auto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers TopologyAuto Scaling for Multi-Tier Containers Topology
Auto Scaling for Multi-Tier Containers Topology
 
Jelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVsJelastic DevOps Platform Product Overview for ISVs
Jelastic DevOps Platform Product Overview for ISVs
 
DevOps Epoch 2016
DevOps Epoch 2016DevOps Epoch 2016
DevOps Epoch 2016
 
Онлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутриОнлайн миграция контейнеров. Взгляд изнутри
Онлайн миграция контейнеров. Взгляд изнутри
 
Jelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic - DevOps PaaS Business with Docker Support for Service ProvidersJelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic - DevOps PaaS Business with Docker Support for Service Providers
 
Jelastic Turnkey Cloud PaaS for Developers
Jelastic Turnkey Cloud PaaS for DevelopersJelastic Turnkey Cloud PaaS for Developers
Jelastic Turnkey Cloud PaaS for Developers
 
Jelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the SceneJelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the Scene
 
Jelastic Reselling Option for Hosting Providers and MSPs
Jelastic Reselling Option for Hosting Providers and MSPsJelastic Reselling Option for Hosting Providers and MSPs
Jelastic Reselling Option for Hosting Providers and MSPs
 
Docker and DevOps Trends in Hosting Industry
Docker and DevOps Trends in Hosting IndustryDocker and DevOps Trends in Hosting Industry
Docker and DevOps Trends in Hosting Industry
 

Dernier

Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?SANGHEE SHIN
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfAnna Loughnan Colquhoun
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 

Dernier (20)

Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 

Elastic JVM: Automatic Vertical Scaling of the Java Heap

  • 1. Elastic JVM Automatic Vertical Scaling of the Java Heap
  • 2. Java Can Be Greedy!
  • 4. Java Memory Consumption Problems Difficult to Scale Costs Too Much Consumes a Lot
  • 6. Horizontal Scaling Is Not Always a Solution
  • 7. Better Elasticity & Density with Containers
  • 8. Reducing Memory Usage to Speed Up Live Migration https://www.youtube.com/watch?v=HfN4L6RFL10
  • 10. Pay per Usage as for Electricity
  • 11. Reserved vs Consumed Real statistics of defined limits and actually consumed resources Wasted Resources Used Resources
  • 13. Blockers for JVM Automatic Vertical Scaling Unreleased Heap Memory Restart for Xmx Resize
  • 15. G1 Garbage Collector: Fast Memory Usage Growth java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 0 Memory grew from 32 MB to 1 GB in 25 seconds https://github.com/jelastic/java-vertical-scaling-test
  • 16. G1: Medium Memory Usage Growth java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 10 Memory grew from 32 MB to 1 GB in 90 seconds during 4 cycles
  • 17. G1: Slow Memory Usage Growth java -XX:+UseG1GC -Xmx2g -Xms32m -jar app.jar 100 Memory grew from 32 MB to 1 GB with delta time growth of about 300 seconds
  • 18. G1: Aggressive Heap = No Vertical Scaling java -XX:+UseG1GC -Xmx2g -Xms2g or java -XX:+UseG1GC -Xmx2g -XX:+AggressiveHeap
  • 19. Parallel Garbage Collector java -XX:+UseParallelGC -Xmx2g -Xms32m -jar app.jar 10 The unused but committed RAM is never released back to OS
  • 20. Serial Garbage Collector java -XX:+UseSerialGC -Xmx2g -Xms32m -jar app.jar 10 It requires 4 Full GC cycles to release all unused resources
  • 21. ConcMarkSweep Garbage Collector java -XX:+UseConcMarkSweepGC -Xmx2g -Xms32m -jar app.jar 10 It requires 4 Full GC cycles to release all unused resources
  • 22. Calling Full GC On-Time https://github.com/jelastic-jps/java-memory-agent 1. Full GC is not triggered automatically and must be executed explicitly 2. Can lead to significant performance degradation Workaround: inject an agent which monitors the memory usage and calls System.gc() periodically: -javaagent:jelastic-gc-agent.jar=period=300,debug=true
  • 23. Shenandoah Garbage Collector java -Xmx2g -Xms32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahUncommitDelay=1000 -XX:ShenandoahGuaranteedGCInterval=10000 -jar app.jar 10 It releases unused RAM back to OS on the fly without Full GC calls https://wiki.openjdk.java.net/display/shenandoah/Main
  • 24. The Z Garbage Collector java -XX:+UnlockExperimentalVMOptions -XX:+UseZGC http://cr.openjdk.java.net/~pliden/slides/ZGC-FOSDEM-2018.pdf
  • 25. OpenJ9 Command-line options to enable automatic vertical scaling: ● -XX:+IdleTuningGcOnIdle ● -XX:+IdleTuningCompactOnIdle ● -XX:IdleTuningMinIdleWaitTime=<secs> ● Low memory footprint ● Fast startup time ● High application throughput ● Smoother ramp-up in the cloud https://www.eclipse.org/openj9/
  • 27. Started in 2011 ● Initiated investigation (at first, worked out only with SerialGC) ● Built cloud business model on vertical scaling ● Started to promote in the community
  • 28. Credits To ● Ruslan Synytsky, Tetiana Fydorenchyk: Jelastic ● Rodrigo Bruno, Paulo Ferreira: INESC-ID / Instituto Superior Técnico, University of Lisbon ● Jia Rao: The University of Texas at Arlington ● Hang Huang, Song Wu: Huazhong University of Science and Technology ● Thomas Schatzl: Oracle
  • 29. Timely Reduce Unused Committed Memory Make the G1 garbage collector automatically give back Java heap memory to the operating system when idle ● G1PeriodicGCInterval ● G1PeriodicGCSystemLoadThreshold ● G1PeriodicGCInvokesConcurrent http://openjdk.java.net/jeps/8204089
  • 30. Dynamic Max Memory Limit Allow a user to increase / decrease the amount of Java heap memory available to the application at runtime http://openjdk.java.net/jeps/8204088 jinfo -flag CurrentMaxHeapSize=1g <java_pid>
  • 31. Extra Tips Not to Lose Your Memory
  • 32. Improving Memory Compaction -XX:-ShrinkHeapInSteps ● disable 4 full GC cycles ● release unused RAM resources faster ● minimize the Java heap size usage in applications with variable load
  • 33. Tracking Native Non-Heap Memory Usage -XX:NativeMemoryTracking=summary 5-10% performance hit if this option is enabled http://trustmeiamadeveloper.com/2016/03/18/where-is-my-memory-java/
  • 34. Java SE Support for Docker CPU and RAM Limits CPU (Java SE 8u131+) -XX:ParalllelGCThreads or -XX:CICompilerCount if not specified → Docker CPU limit RAM Java heap via -Xmx if not specified → -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap https://jelastic.com/blog/java-and-memory-li mits-in-containers-lxc-docker-and-openvz https://blogs.oracle.com/java-platform-group /java-se-support-for-docker-cpu-and-memor y-limits
  • 35. Make Your Java Elastic Learn More Get In Touch