SlideShare a Scribd company logo
<Insert Picture Here>

Introduction of Java GC Tuning and Java
Java Mission Control
Leon Chen (陳逸嘉)
Principal Sales Consultant
Oracle
The following is intended to outline our general
product direction. It is intended for information
purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any
material, code, or functionality, and should not be
relied upon in making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
Leon Chen (陳逸嘉)

• More than 14 years in Java/JEE, as programmer,
architect, leader and consultant, in finance/telecom
domain.
•
•
•
•
•

工研院
得捷
新光人壽
Ericsson
Oracle
• TW Patent 182927, 一種文章切割方法, 2003, 陳逸嘉, 林一中
• TW Patent 206819, 自動服務組合方法及系統, 2004, 陳逸嘉, 許
維德, 洪鵬翔
• US Patent 7,617,174, Method and system for automatic
service composition, 2009, Leon Chen, Wei-Tek Hsu, PengHsiang Hung
Java Roadmap
JRockit

Hotspot
HotRockit

(JDK7_update 40 almost; JDK 8, 2014 暫定)
Java SE Roadmap

JDK 8 (Q1 2014)
7u40

7u21
• Java Client Security Enhancements
• App Store Packaging tools

• Java Flight Recorder
• Java Mission Control 5.2
• Java Discovery Protocol
• Native memory tracking
• Local Security Policy

2013

• Lambda
• JVM Convergence
• JavaScript Interop
• JavaFX 8
• 3D API
• Java SE Embedded support
• Enhanced HTML5 support

JDK 9
• Modularity – Jigsaw
• Interoperability
• Cloud
• Ease of Use
• JavaFX JSR
• Optimizations

JDK 8u40

2014

2015

2016

NetBeans IDE 7.3

NetBeans IDE 8

JDK 8u20

NetBeans IDE 9

• New hints and refactoring
• Scene Builder Support

• JDK 8 support
• Scene Builder 2.0 support

• Deterministic G1
• Java Mission Control 6.0
• Improved JRE installer
• App bundling
enhancements

• JDK 9 support
• Scene Builder 3.0 support

Scene Builder 2.0
Scene Builder 1.1
• Linux support

• JavaFX 8 support
• Enhanced Java IDE support

Scene Builder 3.0
• JavaFX 9 support
JVM GC Tuning
32-bit VS. 64-bit
• 32-bit
• For heap sizes up to 2.5G/3G or so

• 64-bit
• Windows/Linux: different JVM, Solaris: add -d64
• -XX:+UseCompressedOops (default JDK6_23+)
• Compressed references: 32GB Max (26GB best)
• -Xmx: 26G (compressed) / unlimited (regular)

• 32-bit  64-bit migration
• Higher heap size requirements (around 20%)
• Slight throughput impact (without compressed refs)

• 64-bit preferred for today’s servers
• Only option starting with Fusion Middleware 12c
Java Memory Management

Reference video: http://www.youtube.com/watch?v=VQ4eZw6eVtQ
class Test {
private List<User> userList =
new ArrayList<User>();
…
public void execute() {
User user = new User();
userList.add(user);
…
user = null;
//No use
}
…

}
Tracing GC Example
Runtime
Stack

Hea
p
A

G

D

B

C

K

H

E

I

L

F

J

M
Tracing GC Example
Runtime
Stack

Hea
p
A

G

D

B

C

K

H

E

I

L

F

J

M
Tracing GC Example
Runtime
Stack

Heap
A

G

D
B

C

K

H

E

I

L

F

J

M
Tracing GC Example
Runtime
Stack

Heap
A

G

D
B

C

K

H

E

I

L

F

J

M
Tracing GC Example
Runtime
Stack

Heap
A

G

D

H

E

I

L

F

B

C

J

M

We identified all reachable objects. We can deduce that
the rest are unreachable and, therefore, dead.

K
Tracing GC Example
Runtime
Stack

Heap
A

C

K
H

B

E

I

We identified all reachable objects. We can deduce that
the rest are unreachable and, therefore, dead.

L
Garbage Collection
我真的需要花時間去
Tune GC 嗎?
Introduction of Java GC Tuning and Java Java Mission Control
花太多時間做 GC → Performance變慢
Performance變慢→花太多時間做 GC

不一定!!!
JVM Performance Tuning
Performance Tuning Process

Oracle confidential; Pending legal review
GC Logging in Production
• Don’t be afraid to enable GC logging in production
– Very helpful when diagnosing production issues

• Extremely low / non-existent overhead
– Maybe some large files in your file system.
– We are surprised that customers are still afraid to enable it
If Someone doesn’t enable

GC logging in production

I shoot them!
Most Important GC Logging Parameters
• You need at least:
– -XX:+PrintGCTimeStamps
• Add -XX:+PrintGCDateStamps if you must know the time
– -XX:+PrintGCDetails
• Preferred over -verbosegc as it's more detailed

• Also useful:
– -Xloggc:<file>
– Rotate GC Log, After Java 1.6_34 (or 1.7_2):
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=10M
JVM Performance Tuning
GCViewer – Offline analysis of GC logs
https://github.com/chewiebug/GCViewer
JVM Performance Tuning
GCViewer – Memory Leak Pattern
JWorks GC Web (Beta)
http://jworks.idv.tw/GcWeb/
Java Heap Structure and GC
Hotspot JVM Heap Layout
Total memory, for 32bits, max = 2^32 = 4GB.
In windows is 2GB, so max JVM Heap is about 1.6GB ~ 1.8GB

Native
Young

Old

Young Generation
– Eden where new objects get
instantiated
– 2 Survivor Spaces to hold live
objects during minor GC

