SlideShare a Scribd company logo
1 of 43
HotSpot JVM Tuning By: Gilad Garon Technical Meeting!
-Xmx2g It’s more than just: What is JVM Tuning? It’s a combination of: ,[object Object]
Software architectureBut most of all, JVM Tuning is about: Understanding how your application works!
The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
Swing desktop client application Wicket web application Mobile web application (In development) Multiple AS:JBoss Clusters, Apache Cluster, Tomcat & Terracotta Multiple frameworks: Spring, Guice, Wicket, Hibernate, Terracotta DSO, XStream, EJB 3.0, JMS, CGLib & Proprietary frameworks    Technical Information The IDI Test Case
The IDI Test Case
3000 +/- EJB Invocations per minute 100+ concurrent web sessions Internal Print servers clients  Internal Mail servers clients Internal Webservices clients JBoss EAR cluster user load information The IDI Test Case
The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
How many software engineers does it take to change a light bulb? Hardware choices affects code performance Hardware choices affects OS offerings (Do you really want Windows?) Hardware isn’t easily replaced, it costs a lot. Choosing the right hardware None. It's a hardware problem.
Which CPU architecture is right for you? Higher clock speed? (what about Moore’s law?) Higher core count? Number of hardware threads? Choosing the right hardware Remember: ,[object Object]
Highly computational apps relay on clock speed
Highly concurrent / multi user app relay on number of threads
Hardware benchmarking helps a lot, but it’s difficult to arrange,[object Object]
IDI Hardware history Choosing the right hardware @ IDI
The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
Remember this? Garbage Collectors Garbage Collection means that don’t have to anymore
When the JVM starts, the host OS assigns a dedicated memory space to that VM The VM allocates memory to the application within that dedicated memory space The VM frees memory automatically via garbage collectors Garbage Collection is an expensive algorithm JVM Memory Handling Garbage Collectors
The memory space is divided into three separated memory spaces: Eden SpaceWhere objects are born Survivor SpacesWhere objects mature Tenure SpaceWhere objects grow old and die Generational Memory Space Garbage Collectors
HotSpot  VM‘s Generational Memory Space Garbage Collectors Eden Space Survivor Space 2 Survivor Space 1 Tenure (Old) Generation Permanent Generation
ConcurrencyConcurrency describes its ability to do work while application threads are still running ParallelismParallelismdescribes the collector's ability to perform its work across multiple threads of execution. Hence, a collector can be parallel but not concurrent, concurrent but not parallel, or both parallel and concurrent. Technical Terms: Garbage Collectors
Copy CollectorA collector that copies live object from one space to another Low Pause CollectorA collector that works along side the application threads Throughput CollectorA collector that doesn’t add to the serial execution time of the application Technical Terms: Garbage Collectors
Memory FragmentationThe amount of unusable free memory (small holes that object can’t be fitted in) Stop the world:The application threads are stopped during the garbage collection Minor CollectionA garbage collection of the young generation Major CollectionA garbage collection of the old generation Technical Terms, Continued: Garbage Collectors
Types of GC Strategies (Generational): Garbage Collectors
Garbage Collectors “Parallel New” Strategy ,[object Object]
Old generation collection is done in serial“Parallel” Strategy ,[object Object]
Old generation collection is done in serial“Parallel Old” Strategy Young generation collection is done in parallel Old generation collection is done mostly in parallel
Low pause collector (short Stop the World pauses) Uses Parallel New for new generation GC Uses CMS for old generation GC Non compacting old generation collector Starts before the memory space is full (68%) Requires a larger heap Concurrent Mark-Sweep Strategy Garbage Collectors
Serial Collector (New Generation Space) Garbage Collectors
Serial GC Strategy - Young Generation Garbage Collectors No more room! Promoting to Tenure space Eden memory space Garbage Collection! Resuming Application Survived!Earned it’s place inTenure space Survivor space (To) Survivor space (From) Tenure memory space
Serial Collector (Old Generation Space) Garbage Collectors
Concurrent Mark-Sweep Garbage Collectors
CMS - Old Generation Garbage Collectors Tenure memory space Garbage Collection! Resuming Application Stop The World! Phase: Initial Mark Concurrent Mark Remark Concurrent Sweep Concurrent Pre-Clean
High probability soft real time collector One memory space for the young and tenure generation Entire memory space is divided into equally sized cards Cards are managed by regions and tracked by “Remembered Sets” for changes A global card table track all the cards Garbage First (G1) What’s the big deal? Garbage Collectors
Garbage First (G1) - Heap Structure Garbage Collectors Card (512 Bytes) Region A Card (512 Bytes) Region B Global Card Table Card (512 Bytes) Region N Remembered Set (Per Region)
Garbage First - Minor Collection Garbage Collectors Similar to Parallel New Compacts young regions  Also compacts old regions if there’s time Garbage First - Major Collection ,[object Object]
Marks low lived ratio regions for collection in the minor collection phase,[object Object]
IDI Garbage Collection Strategy: Garbage Collectors @ IDI
The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
This is JVM Tuning: JVM Tuning
-Xmx<size><units> -Xms<size><units> -d64 -server -XX:MaxPermSize=<size><units> -XX:-HeapDumpOnOutOfMemoryError The must know flags JVM Tuning
-Xloggc:<file_name> -XX:+ PrintHeapAtGC -XX:+ PrintGCDateStamps -XX:+ PrintGCDetails -XX:+ PrintGCApplicationStoppedTime -XX:+ PrintGCApplicationConcurrentTime GC Logs JVM Tuning
-XX:+ UseSerialGC -XX:+ UseParNewGC -XX:+UseConcMarkSweepGC  -XX:+ UseParallelGC -XX:+UseParallelOldGC -XX:+UseG1GC (JDK 1.7) -XX:+UnlockExperimentalVMOptions(for G1 JDK 1.6_14)     Garbage Collector Strategies JVM Tuning
Tuning GC JVM Tuning

