SlideShare a Scribd company logo
1 of 41
JVM GC
     by
Outline
JVM      结   简

Hotspot JVM GC    绍

JVM GC

Levit JVM
JVM Structure
 class files                     class loader


              Runtime Data Area
                                     Native
Method Area        Java Stack        Method
                                     Stack



    Heap                  PC Register



 Execute              Native            Native
  Engine            Interface           Library
Heap
 Java   new   对


Method Area


Java Stack Java栈&Native Statck
        栈
HotSpot JVM GC
weak generational hypothesis:
  Most allocated objects are not
 referenced (considered live) for long,
 that is, they die young.
 Few references from older to younger
 objects exist.
Heap
Young Generation
                     Eden

      From                       To

Old Generation

                 Tenured Space
-Xmxn            间

-Xmsn            间

-Xmnn young

-XX:PermSize=n       间
GC
Minor GC

  young generation满 时
  minor collection
Full GC

  old     permanent满   时   进   full
GC

   VS

 发VS Stop-the-World

压缩 VS   压缩 VS    贝
GC
Eden


From   To
            Empty
Old
GC
Eden
               Empty
 To                From
       Empty
Old
Old   GC
 mark



sweep



compact
GC


Client      认

-XX:+UseSerialGC
GC


young     Parallel Scavenage GC

old     Parallel MSC GC
Parallel Scavenge GC
Parallel Scavenge GC
Eden


From        To
Parallel Scavenge GC
Eden


From        To
Parallel Scavenge GC
Eden


From        To
Parallel MSC GC
Parallel MSC GC



R1:    R2:4/6 R3:3/6 R4:1/6 R5:0/6
Parallel MSC GC
              destination region   source region




R1:    R2:4/6 R3:3/6 R4:1/6 R5:0/6

          Dense prefix
Parallel MSC GC



R1:    R2:4/6 R3:3/6 R4:1/6 R5:0/6

                       T2     T1
Parallel MSC GC



R1     R2   R3   R4    R5

                 T2    T1
Parallel MSC GC



R1     R2   R3   R4    R5

                 T2    T1
GC


Server       认

-XX:+UseParallelGC
CMS GC
CMS GC
CMS   动   产
CMS


-XX:+UseConcMarkSweepGC
GC


                       F ir st
     r ba ge
Ga


http://research.sun.com/jtech/pubs/04-g1-paper-ismm.pdf
GC组
JVM


http://blogs.oracle.com/watt/resource/jvm-options-list.html
JVM GC

jstat
jmap
jconsole
jvisualvm
Levit JVM
-Xmx2g              2G

-Xms2g              2G

-Xmn512m      young        512M

-XX:PermSize=128m        Perm          128M

-XX:MaxPermSize=196m            Perm      196M

-Xss256k                 256K
Levit JVM
-XX:+DisableExplicitGC            GC           System.gc()             JVM
            GC

-XX:+UseConcMarkSweepGC           CMS GC

-XX:+CMSParallelRemarkEnabled       CMS          remark            remark
            -XX:+UseParNewGC

-XX:+UseCMSCompactAtFullCollection:CMS                       Compact

-XX:+UseFastAccessorMethods:Use optimized versions of
Get<Primitive>Field.

-XX:+UseCMSInitiatingOccupancyOnly :Used to enabled/disable the use of the
anticipated promotions to start a concurrent collection set

-XX:+UseCompressedOops :                                64              64
                   32Gb                        32
GC
FullGC 应      频   启

压   长   YoungGC
资

http://chaoticjava.com/posts/parallel-and-concurrent-garbage-collectors

http://blogs.oracle.com/watt/resource/jvm-options-list.html

http://www.oracle.com/technet work/java/javase/tech/index-
jsp-136373.html
Any Questi ons
     Q&A

More Related Content

What's hot

Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
Daniel Londero
 
だじゃれのススメ
だじゃれのススメだじゃれのススメ
だじゃれのススメ
Naoko Yamazaki
 
CS5229 Lecture 5: TCP and TRFC
CS5229 Lecture 5: TCP and TRFCCS5229 Lecture 5: TCP and TRFC
CS5229 Lecture 5: TCP and TRFC
Wei Tsang Ooi
 

