SlideShare a Scribd company logo
Tech share Java Memory Management
Garbage Collection Responsibility  Allocating memory Ensuring that any referenced objects remain in memory Recovering memory used by objects that are no longer reachable from references in executing code.
Generation Collection Most allocated objects die young Few references from older to younger objects exist.
Sun hotspot memory model Young Generation Eden Survivor From Survivor To Tenured (Old) Generation Permanent objects describing classes and methods as well as the classes and methods themselves
Garbage Collection Types young generation collection (minor collection) young generation fills up full collection (major collection)  old or permanent generation fills up System.gc() the old generation collection algorithm is used on : Sometimes the old generation is too full to accept all the objects that would be likely to be promoted from the young generation to the old generation if the young generation was collected first.
Fast Allocation bump-the-pointer technique  large contiguous blocks of memory available Thread-Local Allocation Buffers (TLABs) multithread-safe without global locks -XX:TLABWasteTargetPercent   (n/Eden)  -XX:+PrintTLAB
Hotspot Collectors Serial Collector Parallel Collector Parallel Compacting Collector Concurrent Mark-Sweep (CMS) Collector
Hotspot Default garbage collector  Java –version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)  Server : parallel collector Note: For Java SE 6, the definition of a server-class machine is one with at least 2 CPUs and at least 2GB of physical memory. Client: Serial collector
Serial Collector using a single CPU in a stop-the-world fashion
Serial Collector Yong Generation Collection too large objects are directly copied to old generation -XX:InitialTenuringThreshold=7 -XX:MaxTenuringThreshold=
Serial Collector  Old Generation Collection mark-sweep-compact Mark Mark live objects Sweep Sweep unmarked objects Compact For bump-the-pointer
Serial Collector When to Use: do not have a requirement for low pause times On today’s hardware, less than half a second for full collections (64MB heaps) 1024MB/64MB=16*0.5second = 8second Usage: -XX:+UseSerialGC
Parallel Collector also known as the throughput collector -XX:+PrintGCDetails -XX:+PrintTLAB -XX:MaxTenuringThreshold=7 -XX:PretenureSizeThreshold=2M -XX:+PrintGCTimeStamps -Xms30M -Xmx30M -Xmn2M   -XX:+UseParallelGC PSYoungGen [0x085f0000, 0x087f0000, 0x087f0000) eden space [0x085f0000,0x087673c0,0x08770000)   from space [0x087b0000,0x087b0000,0x087f0000)   to   space [0x08770000,0x08770000,0x087b0000) PSOldGen [0x069f0000, 0x085f0000, 0x085f0000)   object space [0x069f0000,0x070f0070,0x085f0000)
Parallel Collector Young Generation Collection still a stop-the-world and copying collector in parallel using many CPUs
Parallel Collector Old Generation Collection Still mark-sweep-compact  serial operation When to use: often appropriate include those that do batch processing, billing, payroll, scientific computing, and so on. Usage: -XX:+UseParallelGC
Parallel Compacting Collector was introduced in J2SE 5.0 update 6 Note:  willreplace the parallel collector. Young Generation Collection  Same as parallel collector
Parallel Compacting Collector Old Generation Collection  marking phase logically divided into fixed-sized regions GCmarklive objects with multi-thread –XX:ParallelGCThreads=n (By default on a host with N CPUs) summary phase  (serial operation) starting with the leftmost one to examine the density of the regions Calculates and stores the new location of the first byte of live data for each compacted region compaction phase Compact use by summary data
Parallel Compacting Collector When to use: more than one CPU reduces pause times  (multi-thread) Usage: -XX:+UseParallelOldGC -XX:ParallelGCThreads=n
Concurrent Mark-Sweep (CMS) Collector also known as the low-latency collector. Young Generation Collection  Same as parallel collector
Concurrent Mark-Sweep (CMS) Collector Old Generation Collection: identifies the initial set of live objects directly reachable from the application code marks all live objects that are transitively reachable from this set
Concurrent Mark-Sweep (CMS) disadvantage only collector that is non-compacting requirement for larger heap sizes than the other collectors CMS Incremental Mode periodically stopping the concurrent phase to yield back processing to the application –XX:+CMSIncrementalMode
Concurrent Mark-Sweep (CMS) When to use: applications that have a relatively large set of long-lived data (a large old generation) run on machines with two or more processors for any application with a low pause time requirement Usage:  -XX:+UseConcMarkSweepGC –XX:+CMSIncrementalMode (Incremental Mode)
CMS log 2.259: [GC [1 CMS-initial-mark: 4280K(5120K)] 6042K(18944K), 0.0003876 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]  2.260: [CMS-concurrent-mark-start] 2.267: [CMS-concurrent-mark: 0.007/0.007 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]  2.267: [CMS-concurrent-preclean-start] 2.267: [CMS-concurrent-preclean: 0.001/0.001 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]  2.267: [GC[YG occupancy: 1761 K (13824 K)]2.268: [Rescan (parallel) , 0.0001977 secs]2.268: [weak refs processing, 0.0000046 secs] [1 CMS-remark: 4280K(5120K)] 6042K(18944K), 0.0003386 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]  2.268: [CMS-concurrent-sweep-start] 2.269: [CMS-concurrent-sweep: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]  2.269: [CMS-concurrent-reset-start] 2.269: [CMS-concurrent-reset: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Disadvantage of non-compactingCode static int alloc_1MB = 1024 * 1024 * 1; public static void main(String[] args) throws Exception {         //UseConcMarkSweepGC         byte[] bytes10 = alloc();  alloc();         byte[] bytes12 = alloc();  alloc();         byte[] bytes14 = alloc();  alloc();         byte[] bytes16 = alloc();  alloc();         byte[] bytes18 = alloc();  alloc();         byte[] bytes20 = alloc();  alloc();         byte[] bytes22 = alloc(); alloc(3);     } static int count = 0;     private static byte[] alloc() {         return alloc(1);     }     private static byte[] alloc(inti) {         count = count +  1 * i ; System.out.println(count + "M");         return new byte[alloc_1MB * i];     }
Disadvantage of non-compactingresult of Parallel&ParallelOld -XX:+UseParallelGC -XX:PretenureSizeThreshold=1k -XX:MaxTenuringThreshold=30 -Xms20M -Xmx20M -Xmn10M  -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution PSYoungGen      total 8960K, used 5336K eden space 7680K, 69% used   from space 1280K, 0% used    to   space 1280K, 0% used  PSOldGen        total 10240K, used 6598K    object space 10240K, 64% used PSPermGen       total 16384K, used 4969K    object space 16384K, 30% used
Disadvantage of non-compactingResult of CMS -XX:+UseConcMarkSweepGC -XX:PretenureSizeThreshold=1k -XX:MaxTenuringThreshold=30 -Xms20M -Xmx20M -Xmn10M  -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution Exception in thread "main" java.lang.OutOfMemoryError: Java heap space  par new generation   total 9216K, used 491K  eden space 8192K,   6% used    from space 1024K,   0% used    to   space 1024K,   0% used  concurrent mark-sweep generation total 10240K, used 398K   concurrent-mark-sweep perm gen total 16384K, used 4947K
VM options -XX:MaxGCPauseMillis=n Pause time -XX:GCTimeRatio=99 1 / (1 + n) Throughput -Xmx –Xms -Xmn (=eden+survivor*2) –XX:SurvivorRatio=32 (1:34) Survivor:Eden -XX:MaxPermSize
Print gc –XX:+PrintGC –XX:+PrintGCDetails –XX:+PrintGCTimeStamps -verbose:gc [GC 325407K->83000K(776768K), 0.2300771 secs] [GC 325816K->83372K(776768K), 0.2454258 secs] [Full GC 267628K->83769K(776768K), 1.8479984 secs]
example -XX:MaxTenuringThreshold=7 -XX:MaxTenuringThreshold=0 -Xms30M -Xmx30M -Xmn10M  -XX:+UseSerialGC  def new generation   total 9216K, used 1106K [0x30be0000, 0x315e0000, 0x315e0000) eden space 8192K,  13% used [0x30be0000, 0x30cf4830, 0x313e0000) from space 1024K,   0% used [0x314e0000, 0x314e0000, 0x315e0000)   to   space 1024K,   0% used [0x313e0000, 0x313e0000, 0x314e0000) -XX:MaxTenuringThreshold=0 -XX:MaxTenuringThreshold=7 -Xms30M -Xmx30M -Xmn10M  -XX:+UseSerialGC  def new generation   total 9216K, used 1292K [0x30be0000, 0x315e0000, 0x315e0000) eden space 8192K,  13% used [0x30be0000, 0x30cf4890, 0x313e0000) from space 1024K,  18% used [0x314e0000, 0x3150e8b0, 0x315e0000)   to   space 1024K,   0% used [0x313e0000, 0x313e0000, 0x314e0000) ,[object Object],-XX:MaxTenuringThreshold=0 –Xms20M –Xmx20M -Xmn18M  -XX:+UseSerialGC Exception in thread "main" java.lang.OutOfMemoryError: Java heap space Notice: for Serial collector & CMS
System.gc()  &  finalize() Code: public class SerialTest {     public static void main(String[] args) throws Exception {         new SerialTest(); System.gc(); Thread.sleep(10); System.out.println("123");     } @Override     protected void finalize() throws Throwable { System.out.println("heloo================finalize");     } } Result: 0.227: [Full GC (System) TLAB: gc thread: 0x08839400 [id: 5820]  ……….. heloo================finalize 123
finalize  twice GC !!!
monitor JVisualVM JConsole JRockit mission control
Garbage-First Garbage Collector G1 GC for short Is a new GC that is being introduced in the Java HotSpot VM in JDK 7 also been released in Java SE 6 Update 14. G1 is the long-term replacement for HotSpot's low-latency Concurrent Mark-Sweep GC (widely referred to as CMS).
Garbage-First Garbage Collector Parallelism and Concurrency. G1 performs heap compaction there is a single contiguous heap which is split into same-sized regions Young/old generation is a set of potentially non-contiguous regions
G1 Collector Heap  garbage-first heap   total 20480K, used 3491K   region size 1024K, 3 young (3072K), 0 survivors (0K)  compacting perm gen  total 16384K, used 4967K    the space 16384K,  30% used No shared spaces configured.
G1 Collector RS: regon set 0.634: [GC pause (young), 0.00846287 secs]    [Parallel Time:   8.3 ms]       [GC Worker Start Time (ms):  633.9  634.3]       [Update RS (ms):  0.0  0.0 Avg:   0.0, Min:   0.0, Max:   0.0]          [Processed Buffers : 0 5           Sum: 5, Avg: 2, Min: 0, Max: 5]       [Ext Root Scanning (ms):  3.6  3.3 Avg:   3.5, Min:   3.3, Max:   3.6]       [Mark Stack Scanning (ms):  0.0  0.0 Avg:   0.0, Min:   0.0, Max:   0.0]       [Scan RS (ms):  0.0  0.0 Avg:   0.0, Min:   0.0, Max:   0.0]       [Object Copy (ms):  3.8  3.6 Avg:   3.7, Min:   3.6, Max:   3.8]       [Termination (ms):  0.0  0.0 Avg:   0.0, Min:   0.0, Max:   0.0]          [Termination Attempts : 1 1           Sum: 2, Avg: 1, Min: 1, Max: 1]       [GC Worker End Time (ms):  641.3  641.3]       [Other:   1.1 ms]    [Clear CT:   0.0 ms]    [Other:   0.2 ms]       [Choose CSet:   0.0 ms]    [ 2868K->1763K(20M)]  [Times: user=0.00 sys=0.00, real=0.00 secs]
comparison
references http://java.sun.com/products/hotspot/whitepaper.html http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html http://blogs.oracle.com/watt/resource/jvm-options-list.html http://www.iteye.com/topic/802638 http://blog.csdn.net/calvinxiu/archive/2007/05/18/1614473.aspx http://unixboy.iteye.com/blog/174173 http://java.sun.com/performance/reference/whitepapers/tuning.html

More Related Content

What's hot

Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
Shraddha
 
Java Networking
Java NetworkingJava Networking
Java Networking
Sunil OS
 
Packages in java
Packages in javaPackages in java
Packages in java
Elizabeth alexander
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Pavith Gunasekara
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Javaparag
 
Interface in java
Interface in javaInterface in java
Interface in java
PhD Research Scholar
 
Functional programming
Functional programmingFunctional programming
Functional programming
ijcd
 
Learn react-js
Learn react-jsLearn react-js
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
Muhammad Hafiz Hasan
 
Fragment
Fragment Fragment
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
AYESHA JAVED
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
Intelligo Technologies
 

What's hot (20)

Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Event handling
Event handlingEvent handling
Event handling
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
OOP java
OOP javaOOP java
OOP java
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
 
Fragment
Fragment Fragment
Fragment
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 

Viewers also liked

Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
AppDynamics
 
Java memory presentation
Java memory presentationJava memory presentation
Java memory presentationYury Bubnov
 
Java memory model
Java memory modelJava memory model
Java memory model
Michał Warecki
 
OAuth 2.0协议
OAuth 2.0协议OAuth 2.0协议
OAuth 2.0协议
jxqlovejava
 
Java性能调优浅谈
Java性能调优浅谈Java性能调优浅谈
Java性能调优浅谈
jxqlovejava
 
Java GC, Off-heap workshop
Java GC, Off-heap workshopJava GC, Off-heap workshop
Java GC, Off-heap workshop
Valerii Moisieienko
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
Takahiro YAMADA
 
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
Abhishek Asthana
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage Collection
Azul Systems Inc.
 
The Java memory model made easy
The Java memory model made easyThe Java memory model made easy
The Java memory model made easy
Rafael Winterhalter
 
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
3978   Why is Java so different... A Session for Cobol/PLI/Assembler Developers3978   Why is Java so different... A Session for Cobol/PLI/Assembler Developers
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
nick_garrod
 

Viewers also liked (12)

The Java Memory Model
The Java Memory ModelThe Java Memory Model
The Java Memory Model
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
 
Java memory presentation
Java memory presentationJava memory presentation
Java memory presentation
 
Java memory model
Java memory modelJava memory model
Java memory model
 
OAuth 2.0协议
OAuth 2.0协议OAuth 2.0协议
OAuth 2.0协议
 
Java性能调优浅谈
Java性能调优浅谈Java性能调优浅谈
Java性能调优浅谈
 
Java GC, Off-heap workshop
Java GC, Off-heap workshopJava GC, Off-heap workshop
Java GC, Off-heap workshop
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
 
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
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage Collection
 
The Java memory model made easy
The Java memory model made easyThe Java memory model made easy
The Java memory model made easy
 
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
3978   Why is Java so different... A Session for Cobol/PLI/Assembler Developers3978   Why is Java so different... A Session for Cobol/PLI/Assembler Developers
3978 Why is Java so different... A Session for Cobol/PLI/Assembler Developers
 

Similar to java memory management & gc

Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
Sun jdk 1.6 gc english version
Sun jdk 1.6 gc english versionSun jdk 1.6 gc english version
Sun jdk 1.6 gc english version
bluedavy lin
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
JVM performance options. How it works
JVM performance options. How it worksJVM performance options. How it works
JVM performance options. How it works
Dmitriy Dumanskiy
 
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
Monica Beckwith
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
Tier1 App
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
Prem Kuppumani
 
Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection Hero
Tier1app
 
Pick diamonds from garbage
Pick diamonds from garbagePick diamonds from garbage
Pick diamonds from garbage
Tier1 App
 
Simple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorialSimple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorial
Jin-Hwa Kim
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
ihji
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
BhautikDaxini1
 
The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
Jarosław Pleskot
 
What you need to know about GC
What you need to know about GCWhat you need to know about GC
What you need to know about GC
Kelum Senanayake
 
Java profiling Do It Yourself
Java profiling Do It YourselfJava profiling Do It Yourself
Java profiling Do It Yourself
aragozin
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
Amazon Web Services
 
CICS Memory Objects and MEMLIMIT
 CICS Memory Objects and MEMLIMIT CICS Memory Objects and MEMLIMIT
CICS Memory Objects and MEMLIMIT
David Clancy
 
Deep Dive on Amazon EC2
Deep Dive on Amazon EC2Deep Dive on Amazon EC2
Deep Dive on Amazon EC2
Amazon Web Services
 
JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & Diagnostics
Dhaval Shah
 
Deep dumpster diving 2010
Deep dumpster diving 2010Deep dumpster diving 2010
Deep dumpster diving 2010RonnBlack
 

Similar to java memory management & gc (20)

Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
Sun jdk 1.6 gc english version
Sun jdk 1.6 gc english versionSun jdk 1.6 gc english version
Sun jdk 1.6 gc english version
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 
JVM performance options. How it works
JVM performance options. How it worksJVM performance options. How it works
JVM performance options. How it works
 
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
Garbage First Garbage Collector (G1 GC): Current and Future Adaptability and ...
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection Hero
 
Pick diamonds from garbage
Pick diamonds from garbagePick diamonds from garbage
Pick diamonds from garbage
 
Simple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorialSimple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorial
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
 
The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
 
What you need to know about GC
What you need to know about GCWhat you need to know about GC
What you need to know about GC
 
Java profiling Do It Yourself
Java profiling Do It YourselfJava profiling Do It Yourself
Java profiling Do It Yourself
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 
CICS Memory Objects and MEMLIMIT
 CICS Memory Objects and MEMLIMIT CICS Memory Objects and MEMLIMIT
CICS Memory Objects and MEMLIMIT
 
Deep Dive on Amazon EC2
Deep Dive on Amazon EC2Deep Dive on Amazon EC2
Deep Dive on Amazon EC2
 
JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & Diagnostics
 
Deep dumpster diving 2010
Deep dumpster diving 2010Deep dumpster diving 2010
Deep dumpster diving 2010
 

More from exsuns

Hadoop 20111215
Hadoop 20111215Hadoop 20111215
Hadoop 20111215
exsuns
 
Statistics
StatisticsStatistics
Statisticsexsuns
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117exsuns
 

More from exsuns (6)

Hadoop 20111215
Hadoop 20111215Hadoop 20111215
Hadoop 20111215
 
Statistics
StatisticsStatistics
Statistics
 
R
RR
R
 
Ios
IosIos
Ios
 
Cassandra
CassandraCassandra
Cassandra
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117
 

Recently uploaded

De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 

Recently uploaded (20)

De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 

java memory management & gc

  • 1. Tech share Java Memory Management
  • 2. Garbage Collection Responsibility Allocating memory Ensuring that any referenced objects remain in memory Recovering memory used by objects that are no longer reachable from references in executing code.
  • 3. Generation Collection Most allocated objects die young Few references from older to younger objects exist.
  • 4. Sun hotspot memory model Young Generation Eden Survivor From Survivor To Tenured (Old) Generation Permanent objects describing classes and methods as well as the classes and methods themselves
  • 5. Garbage Collection Types young generation collection (minor collection) young generation fills up full collection (major collection) old or permanent generation fills up System.gc() the old generation collection algorithm is used on : Sometimes the old generation is too full to accept all the objects that would be likely to be promoted from the young generation to the old generation if the young generation was collected first.
  • 6. Fast Allocation bump-the-pointer technique large contiguous blocks of memory available Thread-Local Allocation Buffers (TLABs) multithread-safe without global locks -XX:TLABWasteTargetPercent (n/Eden) -XX:+PrintTLAB
  • 7. Hotspot Collectors Serial Collector Parallel Collector Parallel Compacting Collector Concurrent Mark-Sweep (CMS) Collector
  • 8. Hotspot Default garbage collector Java –version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing) Server : parallel collector Note: For Java SE 6, the definition of a server-class machine is one with at least 2 CPUs and at least 2GB of physical memory. Client: Serial collector
  • 9. Serial Collector using a single CPU in a stop-the-world fashion
  • 10. Serial Collector Yong Generation Collection too large objects are directly copied to old generation -XX:InitialTenuringThreshold=7 -XX:MaxTenuringThreshold=
  • 11. Serial Collector Old Generation Collection mark-sweep-compact Mark Mark live objects Sweep Sweep unmarked objects Compact For bump-the-pointer
  • 12. Serial Collector When to Use: do not have a requirement for low pause times On today’s hardware, less than half a second for full collections (64MB heaps) 1024MB/64MB=16*0.5second = 8second Usage: -XX:+UseSerialGC
  • 13. Parallel Collector also known as the throughput collector -XX:+PrintGCDetails -XX:+PrintTLAB -XX:MaxTenuringThreshold=7 -XX:PretenureSizeThreshold=2M -XX:+PrintGCTimeStamps -Xms30M -Xmx30M -Xmn2M -XX:+UseParallelGC PSYoungGen [0x085f0000, 0x087f0000, 0x087f0000) eden space [0x085f0000,0x087673c0,0x08770000) from space [0x087b0000,0x087b0000,0x087f0000) to space [0x08770000,0x08770000,0x087b0000) PSOldGen [0x069f0000, 0x085f0000, 0x085f0000) object space [0x069f0000,0x070f0070,0x085f0000)
  • 14. Parallel Collector Young Generation Collection still a stop-the-world and copying collector in parallel using many CPUs
  • 15. Parallel Collector Old Generation Collection Still mark-sweep-compact serial operation When to use: often appropriate include those that do batch processing, billing, payroll, scientific computing, and so on. Usage: -XX:+UseParallelGC
  • 16. Parallel Compacting Collector was introduced in J2SE 5.0 update 6 Note: willreplace the parallel collector. Young Generation Collection Same as parallel collector
  • 17. Parallel Compacting Collector Old Generation Collection marking phase logically divided into fixed-sized regions GCmarklive objects with multi-thread –XX:ParallelGCThreads=n (By default on a host with N CPUs) summary phase (serial operation) starting with the leftmost one to examine the density of the regions Calculates and stores the new location of the first byte of live data for each compacted region compaction phase Compact use by summary data
  • 18. Parallel Compacting Collector When to use: more than one CPU reduces pause times (multi-thread) Usage: -XX:+UseParallelOldGC -XX:ParallelGCThreads=n
  • 19. Concurrent Mark-Sweep (CMS) Collector also known as the low-latency collector. Young Generation Collection Same as parallel collector
  • 20. Concurrent Mark-Sweep (CMS) Collector Old Generation Collection: identifies the initial set of live objects directly reachable from the application code marks all live objects that are transitively reachable from this set
  • 21. Concurrent Mark-Sweep (CMS) disadvantage only collector that is non-compacting requirement for larger heap sizes than the other collectors CMS Incremental Mode periodically stopping the concurrent phase to yield back processing to the application –XX:+CMSIncrementalMode
  • 22. Concurrent Mark-Sweep (CMS) When to use: applications that have a relatively large set of long-lived data (a large old generation) run on machines with two or more processors for any application with a low pause time requirement Usage: -XX:+UseConcMarkSweepGC –XX:+CMSIncrementalMode (Incremental Mode)
  • 23. CMS log 2.259: [GC [1 CMS-initial-mark: 4280K(5120K)] 6042K(18944K), 0.0003876 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2.260: [CMS-concurrent-mark-start] 2.267: [CMS-concurrent-mark: 0.007/0.007 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2.267: [CMS-concurrent-preclean-start] 2.267: [CMS-concurrent-preclean: 0.001/0.001 secs] [Times: user=0.01 sys=0.00, real=0.02 secs] 2.267: [GC[YG occupancy: 1761 K (13824 K)]2.268: [Rescan (parallel) , 0.0001977 secs]2.268: [weak refs processing, 0.0000046 secs] [1 CMS-remark: 4280K(5120K)] 6042K(18944K), 0.0003386 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2.268: [CMS-concurrent-sweep-start] 2.269: [CMS-concurrent-sweep: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2.269: [CMS-concurrent-reset-start] 2.269: [CMS-concurrent-reset: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
  • 24. Disadvantage of non-compactingCode static int alloc_1MB = 1024 * 1024 * 1; public static void main(String[] args) throws Exception { //UseConcMarkSweepGC byte[] bytes10 = alloc(); alloc(); byte[] bytes12 = alloc(); alloc(); byte[] bytes14 = alloc(); alloc(); byte[] bytes16 = alloc(); alloc(); byte[] bytes18 = alloc(); alloc(); byte[] bytes20 = alloc(); alloc(); byte[] bytes22 = alloc(); alloc(3); } static int count = 0; private static byte[] alloc() { return alloc(1); } private static byte[] alloc(inti) { count = count + 1 * i ; System.out.println(count + "M"); return new byte[alloc_1MB * i]; }
  • 25. Disadvantage of non-compactingresult of Parallel&ParallelOld -XX:+UseParallelGC -XX:PretenureSizeThreshold=1k -XX:MaxTenuringThreshold=30 -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution PSYoungGen total 8960K, used 5336K eden space 7680K, 69% used from space 1280K, 0% used to space 1280K, 0% used PSOldGen total 10240K, used 6598K object space 10240K, 64% used PSPermGen total 16384K, used 4969K object space 16384K, 30% used
  • 26. Disadvantage of non-compactingResult of CMS -XX:+UseConcMarkSweepGC -XX:PretenureSizeThreshold=1k -XX:MaxTenuringThreshold=30 -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution Exception in thread "main" java.lang.OutOfMemoryError: Java heap space par new generation total 9216K, used 491K eden space 8192K, 6% used from space 1024K, 0% used to space 1024K, 0% used concurrent mark-sweep generation total 10240K, used 398K concurrent-mark-sweep perm gen total 16384K, used 4947K
  • 27. VM options -XX:MaxGCPauseMillis=n Pause time -XX:GCTimeRatio=99 1 / (1 + n) Throughput -Xmx –Xms -Xmn (=eden+survivor*2) –XX:SurvivorRatio=32 (1:34) Survivor:Eden -XX:MaxPermSize
  • 28. Print gc –XX:+PrintGC –XX:+PrintGCDetails –XX:+PrintGCTimeStamps -verbose:gc [GC 325407K->83000K(776768K), 0.2300771 secs] [GC 325816K->83372K(776768K), 0.2454258 secs] [Full GC 267628K->83769K(776768K), 1.8479984 secs]
  • 29.
  • 30. System.gc() & finalize() Code: public class SerialTest { public static void main(String[] args) throws Exception { new SerialTest(); System.gc(); Thread.sleep(10); System.out.println("123"); } @Override protected void finalize() throws Throwable { System.out.println("heloo================finalize"); } } Result: 0.227: [Full GC (System) TLAB: gc thread: 0x08839400 [id: 5820] ……….. heloo================finalize 123
  • 31. finalize twice GC !!!
  • 32. monitor JVisualVM JConsole JRockit mission control
  • 33. Garbage-First Garbage Collector G1 GC for short Is a new GC that is being introduced in the Java HotSpot VM in JDK 7 also been released in Java SE 6 Update 14. G1 is the long-term replacement for HotSpot's low-latency Concurrent Mark-Sweep GC (widely referred to as CMS).
  • 34. Garbage-First Garbage Collector Parallelism and Concurrency. G1 performs heap compaction there is a single contiguous heap which is split into same-sized regions Young/old generation is a set of potentially non-contiguous regions
  • 35. G1 Collector Heap garbage-first heap total 20480K, used 3491K region size 1024K, 3 young (3072K), 0 survivors (0K) compacting perm gen total 16384K, used 4967K the space 16384K, 30% used No shared spaces configured.
  • 36. G1 Collector RS: regon set 0.634: [GC pause (young), 0.00846287 secs] [Parallel Time: 8.3 ms] [GC Worker Start Time (ms): 633.9 634.3] [Update RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Processed Buffers : 0 5 Sum: 5, Avg: 2, Min: 0, Max: 5] [Ext Root Scanning (ms): 3.6 3.3 Avg: 3.5, Min: 3.3, Max: 3.6] [Mark Stack Scanning (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Scan RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Object Copy (ms): 3.8 3.6 Avg: 3.7, Min: 3.6, Max: 3.8] [Termination (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Termination Attempts : 1 1 Sum: 2, Avg: 1, Min: 1, Max: 1] [GC Worker End Time (ms): 641.3 641.3] [Other: 1.1 ms] [Clear CT: 0.0 ms] [Other: 0.2 ms] [Choose CSet: 0.0 ms] [ 2868K->1763K(20M)] [Times: user=0.00 sys=0.00, real=0.00 secs]
  • 38. references http://java.sun.com/products/hotspot/whitepaper.html http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html http://blogs.oracle.com/watt/resource/jvm-options-list.html http://www.iteye.com/topic/802638 http://blog.csdn.net/calvinxiu/archive/2007/05/18/1614473.aspx http://unixboy.iteye.com/blog/174173 http://java.sun.com/performance/reference/whitepapers/tuning.html