More Related Content

What's hot

What's hot (20)

How long can you afford to Stop The World?
How long can you afford to Stop The World?How long can you afford to Stop The World?
How long can you afford to Stop The World?
 
Tuning Java GC to resolve performance issues
Tuning Java GC to resolve performance issuesTuning Java GC to resolve performance issues
Tuning Java GC to resolve performance issues
 
An Introduction to JVM Internals and Garbage Collection in Java
An Introduction to JVM Internals and Garbage Collection in JavaAn Introduction to JVM Internals and Garbage Collection in Java
An Introduction to JVM Internals and Garbage Collection in Java
 
Tuning Java for Big Data
Tuning Java for Big DataTuning Java for Big Data
Tuning Java for Big Data
 
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
 
JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011
 
Java GC, Off-heap workshop
Java GC, Off-heap workshopJava GC, Off-heap workshop
Java GC, Off-heap workshop
 
淺談 Java GC 原理、調教和 新發展
淺談 Java GC 原理、調教和新發展淺談 Java GC 原理、調教和新發展
淺談 Java GC 原理、調教和 新發展
 
Fight with Metaspace OOM
Fight with Metaspace OOMFight with Metaspace OOM
Fight with Metaspace OOM
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
On heap cache vs off-heap cache
On heap cache vs off-heap cacheOn heap cache vs off-heap cache
On heap cache vs off-heap cache
 