What's hot (17)

Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VM
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
 
Understanding Garbage Collection
Understanding Garbage CollectionUnderstanding Garbage Collection
Understanding Garbage Collection
 
Resource element lte explanations!
Resource element lte explanations!Resource element lte explanations!
Resource element lte explanations!
 
だじゃれのススメ
だじゃれのススメだじゃれのススメ
だじゃれのススメ
 
Paper_An Efficient Garbage Collection in Java Virtual Machine via Swap I/O O...
Paper_An Efficient Garbage Collection in Java Virtual  Machine via Swap I/O O...Paper_An Efficient Garbage Collection in Java Virtual  Machine via Swap I/O O...
Paper_An Efficient Garbage Collection in Java Virtual Machine via Swap I/O O...
 
Taming The JVM
Taming The JVMTaming The JVM
Taming The JVM
 
CS5229 Lecture 5: TCP and TRFC
CS5229 Lecture 5: TCP and TRFCCS5229 Lecture 5: TCP and TRFC
CS5229 Lecture 5: TCP and TRFC
 
ODP IPsec lookaside API Demo
ODP IPsec lookaside API DemoODP IPsec lookaside API Demo
ODP IPsec lookaside API Demo
 
Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...
 
Optimizing High Performance Big Data Cancer Workflows
Optimizing High Performance Big Data Cancer WorkflowsOptimizing High Performance Big Data Cancer Workflows
Optimizing High Performance Big Data Cancer Workflows
 
SUC Brasil 2012 : Coupled Analysis of Hose Loadings in a Tandem Offloading Op...
SUC Brasil 2012 : Coupled Analysis of Hose Loadings in a Tandem Offloading Op...SUC Brasil 2012 : Coupled Analysis of Hose Loadings in a Tandem Offloading Op...
SUC Brasil 2012 : Coupled Analysis of Hose Loadings in a Tandem Offloading Op...
 
Cram4
Cram4Cram4
Cram4
 
Cram 3.1 / Crumble
Cram 3.1 / CrumbleCram 3.1 / Crumble
Cram 3.1 / Crumble
 
Learning RSocket Using RSC
Learning RSocket Using RSCLearning RSocket Using RSC
Learning RSocket Using RSC
 
Paper_Scalable database logging for multicores
Paper_Scalable database logging for multicoresPaper_Scalable database logging for multicores
Paper_Scalable database logging for multicores
 
CS176: Genome Assembly
CS176: Genome AssemblyCS176: Genome Assembly
CS176: Genome Assembly
 

Similar to Jvm gc那点事

Similar to Jvm gc那点事 (20)

7 jvm-arguments-Confoo
7 jvm-arguments-Confoo7 jvm-arguments-Confoo
7 jvm-arguments-Confoo
 
Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1
 
Gc algorithms
Gc algorithmsGc algorithms
Gc algorithms
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Java memory problem cases solutions
Java memory problem cases solutionsJava memory problem cases solutions
Java memory problem cases solutions
 
Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Clo...
Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Clo...Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Clo...
Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Clo...
 
7 jvm-arguments-v1
7 jvm-arguments-v17 jvm-arguments-v1
7 jvm-arguments-v1
 
Jvm tuning
Jvm tuningJvm tuning
Jvm tuning
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
JVM Magic
JVM MagicJVM Magic
JVM Magic
 
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
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Java PerformanceChapter_7
Java PerformanceChapter_7Java PerformanceChapter_7
Java PerformanceChapter_7
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
 
7-JVM-arguments-JaxLondon-2023.pptx
7-JVM-arguments-JaxLondon-2023.pptx7-JVM-arguments-JaxLondon-2023.pptx
7-JVM-arguments-JaxLondon-2023.pptx
 
Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
 
Understanding Garbage Collection Using Automatic Memory Management
Understanding Garbage Collection Using Automatic Memory ManagementUnderstanding Garbage Collection Using Automatic Memory Management
Understanding Garbage Collection Using Automatic Memory Management
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 
Inside the jvm
Inside the jvmInside the jvm
Inside the jvm
 

Recently uploaded

+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@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+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...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
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)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
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...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Jvm gc那点事

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n