Old Generation
– For tenured objects

Permanent Generation
– JVM meta data
Constraints of 32 Bits JVM
• Normal Windows (2GB process memory)
– ~1.5GB possible Java heap memory

• Windows started with /3GB (3GB process memory)
– ~2.8GB possible Java heap memory (2.6 or 2.7 GB
recommended with WLS)

• Linux, large process support enabled (3GB process
memory)
– ~2,8GB possible Java heap memory
Hotspot Internals
Generations & Object Lifecycle

Eden

S0

S1
Hotspot Internals
Object lifecycle

Number
indicates
Age

0
Hotspot Internals
Object lifecycle

1
Hotspot Internals
Object lifecycle

2
Hotspot Internals
Object lifecycle

3
Hotspot Internals
Object lifecycle

4
Hotspot Internals
Object lifecycle

5
Hotspot Internals
Object lifecycle
Hotspot GC Tuning
Footprint
(Heap Size)

Throughput

Latencies
Footprint
(Heap Size)

Throughput

Latencies
Hotspot Tuning
Sizing Heap

• Young Generation size determines
• Frequency of minor GC
• Number of objects reclaimed in minor GC

• Old Generation Size
• Should hold application's steady-state live data size
• Try to minimize frequency of major GC’s

• JVM footprint should not exceed physical memory
• Max of 80-90% RAM (leave room for OS)

• Thumb Rule: Try to maximize objects reclaimed in
young gen. Minimize Full GC frequency
Calculate Live Data Size (LDS)
• Make sure you get full GCs during steady-state
• Induce a couple if necessary
• JConsole / VisualVM
• Connect to the JVM, click on the “Perform GC” button
• jmap
• jmap -histo:live <pid>
• Can even introduce a thread that does regular System.gc()'s
• Just for this data gathering purpose, OK? Remove it
before deployment. :-)
Calculate Live Data Size (ii)
• From the GC log you will get
– Approximation of the Live Data Size (LDS)
• It is the heap occupancy after each full GC
– Approximation of max perm gen size
• It is the perm gen occupancy after each full GC
– Worst-case latency scenario due to the full GCs

• GC log example:
GC Triggered
Heap Usage

Size of
”long lived objects”

Max Java Heap
Initial Heap Configuration
• You can now make an informed decision on choosing
a reasonable heap size
– Rule of thumb
• Set -Xms and -Xmx to 3x to 4x LDS
• Set both -XX:PermSize and -XX:MaxPermSize to around
1.2x to 1.5x the max perm gen size

• Set the generation sizes accordingly
– Rule of thumb
• Young gen should be around 1x to 1.5x LDS
• Old gen should be around 2x to 3x LDS
• e.g., young gen should be around 1/3-1/4 of the heap size

• e.g., For LDS of 512m : -Xmn768m -Xms2g -Xmx2g
Hotspot JVM Heap Layout
For LDS of 512m : -Xmn768m -Xms2g -Xmx2g

-Xmn768m
-Xms2g –Xmx2g

Native
GC Fundamentals
Garbage Distribution – Objects die young

• Typical object (Young object) is most likely
to die shortly after it was created
– Example: Local objects

• Objects that have been around for a while
(Old objects) will likely stay around for a
while
– Example: Objects initialized at the time of
application startup

• Only a few references from old objects to
young objects exist

Oracle confidential; Pending legal review
GC Fundamentals
Garbage Distribution - Generational Collection

• Buckets ideally correspond to distribution curve
• Collect each bucket with most efficient algorithm
• Size buckets for best GC performance
Oracle confidential; Pending legal review
JVM Heap Tuning
• Young generation sizing is second most important
– -XX:NewSize=<n> -XX:MaxNewSize=<n>
– Fixed Size young generation and Fixed Size Heap can
provide better performance (less Full GC)
• Set NewSize = MaxNewSize
• Or, -Xmn<n> is a convenient option
– More scalable flag is -XX:NewRatio=<r>
http://blogs.sun.com/jonthecollector/entry/the_second_most_important_gc
Memory Leak
• How do you know there is memory leak?
• OOM (OutOfMemory) after a while (a few hours/a few days)
• Memory used for long lived objects increases over time
• Usually not a JVM problem, but a problem in application

Long lived
objects
JWorks GC Web (Beta)
http://jworks.idv.tw/GcWeb/
Types of Object Reference
• Strong references
– Normal

• SoftReference
– Used for cache
– GC’ed any time after there are no strong references to the referent,
but is typically retained until memory is low.

– Try to use -XX:SoftRefLRUPolicyMSPerMB=0
• WeakReference
– Used for cache
– GC’ed any time after there re no strong or soft references to the
referent.

• PhantomReference
– Used for housekeeping (without using finalize, don’t use
finalize)
Footprint
(Heap Size)

Throughput

Latencies
Throughput vs. Latency
• For most applications, GC overhead is small
– 2% – 5%

• Throughput GCs
– Move most work to GC pauses
– Application threads do as little as possible
– Least overall GC overhead

• Low Latency (Pause) GCs
– Move work out of GC pauses
– Application threads do more work
• Bookkeeping for GC more expensive
– More overall GC overhead
Application Requirement
• Different applications have different requirements
– Higher Throughput:
• Web application: pauses during garbage collection may be
tolerable, or simply obscured by network latencies
• Batch processing

– Lower Latencies:
• Interactive graphics application
HotSpot Garbage Collectors in Java SE 6
-XX:+UseParallelGC

-XX:+UseSerialGC
-XX:+UseParNewGC

G1
-XX:+UseG1GC

-XX:+UseConcMarkSweepGC