(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag Session(JVM) Garbage Collection - Brown Bag Session
(JVM) Garbage Collection - Brown Bag Session
 
Storing Cassandra Metrics
Storing Cassandra MetricsStoring Cassandra Metrics
Storing Cassandra Metrics
 
Understanding Garbage Collection
Understanding Garbage CollectionUnderstanding Garbage Collection
Understanding Garbage Collection
 
Performance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionPerformance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage Collection
 
GC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerGC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance Engineer
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...
Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...
Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
 

Viewers also liked

Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
Carol McDonald
 

Viewers also liked (11)

Java Performance Monitoring & Tuning
Java Performance Monitoring & TuningJava Performance Monitoring & Tuning
Java Performance Monitoring & Tuning
 
Efficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java ApplicationsEfficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java Applications
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Jvm tuning in a rush! - Lviv JUG
Jvm tuning in a rush! - Lviv JUGJvm tuning in a rush! - Lviv JUG
Jvm tuning in a rush! - Lviv JUG
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage Collection
 
Tune up Yarn and Hive
Tune up Yarn and HiveTune up Yarn and Hive
Tune up Yarn and Hive
 
Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Hive tuning
Hive tuningHive tuning
Hive tuning
 
JVM Tuning and Profiling
JVM Tuning and ProfilingJVM Tuning and Profiling
JVM Tuning and Profiling
 
AI and the Future of Growth
AI and the Future of GrowthAI and the Future of Growth
AI and the Future of Growth
 

Similar to HotSpot JVM Tuning

Azul yandexjune010
Azul yandexjune010Azul yandexjune010
Azul yandexjune010
yaevents
 
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
sidg75
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
elliando dias
 

Similar to HotSpot JVM Tuning (20)

JVM Magic
JVM MagicJVM Magic
JVM Magic
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Azul yandexjune010
Azul yandexjune010Azul yandexjune010
Azul yandexjune010
 
Taming The JVM
Taming The JVMTaming The JVM
Taming The JVM
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 
An introduction to G1 collector for busy developers
An introduction to G1 collector for busy developersAn introduction to G1 collector for busy developers
An introduction to G1 collector for busy developers
 
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)
 
Java 8 Launch - MetaSpaces
Java 8 Launch - MetaSpacesJava 8 Launch - MetaSpaces
Java 8 Launch - MetaSpaces
 
Garbage First & You
Garbage First & YouGarbage First & You
Garbage First & You
 
Garbage First and You!
Garbage First and You!Garbage First and You!
Garbage First and You!
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
Android Memory , Where is all My RAM
Android Memory , Where is all My RAM Android Memory , Where is all My RAM
Android Memory , Where is all My RAM
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
 
Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+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...
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