-XX:+UseParallelOldGC

http://blogs.sun.com/jonthecollector/entry/our_collectors
HotSpot Garbage Collectors in Java SE 6
-XX:+UseParallelGC

-XX:+UseSerialGC
-XX:+UseParNewGC

G1
-XX:+UseG1GC

-XX:+UseConcMarkSweepGC

-XX:+UseParallelOldGC

http://blogs.sun.com/jonthecollector/entry/our_collectors
Selecting Garbage Collectors
• Serial Collector (default for -client) (-XX:+UseSerialGC)
– Works well in single processor configuration
– Suitable for applications with small data sets
– Co-locating multiple instances of WLS(JVM's)
Serial Collector

Serial

App Thread

GC Thread
HotSpot Garbage Collectors in Java SE 6
-XX:+UseParallelGC

-XX:+UseSerialGC
-XX:+UseParNewGC

G1
-XX:+UseG1GC

-XX:+UseConcMarkSweepGC

-XX:+UseParallelOldGC

http://blogs.sun.com/jonthecollector/entry/our_collectors
Selecting Garbage Collectors
• Parallel Scavenge Collector (Throughput,
-XX:+UseParallelGC)
– Perform minor collections in parallel to improve performance
on multi-core and multi-threaded CPU's
– Designed for applications with medium to large data sets
– Control GC Threads using -XX:ParallelGCThreads=<n>
• By default, <n> is set to total number of “CPU’s”
– In JDK 5 Update 6, parallel compaction for old generation
was added (-XX:+UseParallelOldGC)
– Minimize garbage collection impact on throughput
– Parallel compaction is now default in JDK 6
• -XX:+UseParallelOldGC
Serial vs Parallel Collector

Serial

App Thread

GC Thread
HotSpot Garbage Collectors in Java SE 6
-XX:+UseParallelGC

-XX:+UseSerialGC
-XX:+UseParNewGC

G1
-XX:+UseG1GC

-XX:+UseConcMarkSweepGC

-XX:+UseParallelOldGC

http://blogs.sun.com/jonthecollector/entry/our_collectors
Selecting Garbage Collectors
• Low Latencies (Pause) Collector
(-XX:+UseConcMarkSweepGC)
– Execute the application concurrently during Full GC
– Constant response time on multi-CPU servers
– To improve throughput, use the following for young gen
• -XX:+UseParNewGC (and -XX:ParallelGCThreads=<n>)
CMS Collector

App Thread

GC Thread
CMS Collector with ParNewGC

App Thread

GC Thread
Hotspot JDK Heap Option Summary
Generation

Low Pause Collectors
1 CPU

Young

Serial
Copying
Collector
(default)

2+ CPUs
Parallel Copying
Collector
-XX:+UseParNewGC

Throughput Collectors
1 CPU

Serial
Copying
Collector
(default)

Heap Sizes

2+ CPUs
Parallel Scavenge
Collector

-XX:NewSize
-XX:MaxNewSize
-XX:SurvivorRatio

-XX:+UseParallelGC

Concurrent Collector
MarkCompact
Collector
(default)

Old

Permanent

XX:+UseConcMarkSwe
epGC

MarkCompact
Collector
(default)

Parallel Old

-Xms

-XX:+UseParallelOldGC

-Xmx

Can be turned off with –Xnoclassgc (use with care)

New G1 Collector as of WLS10.3.1/JDK 6 Update 14

-XX:PermSize
-XX:MaxPermSize
G1 Collector
• The Garbage-First Collector
–
–
–
–

–
–
–
–
–

Since JDK 6u14, officially supported as of JDK 7u4
-XX:+UseG1GC
Future CMS Replacement
Server “Style” low latency collector
• Parallel
• Concurrent
Generational
Good Throughput
Compacting
Improved ease-of-use
Predictable (Soft Real-Time)
G1 Collector
• The Garbage-First Collector
–
–
–
–

–
–
–
–
–

Since JDK 6u14, officially supported as of JDK 7u4
-XX:+UseG1GC
Future CMS Replacement
Server “Style” low latency collector
• Parallel
• Concurrent
Generational
Good Throughput
Compacting
Improved ease-of-use
Predictable (Soft Real-Time)
G1 Collector: Parallelism & Concurrency

App Thread

GC Thread
G1 – Garbage First
Heap Layout

Region Type

S

Eden

S
S

Survivor
Old
Free
CMS vs G1 Collectors

•

Heap split into regions

•

Young generation (A set of regions)

•

Old generation (A set of regions)
GC Comparison
GC Comparison
GC Comparison
G1 – Pros and Cons
• Pros
– Only one (concurrent) task needs to act on the whole heap
• Nice since heaps are getting larger and larger
– Parallel young and mixed collections
• Nice since machines tend to have more and more cores
– Has a lot of flexibility and built in heuristics for choosing
young generation and the collection set
– The only collector in Hotspot that is being actively developed

• Cons
– Heuristics in place but not fine tuned yet
– Has a larger memory footprint
– More concurrent work compared to other collectors
G1 - Targeted Use Cases
• Large heaps with limited GC latencies
– Typically ~6GB or larger heaps

• Applications that have
– Varied object allocation rate
– Undesired long GC or compaction pauses (greater than 0.5s)
and want to lower down the pauses time

• Tuning:
– Garbage First Garbage Collector Tuning
http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html

– Deep Dive into G1 Garbage Collector
http://www.infoq.com/presentations/java-g1
G1 - Currently Not Targeted Use Cases
• Applications with very low latency requirements
– Continue to use Deterministic GC or CMS

• Maximum throughput with no latency requirements
– Continue to use Throughput collector or Parallel/ParallelOld

• Applications that continuously load and unload
classes
References
• Step-by-Step: Garbage Collection Tuning in the Java
HotSpot™ Virtual Machine – JavaOne 2010
• The Garbage Collection Mythbusters – JavaOne 2010
• GC Tuning for the HotSpot JVM – JavaOne 2009
• http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html
Hotspot Resources
• Java Performance – Charlie Hunt, Binu John
Hotspot Tuning Book

• HotSpot GC Tuning Guide
for Java SE 6
http://www.oracle.com/technetwork/java/javase/gc-tuning-6140523.html

• Oracle University Training
Java SE Performance Tuning Ed 1

• Memory Management in the Java
HotSpot VM
http://www.oracle.com/technetwork/java/javase/memorymana
gement-whitepaper-150215.pdf

• Java 6 Performance Whitepaper
http://java.sun.com/performance/reference/whitepapers/6_performance.ht
ml

Oracle confidential; Pending legal review
Java (JRockit)
Mission Control
Java SE Advanced
New

• Both HotSpot and JRockit VMs under a
single license
• JRockit VM brings to the table
• Intuitive, user-friendly tooling for monitoring,
diagnosing and tuning a Java environment.
• Dynamic Memory Leak Detection

• Enterprise JRE features i.e. ability to
turn auto update off, and usage
tracking.

Java SE Advanced
* Oracle’s JRE
* JRockit JDKs
* Java(JRockit) Mission
Control
* Monitoring and
Management features
(including APIs for EM
integration)
Java (JRockit) Mission Control
After JDK1.7.0_40

• Monitor health and performance in production
• A suite of powerful tools for
– Performance Tuning
– Diagnostics
– Support
• Internal survey: 25% more efficient with JRMC

93
Java(JRockit) Mission Control

94
Java(JRockit) Mission Control

95
Java(JRockit) Mission Control
Profiling - Detect Hot Methods

96
Oracle Java(JRockit) Flight Recorder
The Problem: The ”Intermittent Cycle”

SLA
Breach

Server
restart

• [Sun 21:00]

• [Sun 24:00]

XXXX
Analyze
logs
• [Mon 09:30]

Turn on
detailed
logging
• [Tue 13:00]

Analyze
logs
• [Fri 09:00]

Turn off
detailed
logging
• [Fri 24:00]

Analyze Logs
and JFR
• [Mon 09:30]

98
How to use?

• Java 7 update 40 above
• Use following options to start the JMV which you want
to monitor:
– -XX:+UnlockCommercialFeatures
– -XX:+FlightRecorder
– -XX:FlightRecorderOptions=defaultrecording=true,
dumponexit=true,dumponexitpath=/tmp/dumponexit.jfr”

• Use Java Mission Control GUI (jmc) to analyze the
result
Introduction of Java GC Tuning and Java Java Mission Control
<Insert Picture Here>

Thank you!

More Related Content

What's hot (20)

PPTX
Apache Spark Architecture
Alexey Grishchenko
 
PPTX
AEM - Client Libraries
Prabhdeep Singh
 
PDF
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
OpenStack Korea Community
 
PDF
Common issues with Apache Kafka® Producer
confluent
 
PPT
Solr Presentation
Gaurav Verma
 
PPTX
Introduction to Storm
Chandler Huang
 
PDF
Alfresco Backup and Disaster Recovery White Paper
Toni de la Fuente
 
PDF
PHP unserialization vulnerabilities: What are we missing?
Sam Thomas
 
PDF
WebSockets with Spring 4
Sergi Almar i Graupera
 
PPTX
Alfresco DevCon 2019 Performance Tools of the Trade
Luis Colorado
 
PDF
Hudi architecture, fundamentals and capabilities
Nishith Agarwal
 
PDF
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Databricks
 
PPTX
Discover Quarkus and GraalVM
Romain Schlick
 
PDF
Spring Framework - AOP
Dzmitry Naskou
 
PPTX
Oracle Database in-Memory Overivew
Maria Colgan
 
PDF
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
 
PDF
Migrating ETL Workflow to Apache Spark at Scale in Pinterest
Databricks
 
PDF
Building robust CDC pipeline with Apache Hudi and Debezium
Tathastu.ai
 
PPTX
Choosing an HDFS data storage format- Avro vs. Parquet and more - StampedeCon...
StampedeCon
 
PDF
Exception handling
Anna Pietras
 
Apache Spark Architecture
Alexey Grishchenko
 
AEM - Client Libraries
Prabhdeep Singh
 
[OpenInfra Days Korea 2018] Day 2 - CEPH 운영자를 위한 Object Storage Performance T...
OpenStack Korea Community
 
Common issues with Apache Kafka® Producer
confluent
 
Solr Presentation
Gaurav Verma
 
Introduction to Storm
Chandler Huang
 
Alfresco Backup and Disaster Recovery White Paper
Toni de la Fuente
 
PHP unserialization vulnerabilities: What are we missing?
Sam Thomas
 
WebSockets with Spring 4
Sergi Almar i Graupera
 
Alfresco DevCon 2019 Performance Tools of the Trade
Luis Colorado
 
Hudi architecture, fundamentals and capabilities
Nishith Agarwal
 
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Databricks
 
Discover Quarkus and GraalVM
Romain Schlick
 
Spring Framework - AOP
Dzmitry Naskou
 
Oracle Database in-Memory Overivew
Maria Colgan
 
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
 
Migrating ETL Workflow to Apache Spark at Scale in Pinterest
Databricks
 
Building robust CDC pipeline with Apache Hudi and Debezium
Tathastu.ai
 
Choosing an HDFS data storage format- Avro vs. Parquet and more - StampedeCon...
StampedeCon
 
Exception handling
Anna Pietras
 

Viewers also liked (20)

PDF
JVM及其调优
zhongbing liu
 
PDF
淺談 Java GC 原理、調教和 新發展
Leon Chen
 
PDF
How long can you afford to Stop The World?
Java Usergroup Berlin-Brandenburg
 
PPTX
Java GC
Ray Cheng
 
PDF
Java GC Tuning
pprun
 
PPT
Core Java Slides
Vinit Vyas
 
PDF
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Volha Banadyseva
 
DOC
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
sidg75
 
PDF
Analiza kwalifikacji pracownikow kluczem do sukcesu biznesowego, Tomasz Zubrz...
Ewa Stepien
 
PPTX
Sun jdk 1.6内存管理 -使用篇
bluedavy lin
 
PPTX
Jvm基础调优实践(v1.0)
ddviplinux
 
PPTX
Hadoop world g1_gc_forh_base_v4
YanpingWang
 
PDF
Moving to g1 gc by Kirk Pepperdine.
J On The Beach
 
PPTX
Java7 Garbage Collector G1
Dmitry Buzdin
 
PDF
Clojure - An Introduction for Java Programmers
elliando dias
 
PDF
How to Become a Winner in the JVM Performance-Tuning Battle
Capgemini
 
PDF
Nginx+tomcat https 配置
诸葛修车网-诸葛商城
 
PDF
Java多线程技术
诸葛修车网-诸葛商城
 
PDF
如何更好地设计测试用例-BQConf
诸葛修车网-诸葛商城
 
PPT
Recipe 黃佳伶 葉愛慧
10y2try
 
JVM及其调优
zhongbing liu
 
淺談 Java GC 原理、調教和 新發展
Leon Chen
 
How long can you afford to Stop The World?
Java Usergroup Berlin-Brandenburg
 
Java GC
Ray Cheng
 
Java GC Tuning
pprun
 
Core Java Slides
Vinit Vyas
 
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Volha Banadyseva
 
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
sidg75
 
Analiza kwalifikacji pracownikow kluczem do sukcesu biznesowego, Tomasz Zubrz...
Ewa Stepien
 
Sun jdk 1.6内存管理 -使用篇
bluedavy lin
 
Jvm基础调优实践(v1.0)
ddviplinux
 
Hadoop world g1_gc_forh_base_v4
YanpingWang
 
Moving to g1 gc by Kirk Pepperdine.
J On The Beach
 
Java7 Garbage Collector G1
Dmitry Buzdin
 
Clojure - An Introduction for Java Programmers
elliando dias
 
How to Become a Winner in the JVM Performance-Tuning Battle
Capgemini
 
Nginx+tomcat https 配置
诸葛修车网-诸葛商城
 
Java多线程技术
诸葛修车网-诸葛商城
 
如何更好地设计测试用例-BQConf
诸葛修车网-诸葛商城
 
Recipe 黃佳伶 葉愛慧
10y2try
 
Ad

Similar to Introduction of Java GC Tuning and Java Java Mission Control (20)

PDF
Taming The JVM
Matthew McCullough
 
PDF
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
PDF
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
PDF
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
Monica Beckwith
 
PPTX
JVM Magic
Baruch Sadogursky
 
PDF
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
Haim Yadid
 
PPTX
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko
 
PPTX
Jvm problem diagnostics
Danijel Mitar
 
PDF
Basics of JVM Tuning
Vladislav Gangan
 
PDF
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
PDF
Jvm is-your-friend
ColdFusionConference
 
PDF
The JVM is your friend
Kai Koenig
 
PDF
Java Performance and Using Java Flight Recorder
Isuru Perera
 
PPTX
Java Memory Management Tricks
GlobalLogic Ukraine
 
PDF
JVM Performance Tuning
Jeremy Leisy
 
PDF
JVM and Garbage Collection Tuning
Kai Koenig
 
PPTX
Java gc and JVM optimization
Rajan Jethva
 
PDF
Java Performance and Profiling
WSO2
 
PPTX
jvm.pptx
senthilnathan662693
 
PDF
Tomcatx troubleshooting-production
Vladimir Khokhryakov
 
Taming The JVM
Matthew McCullough
 
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
Monica Beckwith
 
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
Haim Yadid
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko
 
Jvm problem diagnostics
Danijel Mitar
 
Basics of JVM Tuning
Vladislav Gangan
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
Jvm is-your-friend
ColdFusionConference
 
The JVM is your friend
Kai Koenig
 
Java Performance and Using Java Flight Recorder
Isuru Perera
 
Java Memory Management Tricks
GlobalLogic Ukraine
 
JVM Performance Tuning
Jeremy Leisy
 
JVM and Garbage Collection Tuning
Kai Koenig
 
Java gc and JVM optimization
Rajan Jethva
 
Java Performance and Profiling
WSO2
 
Tomcatx troubleshooting-production
Vladimir Khokhryakov
 
Ad

Recently uploaded (20)

PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Digital Circuits, important subject in CS
contactparinay1
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 

Introduction of Java GC Tuning and Java Java Mission Control

  • 1. <Insert Picture Here> Introduction of Java GC Tuning and Java Java Mission Control Leon Chen (陳逸嘉) Principal Sales Consultant Oracle
  • 2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 3. Leon Chen (陳逸嘉) • More than 14 years in Java/JEE, as programmer, architect, leader and consultant, in finance/telecom domain. • • • • • 工研院 得捷 新光人壽 Ericsson Oracle
  • 4. • TW Patent 182927, 一種文章切割方法, 2003, 陳逸嘉, 林一中 • TW Patent 206819, 自動服務組合方法及系統, 2004, 陳逸嘉, 許 維德, 洪鵬翔 • US Patent 7,617,174, Method and system for automatic service composition, 2009, Leon Chen, Wei-Tek Hsu, PengHsiang Hung
  • 7. Java SE Roadmap JDK 8 (Q1 2014) 7u40 7u21 • Java Client Security Enhancements • App Store Packaging tools • Java Flight Recorder • Java Mission Control 5.2 • Java Discovery Protocol • Native memory tracking • Local Security Policy 2013 • Lambda • JVM Convergence • JavaScript Interop • JavaFX 8 • 3D API • Java SE Embedded support • Enhanced HTML5 support JDK 9 • Modularity – Jigsaw • Interoperability • Cloud • Ease of Use • JavaFX JSR • Optimizations JDK 8u40 2014 2015 2016 NetBeans IDE 7.3 NetBeans IDE 8 JDK 8u20 NetBeans IDE 9 • New hints and refactoring • Scene Builder Support • JDK 8 support • Scene Builder 2.0 support • Deterministic G1 • Java Mission Control 6.0 • Improved JRE installer • App bundling enhancements • JDK 9 support • Scene Builder 3.0 support Scene Builder 2.0 Scene Builder 1.1 • Linux support • JavaFX 8 support • Enhanced Java IDE support Scene Builder 3.0 • JavaFX 9 support
  • 9. 32-bit VS. 64-bit • 32-bit • For heap sizes up to 2.5G/3G or so • 64-bit • Windows/Linux: different JVM, Solaris: add -d64 • -XX:+UseCompressedOops (default JDK6_23+) • Compressed references: 32GB Max (26GB best) • -Xmx: 26G (compressed) / unlimited (regular) • 32-bit  64-bit migration • Higher heap size requirements (around 20%) • Slight throughput impact (without compressed refs) • 64-bit preferred for today’s servers • Only option starting with Fusion Middleware 12c
  • 10. Java Memory Management Reference video: http://www.youtube.com/watch?v=VQ4eZw6eVtQ
  • 11. class Test { private List<User> userList = new ArrayList<User>(); … public void execute() { User user = new User(); userList.add(user); … user = null; //No use } … }
  • 16. Tracing GC Example Runtime Stack Heap A G D H E I L F B C J M We identified all reachable objects. We can deduce that the rest are unreachable and, therefore, dead. K
  • 17. Tracing GC Example Runtime Stack Heap A C K H B E I We identified all reachable objects. We can deduce that the rest are unreachable and, therefore, dead. L
  • 20. 花太多時間做 GC → Performance變慢 Performance變慢→花太多時間做 GC 不一定!!!
  • 21. JVM Performance Tuning Performance Tuning Process Oracle confidential; Pending legal review
  • 22. GC Logging in Production • Don’t be afraid to enable GC logging in production – Very helpful when diagnosing production issues • Extremely low / non-existent overhead – Maybe some large files in your file system. – We are surprised that customers are still afraid to enable it
  • 23. If Someone doesn’t enable GC logging in production I shoot them!
  • 24. Most Important GC Logging Parameters • You need at least: – -XX:+PrintGCTimeStamps • Add -XX:+PrintGCDateStamps if you must know the time – -XX:+PrintGCDetails • Preferred over -verbosegc as it's more detailed • Also useful: – -Xloggc:<file> – Rotate GC Log, After Java 1.6_34 (or 1.7_2): -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10M
  • 25. JVM Performance Tuning GCViewer – Offline analysis of GC logs https://github.com/chewiebug/GCViewer
  • 26. JVM Performance Tuning GCViewer – Memory Leak Pattern
  • 27. JWorks GC Web (Beta) http://jworks.idv.tw/GcWeb/
  • 29. Hotspot JVM Heap Layout Total memory, for 32bits, max = 2^32 = 4GB. In windows is 2GB, so max JVM Heap is about 1.6GB ~ 1.8GB Native Young Old Young Generation – Eden where new objects get instantiated – 2 Survivor Spaces to hold live objects during minor GC Old Generation – For tenured objects Permanent Generation – JVM meta data
  • 30. Constraints of 32 Bits JVM • Normal Windows (2GB process memory) – ~1.5GB possible Java heap memory • Windows started with /3GB (3GB process memory) – ~2.8GB possible Java heap memory (2.6 or 2.7 GB recommended with WLS) • Linux, large process support enabled (3GB process memory) – ~2,8GB possible Java heap memory
  • 31. Hotspot Internals Generations & Object Lifecycle Eden S0 S1
  • 42. Hotspot Tuning Sizing Heap • Young Generation size determines • Frequency of minor GC • Number of objects reclaimed in minor GC • Old Generation Size • Should hold application's steady-state live data size • Try to minimize frequency of major GC’s • JVM footprint should not exceed physical memory • Max of 80-90% RAM (leave room for OS) • Thumb Rule: Try to maximize objects reclaimed in young gen. Minimize Full GC frequency
  • 43. Calculate Live Data Size (LDS) • Make sure you get full GCs during steady-state • Induce a couple if necessary • JConsole / VisualVM • Connect to the JVM, click on the “Perform GC” button • jmap • jmap -histo:live <pid> • Can even introduce a thread that does regular System.gc()'s • Just for this data gathering purpose, OK? Remove it before deployment. :-)
  • 44. Calculate Live Data Size (ii) • From the GC log you will get – Approximation of the Live Data Size (LDS) • It is the heap occupancy after each full GC – Approximation of max perm gen size • It is the perm gen occupancy after each full GC – Worst-case latency scenario due to the full GCs • GC log example:
  • 45. GC Triggered Heap Usage Size of ”long lived objects” Max Java Heap
  • 46. Initial Heap Configuration • You can now make an informed decision on choosing a reasonable heap size – Rule of thumb • Set -Xms and -Xmx to 3x to 4x LDS • Set both -XX:PermSize and -XX:MaxPermSize to around 1.2x to 1.5x the max perm gen size • Set the generation sizes accordingly – Rule of thumb • Young gen should be around 1x to 1.5x LDS • Old gen should be around 2x to 3x LDS • e.g., young gen should be around 1/3-1/4 of the heap size • e.g., For LDS of 512m : -Xmn768m -Xms2g -Xmx2g
  • 47. Hotspot JVM Heap Layout For LDS of 512m : -Xmn768m -Xms2g -Xmx2g -Xmn768m -Xms2g –Xmx2g Native
  • 48. GC Fundamentals Garbage Distribution – Objects die young • Typical object (Young object) is most likely to die shortly after it was created – Example: Local objects • Objects that have been around for a while (Old objects) will likely stay around for a while – Example: Objects initialized at the time of application startup • Only a few references from old objects to young objects exist Oracle confidential; Pending legal review
  • 49. GC Fundamentals Garbage Distribution - Generational Collection • Buckets ideally correspond to distribution curve • Collect each bucket with most efficient algorithm • Size buckets for best GC performance Oracle confidential; Pending legal review
  • 50. JVM Heap Tuning • Young generation sizing is second most important – -XX:NewSize=<n> -XX:MaxNewSize=<n> – Fixed Size young generation and Fixed Size Heap can provide better performance (less Full GC) • Set NewSize = MaxNewSize • Or, -Xmn<n> is a convenient option – More scalable flag is -XX:NewRatio=<r> http://blogs.sun.com/jonthecollector/entry/the_second_most_important_gc
  • 51. Memory Leak • How do you know there is memory leak? • OOM (OutOfMemory) after a while (a few hours/a few days) • Memory used for long lived objects increases over time • Usually not a JVM problem, but a problem in application Long lived objects
  • 52. JWorks GC Web (Beta) http://jworks.idv.tw/GcWeb/
  • 53. Types of Object Reference • Strong references – Normal • SoftReference – Used for cache – GC’ed any time after there are no strong references to the referent, but is typically retained until memory is low. – Try to use -XX:SoftRefLRUPolicyMSPerMB=0 • WeakReference – Used for cache – GC’ed any time after there re no strong or soft references to the referent. • PhantomReference – Used for housekeeping (without using finalize, don’t use finalize)
  • 55. Throughput vs. Latency • For most applications, GC overhead is small – 2% – 5% • Throughput GCs – Move most work to GC pauses – Application threads do as little as possible – Least overall GC overhead • Low Latency (Pause) GCs – Move work out of GC pauses – Application threads do more work • Bookkeeping for GC more expensive – More overall GC overhead
  • 56. Application Requirement • Different applications have different requirements – Higher Throughput: • Web application: pauses during garbage collection may be tolerable, or simply obscured by network latencies • Batch processing – Lower Latencies: • Interactive graphics application
  • 57. HotSpot Garbage Collectors in Java SE 6 -XX:+UseParallelGC -XX:+UseSerialGC -XX:+UseParNewGC G1 -XX:+UseG1GC -XX:+UseConcMarkSweepGC -XX:+UseParallelOldGC http://blogs.sun.com/jonthecollector/entry/our_collectors
  • 58. HotSpot Garbage Collectors in Java SE 6 -XX:+UseParallelGC -XX:+UseSerialGC -XX:+UseParNewGC G1 -XX:+UseG1GC -XX:+UseConcMarkSweepGC -XX:+UseParallelOldGC http://blogs.sun.com/jonthecollector/entry/our_collectors
  • 59. Selecting Garbage Collectors • Serial Collector (default for -client) (-XX:+UseSerialGC) – Works well in single processor configuration – Suitable for applications with small data sets – Co-locating multiple instances of WLS(JVM's)
  • 61. HotSpot Garbage Collectors in Java SE 6 -XX:+UseParallelGC -XX:+UseSerialGC -XX:+UseParNewGC G1 -XX:+UseG1GC -XX:+UseConcMarkSweepGC -XX:+UseParallelOldGC http://blogs.sun.com/jonthecollector/entry/our_collectors
  • 62. Selecting Garbage Collectors • Parallel Scavenge Collector (Throughput, -XX:+UseParallelGC) – Perform minor collections in parallel to improve performance on multi-core and multi-threaded CPU's – Designed for applications with medium to large data sets – Control GC Threads using -XX:ParallelGCThreads=<n> • By default, <n> is set to total number of “CPU’s” – In JDK 5 Update 6, parallel compaction for old generation was added (-XX:+UseParallelOldGC) – Minimize garbage collection impact on throughput – Parallel compaction is now default in JDK 6 • -XX:+UseParallelOldGC
  • 63. Serial vs Parallel Collector Serial App Thread GC Thread
  • 64. HotSpot Garbage Collectors in Java SE 6 -XX:+UseParallelGC -XX:+UseSerialGC -XX:+UseParNewGC G1 -XX:+UseG1GC -XX:+UseConcMarkSweepGC -XX:+UseParallelOldGC http://blogs.sun.com/jonthecollector/entry/our_collectors
  • 65. Selecting Garbage Collectors • Low Latencies (Pause) Collector (-XX:+UseConcMarkSweepGC) – Execute the application concurrently during Full GC – Constant response time on multi-CPU servers – To improve throughput, use the following for young gen • -XX:+UseParNewGC (and -XX:ParallelGCThreads=<n>)
  • 67. CMS Collector with ParNewGC App Thread GC Thread
  • 68. Hotspot JDK Heap Option Summary Generation Low Pause Collectors 1 CPU Young Serial Copying Collector (default) 2+ CPUs Parallel Copying Collector -XX:+UseParNewGC Throughput Collectors 1 CPU Serial Copying Collector (default) Heap Sizes 2+ CPUs Parallel Scavenge Collector -XX:NewSize -XX:MaxNewSize -XX:SurvivorRatio -XX:+UseParallelGC Concurrent Collector MarkCompact Collector (default) Old Permanent XX:+UseConcMarkSwe epGC MarkCompact Collector (default) Parallel Old -Xms -XX:+UseParallelOldGC -Xmx Can be turned off with –Xnoclassgc (use with care) New G1 Collector as of WLS10.3.1/JDK 6 Update 14 -XX:PermSize -XX:MaxPermSize
  • 69. G1 Collector • The Garbage-First Collector – – – – – – – – – Since JDK 6u14, officially supported as of JDK 7u4 -XX:+UseG1GC Future CMS Replacement Server “Style” low latency collector • Parallel • Concurrent Generational Good Throughput Compacting Improved ease-of-use Predictable (Soft Real-Time)
  • 70. G1 Collector • The Garbage-First Collector – – – – – – – – – Since JDK 6u14, officially supported as of JDK 7u4 -XX:+UseG1GC Future CMS Replacement Server “Style” low latency collector • Parallel • Concurrent Generational Good Throughput Compacting Improved ease-of-use Predictable (Soft Real-Time)
  • 71. G1 Collector: Parallelism & Concurrency App Thread GC Thread
  • 72. G1 – Garbage First Heap Layout Region Type S Eden S S Survivor Old Free
  • 73. CMS vs G1 Collectors • Heap split into regions • Young generation (A set of regions) • Old generation (A set of regions)
  • 77. G1 – Pros and Cons • Pros – Only one (concurrent) task needs to act on the whole heap • Nice since heaps are getting larger and larger – Parallel young and mixed collections • Nice since machines tend to have more and more cores – Has a lot of flexibility and built in heuristics for choosing young generation and the collection set – The only collector in Hotspot that is being actively developed • Cons – Heuristics in place but not fine tuned yet – Has a larger memory footprint – More concurrent work compared to other collectors
  • 78. G1 - Targeted Use Cases • Large heaps with limited GC latencies – Typically ~6GB or larger heaps • Applications that have – Varied object allocation rate – Undesired long GC or compaction pauses (greater than 0.5s) and want to lower down the pauses time • Tuning: – Garbage First Garbage Collector Tuning http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html – Deep Dive into G1 Garbage Collector http://www.infoq.com/presentations/java-g1
  • 79. G1 - Currently Not Targeted Use Cases • Applications with very low latency requirements – Continue to use Deterministic GC or CMS • Maximum throughput with no latency requirements – Continue to use Throughput collector or Parallel/ParallelOld • Applications that continuously load and unload classes
  • 81. • Step-by-Step: Garbage Collection Tuning in the Java HotSpot™ Virtual Machine – JavaOne 2010 • The Garbage Collection Mythbusters – JavaOne 2010 • GC Tuning for the HotSpot JVM – JavaOne 2009 • http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html
  • 82. Hotspot Resources • Java Performance – Charlie Hunt, Binu John Hotspot Tuning Book • HotSpot GC Tuning Guide for Java SE 6 http://www.oracle.com/technetwork/java/javase/gc-tuning-6140523.html • Oracle University Training Java SE Performance Tuning Ed 1 • Memory Management in the Java HotSpot VM http://www.oracle.com/technetwork/java/javase/memorymana gement-whitepaper-150215.pdf • Java 6 Performance Whitepaper http://java.sun.com/performance/reference/whitepapers/6_performance.ht ml Oracle confidential; Pending legal review
  • 84. Java SE Advanced New • Both HotSpot and JRockit VMs under a single license • JRockit VM brings to the table • Intuitive, user-friendly tooling for monitoring, diagnosing and tuning a Java environment. • Dynamic Memory Leak Detection • Enterprise JRE features i.e. ability to turn auto update off, and usage tracking. Java SE Advanced * Oracle’s JRE * JRockit JDKs * Java(JRockit) Mission Control * Monitoring and Management features (including APIs for EM integration)
  • 85. Java (JRockit) Mission Control After JDK1.7.0_40 • Monitor health and performance in production • A suite of powerful tools for – Performance Tuning – Diagnostics – Support • Internal survey: 25% more efficient with JRMC 93
  • 88. Java(JRockit) Mission Control Profiling - Detect Hot Methods 96
  • 90. The Problem: The ”Intermittent Cycle” SLA Breach Server restart • [Sun 21:00] • [Sun 24:00] XXXX Analyze logs • [Mon 09:30] Turn on detailed logging • [Tue 13:00] Analyze logs • [Fri 09:00] Turn off detailed logging • [Fri 24:00] Analyze Logs and JFR • [Mon 09:30] 98
  • 91. How to use? • Java 7 update 40 above • Use following options to start the JMV which you want to monitor: – -XX:+UnlockCommercialFeatures – -XX:+FlightRecorder – -XX:FlightRecorderOptions=defaultrecording=true, dumponexit=true,dumponexitpath=/tmp/dumponexit.jfr” • Use Java Mission Control GUI (jmc) to analyze the result