HotSpot JVM Tuning

  • 1. HotSpot JVM Tuning By: Gilad Garon Technical Meeting!
  • 2.
  • 3. Software architectureBut most of all, JVM Tuning is about: Understanding how your application works!
  • 4. The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
  • 5. Swing desktop client application Wicket web application Mobile web application (In development) Multiple AS:JBoss Clusters, Apache Cluster, Tomcat & Terracotta Multiple frameworks: Spring, Guice, Wicket, Hibernate, Terracotta DSO, XStream, EJB 3.0, JMS, CGLib & Proprietary frameworks Technical Information The IDI Test Case
  • 7. 3000 +/- EJB Invocations per minute 100+ concurrent web sessions Internal Print servers clients Internal Mail servers clients Internal Webservices clients JBoss EAR cluster user load information The IDI Test Case
  • 8. The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
  • 9. How many software engineers does it take to change a light bulb? Hardware choices affects code performance Hardware choices affects OS offerings (Do you really want Windows?) Hardware isn’t easily replaced, it costs a lot. Choosing the right hardware None. It's a hardware problem.
  • 10.
  • 11. Highly computational apps relay on clock speed
  • 12. Highly concurrent / multi user app relay on number of threads
  • 13.
  • 14. IDI Hardware history Choosing the right hardware @ IDI
  • 15. The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
  • 16. Remember this? Garbage Collectors Garbage Collection means that don’t have to anymore
  • 17. When the JVM starts, the host OS assigns a dedicated memory space to that VM The VM allocates memory to the application within that dedicated memory space The VM frees memory automatically via garbage collectors Garbage Collection is an expensive algorithm JVM Memory Handling Garbage Collectors
  • 18. The memory space is divided into three separated memory spaces: Eden SpaceWhere objects are born Survivor SpacesWhere objects mature Tenure SpaceWhere objects grow old and die Generational Memory Space Garbage Collectors
  • 19. HotSpot VM‘s Generational Memory Space Garbage Collectors Eden Space Survivor Space 2 Survivor Space 1 Tenure (Old) Generation Permanent Generation
  • 20. ConcurrencyConcurrency describes its ability to do work while application threads are still running ParallelismParallelismdescribes the collector's ability to perform its work across multiple threads of execution. Hence, a collector can be parallel but not concurrent, concurrent but not parallel, or both parallel and concurrent. Technical Terms: Garbage Collectors
  • 21. Copy CollectorA collector that copies live object from one space to another Low Pause CollectorA collector that works along side the application threads Throughput CollectorA collector that doesn’t add to the serial execution time of the application Technical Terms: Garbage Collectors
  • 22. Memory FragmentationThe amount of unusable free memory (small holes that object can’t be fitted in) Stop the world:The application threads are stopped during the garbage collection Minor CollectionA garbage collection of the young generation Major CollectionA garbage collection of the old generation Technical Terms, Continued: Garbage Collectors
  • 23. Types of GC Strategies (Generational): Garbage Collectors
  • 24.
  • 25.
  • 26. Old generation collection is done in serial“Parallel Old” Strategy Young generation collection is done in parallel Old generation collection is done mostly in parallel
  • 27. Low pause collector (short Stop the World pauses) Uses Parallel New for new generation GC Uses CMS for old generation GC Non compacting old generation collector Starts before the memory space is full (68%) Requires a larger heap Concurrent Mark-Sweep Strategy Garbage Collectors
  • 28. Serial Collector (New Generation Space) Garbage Collectors
  • 29. Serial GC Strategy - Young Generation Garbage Collectors No more room! Promoting to Tenure space Eden memory space Garbage Collection! Resuming Application Survived!Earned it’s place inTenure space Survivor space (To) Survivor space (From) Tenure memory space
  • 30. Serial Collector (Old Generation Space) Garbage Collectors
  • 32. CMS - Old Generation Garbage Collectors Tenure memory space Garbage Collection! Resuming Application Stop The World! Phase: Initial Mark Concurrent Mark Remark Concurrent Sweep Concurrent Pre-Clean
  • 33. High probability soft real time collector One memory space for the young and tenure generation Entire memory space is divided into equally sized cards Cards are managed by regions and tracked by “Remembered Sets” for changes A global card table track all the cards Garbage First (G1) What’s the big deal? Garbage Collectors
  • 34. Garbage First (G1) - Heap Structure Garbage Collectors Card (512 Bytes) Region A Card (512 Bytes) Region B Global Card Table Card (512 Bytes) Region N Remembered Set (Per Region)
  • 35.
  • 36.
  • 37. IDI Garbage Collection Strategy: Garbage Collectors @ IDI
  • 38. The IDI Test Case Choosing the right hardware Garbage Collectors JVM Tuning Agenda JVM Tuning
  • 39. This is JVM Tuning: JVM Tuning
  • 40. -Xmx<size><units> -Xms<size><units> -d64 -server -XX:MaxPermSize=<size><units> -XX:-HeapDumpOnOutOfMemoryError The must know flags JVM Tuning
  • 41. -Xloggc:<file_name> -XX:+ PrintHeapAtGC -XX:+ PrintGCDateStamps -XX:+ PrintGCDetails -XX:+ PrintGCApplicationStoppedTime -XX:+ PrintGCApplicationConcurrentTime GC Logs JVM Tuning
  • 42. -XX:+ UseSerialGC -XX:+ UseParNewGC -XX:+UseConcMarkSweepGC  -XX:+ UseParallelGC -XX:+UseParallelOldGC -XX:+UseG1GC (JDK 1.7) -XX:+UnlockExperimentalVMOptions(for G1 JDK 1.6_14)     Garbage Collector Strategies JVM Tuning
  • 43. Tuning GC JVM Tuning
  • 44. Tuning GC JVM Tuning
  • 45. Tuning GC JVM Tuning
  • 46. Tuning GC JVM Tuning And many many more…
  • 47. Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning Memory Management Whitepaper Garbage-First Garbage Collection Whitepaper Setting Java GC Parameters For Large Heaps Java Tuning White Paper Java HotSpot VM Options The most complete list of -XX options for Java 6 JVM G1: Java's Garbage First Garbage Collector` References
  • 48. The Garbage-First Garbage Collector (JavaOne 2008) JVM Internals - Garbage Collection & Runtime Optimizations Garbage Collection in the Java HotSpot Virtual Machine References