SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.1
Java Flight Recorder
Behind the Scenes
Staffan Larsen
Java SE Serviceability Architect
staffan.larsen@oracle.com
@stalar
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.3
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.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.4
Java Flight Recorder
§  Tracer and Profiler
§  Non-intrusive
§  Built into the JVM itself
§  On-demand profiling
§  After-the-fact capture and analysis
§  First released in 7u40
Photograph by Jeffrey Milstein
http://butdoesitfloat.com/In-the-presence-of-massive-gravitational-fields-this-perfect
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.5
Tracer and Profiler
§  Captures both JVM and application data
–  Garbage Collections
–  Synchronization
–  Compiler
–  CPU Usage
–  Exceptions
–  I/O
§  Sampling-based profiler
–  Very low overhead
–  Accurate data
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.6
Non-Intrusive
§  Typical overhead in benchmarks: 2-3% (!)
§  Often not noticeable in typical production environments
§  Turn on and off in runtime
§  Information already available in the JVM
–  Zero extra cost
Photograph: Andrew Rivett
http://www.flickr.com/photos/veggiefrog/3435380297/
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.7
Built into the JVM itself
§  Core of JFR is inside the JVM
§  Can easily interact with other JVM subsystems
§  Optimized C++ code
§  Supporting functionality written in Java
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.8
On-Demand Profiling
§  Start from Java Mission Control
–  Or from the command line
§  Easily configure the amount of information to
capture
§  For a profile, a higher overhead can be
acceptable
§  When done, no overhead
§  Powerful GUI for analysis
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.9
After-the-Fact Analysis
§  In its default mode, very low overhead
§  Designed to be always-on
§  Uses circular buffers to store data
–  In-memory or on-disk
§  When an SLA breach is detected, dump the current buffers
§  Dump will have information leading up to the problem
n
n+1
n+2n+3
n+4
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.10
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.11
Agenda
§  Overview of JFR
§  Demo!
§  Configuration topics
§  Implementation details
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12
Configuration
§  Enable
-­‐XX:+UnlockCommercialFeatures	
  -­‐XX:+FlightRecorder	
  
§  Start
-­‐XX:StartFlightRecording=filename=<path>,duration=<time>	
  
§  Or
jcmd	
  <pid>	
  JFR.start	
  filename=<path>	
  duration=<time>	
  
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.13
Advanced Configuration
Per Recording Session
Max age of data maxage=<time>
Max size to keep maxsize=<size>
Global Settings (-XX:FlightRecorderOptions)
Max stack trace depth stackdepth=<n> (default 64)
Save recording on exit dumponexit=true
Logging loglevel=[ERROR|WARN|INFO|
DEBUG|TRACE]
Repository path repository=<path>
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.14
Recording Sessions
§  Recordings can specify exactly which information to capture
–  ~80 events with 3 settings each
§  But: two preconfigured settings
–  “default”: provides as much information as possible while keeping
overhead to a minimum
–  “profile”: has more information, but also higher overhead
§  You can configure your own favorites in Mission Control
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.15
Many Simultaneous Recording Sessions
§  This works great
§  Each session can have its own settings
§  Caveat: If there are multiple sessions all of them get the union of the
enabled events
–  Ex: If event A is enabled in on recording, all recordings will see event A
–  Ex: If event B has two different thresholds, the lower value will apply
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.16
JVM
How Is It Built?
§  Information gathering
–  Instrumentation calls all over the
JVM
–  Application information via Java
API
§  Collected in Thread Local buffers
⇢ Global Buffers ⇢Disk
§  Binary, proprietary file format
§  Managed via JMX
JFR
Thread
Buffers
Disk
JMX Java API
Global
Buffers
GC RuntimeCompiler
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.17
“Everything Is an Event”
§  Header
§  Payload
–  Event specific data
Event ID
End Time
Start Time
Thread ID
StackTrace ID
Payload
Header
Optional
Size
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.18
Event Types
§  Instant
–  Single point in time
–  Ex: Thread starts
§  Duration
–  Timing for something
–  Ex: GC
§  Requestable
–  Happens with a specified frequency
–  Ex: CPU Usage every second
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.19
Event Meta Data
§  For every event
–  Name, Path, Description
§  For every payload item
–  Name, Type, Description, Content Type
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.20
“Content Type”
§  Describes the semantics of a value
§  Used to correctly display the value in the UI
Content Type Displayed as
Bytes 4 MB
Percentage 34 %
Address 0x23CDA540
Millis 17 ms
Nanos 4711 ns
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21
Event Definition in Hotspot
<event 	
  id="ThreadSleep"	
  	
  	
  
	
  path="java/thread_sleep"	
  
	
  label="Java	
  Thread	
  Sleep"	
  ...>	
  
	
  	
  	
  <value 	
  field="time"	
  	
  
	
  type="MILLIS"	
  	
  
	
  label="Sleep	
  Time"/>	
  
</event>	
  
§  XML definitions are processed into C++ classes
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.22
Event Emission in Hotspot
JVM_Sleep(int	
  millis)	
  {	
  
	
  	
   	
  EventThreadSleep	
  event;	
  
	
  
	
  	
   	
  ...	
  //	
  actual	
  sleep	
  happens	
  here	
  
	
  	
  
	
   	
  event.set_time(millis);	
  
	
   	
  event.commit();	
  
}	
  
	
  
§  Done! Data is now available in JFR
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.23
Thread Park
<event	
  id="ThreadPark"	
  path="java/thread_park"	
  
	
  	
  	
  	
  	
  	
  label="Java	
  Thread	
  Park"	
  
	
  	
  	
  	
  	
  	
  has_thread="true"	
  has_stacktrace="true"	
  is_instant="false">	
  
	
  	
  	
  <value	
  type="CLASS"	
  field="klass"	
  label="Class	
  Parked	
  On"/>	
  
	
  	
  	
  <value	
  type="MILLIS"	
  field="timeout"	
  label="Park	
  Timeout"/>	
  
	
  	
  	
  <value	
  type="ADDRESS"	
  field="address"	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  label="Address	
  of	
  Object	
  Parked"/>	
  
</event>	
  
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.24
Thread Park
UnsafePark(jboolean	
  isAbsolute,	
  jlong	
  time)	
  {	
  
	
  	
  EventThreadPark	
  event;	
  
	
  	
  JavaThreadParkedState	
  jtps(thread,	
  time	
  !=	
  0);	
  
	
  	
  thread-­‐>parker()-­‐>park(isAbsolute	
  !=	
  0,	
  time);	
  
	
  	
  if	
  (event.should_commit())	
  {	
  
	
  	
  	
  	
  oop	
  obj	
  =	
  thread-­‐>current_park_blocker();	
  
	
  	
  	
  	
  event.set_klass(obj	
  ?	
  obj-­‐>klass()	
  :	
  NULL);	
  
	
  	
  	
  	
  event.set_timeout(time);	
  
	
  	
  	
  	
  event.set_address(obj	
  ?	
  (TYPE_ADDRESS)obj	
  :	
  0);	
  
	
  	
  	
  	
  event.commit();	
  
	
  	
  }	
  
}	
  
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.25
Event Graph
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.26
Event Details
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.27
Buffers
§  “Circular”
§  Designed for low contention
Thread
Local
Buffers
Global
Buffers
Disk
Chunk
Repository
JVM
Java
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.28
Filtering Early
§  Enable/disable event
§  Thresholds
–  Only if duration is longer than X
§  Enable/disable stack trace
§  Frequency
–  Sample every X
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.29
File Format
§  Self-contained
–  Everything needed to parse an event is included in the file
–  New events instantly viewable in the UI
§  Binary, proprietary
§  Designed for fast writing
§  Single file, no dependencies
Event Records Event Definitions …Header
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.30
Dynamic Runtime and Long-Running
Recordings
§  Can’t leak memory
–  Can’t aggregate information eternally
–  Can’t keep references that prohibits class unloading
§  Dynamic Runtime
–  Classes can come and go
–  Threads can come and go
§  Solutions: Constant Pools, Checkpoints
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.31
Problem: Many Events Reference Classes
§  If every event contained the class name as a string, we would waste
lots of space
§  Solution: Class IDs
class	
  Klass	
  {	
  
	
  	
  	
  …	
  
	
  	
  	
  u8	
  _trace_id;	
  
	
  	
  	
  …	
  
}	
  
17event id
class
count
java.lang.Integer
2
…
17event id
class
count
4711
2
…
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.32
Problem: When Do We Write the Class IDs?
§  IDs need to be part of the file
§  Classes can be unloaded at any time
–  Class may not be around until end of recording
§  Solution: write Class ID when classes are unloaded
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.33
Problem: Size of the Class List
§  Many classes are loaded, not all are referenced in events, we want to
save space
§  Solution: when a class ID is referenced, the class is also “tagged”
–  Write only tagged classes in the JFR file
#define	
  CLASS_USED	
  1	
  
	
  
void	
  use_class_id(Klass*	
  const	
  klass)	
  {	
  
	
  	
  klass-­‐>_trace_id	
  |=	
  CLASS_USED;	
  
}	
  
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.34
Problem: Leaking Memory
§  Over time many classes will be tagged, the size of the class list will
increase
§  Solution: reset the tags each time a class list is written to disk
§  We call this a “Checkpoint”
§  A recording file may contain many class lists, each one is only valid for
the data immediately preceding it
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.35
Constant Pools
§  The Class List is a special case of a Constant Pool
§  Classes
§  Methods
§  Threads
§  Thread Groups
§  Stack Traces
§  Strings
class_pool.lookup(4711)	
  
	
  	
  ➞	
  java.lang.Integer	
  
	
  
method_pool.lookup(1729)	
  
	
  	
  ➞	
  java.lang.Math:pow()	
  
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.36
Checkpoints
§  At regular intervals, a “checkpoint” is
created in the recording
§  Has everything needed to parse the
recording since the last checkpoint
checkpoint =
events
+ constant pools
+ event meta-data
events
constant pools
meta-data
checkpoint
JFR File
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.37
Optimizations
§  Fast Timestamps
–  Fast, high resolution CPU time where available
–  Invariant TSC instructions
§  Stack Traces
–  Each event stores the thread’s stack trace
–  Pool of stack traces
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.38
Differences vs. JRockit
§  I/O: File path, Socket address
§  Exceptions
§  Reverse call trace view in Mission Control
§  Easier configuration in Mission Control
§  Deeper (configurable) stack traces
§  Internal JVM differences: GC
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.39
More Information
§  Whitepaper
http://www.oracle.com/missioncontrol
§  User Guide
http://docs.oracle.com/javase/7/docs/technotes/guides/jfr/index.html
§  Forum
https://forums.oracle.com/community/developer/english/java/
java_hotspot_virtual_machine/java_mission_control
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.40
-­‐XX:+UnlockCommercialFeatures	
  	
  
-­‐XX:+FlightRecorder	
  
Remember
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.41
@stalar
staffan.larsen@oracle.com
serviceability-dev@openjdk.java.net
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.42

Contenu connexe

Tendances

トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...
トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...
トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...NTT DATA Technology & Innovation
 
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)NTT DATA Technology & Innovation
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)Roman Kharkovski
 
Unboundの最適化(OSC2011 Tokyo/Spring)
Unboundの最適化(OSC2011 Tokyo/Spring)Unboundの最適化(OSC2011 Tokyo/Spring)
Unboundの最適化(OSC2011 Tokyo/Spring)Takashi Takizawa
 
Running Kafka as a Native Binary Using GraalVM with Ozan Günalp
Running Kafka as a Native Binary Using GraalVM with Ozan GünalpRunning Kafka as a Native Binary Using GraalVM with Ozan Günalp
Running Kafka as a Native Binary Using GraalVM with Ozan GünalpHostedbyConfluent
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링OpenStack Korea Community
 
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3オラクルエンジニア通信
 
Learn Oracle WebLogic Server 12c Administration
Learn Oracle WebLogic Server 12c AdministrationLearn Oracle WebLogic Server 12c Administration
Learn Oracle WebLogic Server 12c AdministrationRevelation Technologies
 
Weblogic Server Overview Weblogic Scripting Tool
Weblogic Server Overview Weblogic Scripting ToolWeblogic Server Overview Weblogic Scripting Tool
Weblogic Server Overview Weblogic Scripting ToolGokhan Fazli Celik
 
シンプルでシステマチックな Oracle Database, Exadata 性能分析
シンプルでシステマチックな Oracle Database, Exadata 性能分析シンプルでシステマチックな Oracle Database, Exadata 性能分析
シンプルでシステマチックな Oracle Database, Exadata 性能分析Yohei Azekatsu
 
Why Splunk Chose Pulsar_Karthik Ramasamy
Why Splunk Chose Pulsar_Karthik RamasamyWhy Splunk Chose Pulsar_Karthik Ramasamy
Why Splunk Chose Pulsar_Karthik RamasamyStreamNative
 
Oracle databáze – Konsolidovaná Data Management Platforma
Oracle databáze – Konsolidovaná Data Management PlatformaOracle databáze – Konsolidovaná Data Management Platforma
Oracle databáze – Konsolidovaná Data Management PlatformaMarketingArrowECS_CZ
 
Extreme Replication - Performance Tuning Oracle GoldenGate
Extreme Replication - Performance Tuning Oracle GoldenGateExtreme Replication - Performance Tuning Oracle GoldenGate
Extreme Replication - Performance Tuning Oracle GoldenGateBobby Curtis
 
TTN V2からTTN V3への移行ハンズオン by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 
TTN V2からTTN V3への移行ハンズオン  by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 TTN V2からTTN V3への移行ハンズオン  by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 
TTN V2からTTN V3への移行ハンズオン by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 CRI Japan, Inc.
 
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発Yahoo!デベロッパーネットワーク
 
Zookeeper Architecture
Zookeeper ArchitectureZookeeper Architecture
Zookeeper ArchitecturePrasad Wali
 
Performance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12cPerformance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12cAjith Narayanan
 
Sql 2012 always on
Sql 2012 always onSql 2012 always on
Sql 2012 always ondilip nayak
 
SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係datastaxjp
 

Tendances (20)

トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...
トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...
トランザクション処理可能な分散DB 「YugabyteDB」入門(Open Source Conference 2022 Online/Fukuoka 発...
 
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
Zuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne PlatformZuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne Platform
 
Unboundの最適化(OSC2011 Tokyo/Spring)
Unboundの最適化(OSC2011 Tokyo/Spring)Unboundの最適化(OSC2011 Tokyo/Spring)
Unboundの最適化(OSC2011 Tokyo/Spring)
 
Running Kafka as a Native Binary Using GraalVM with Ozan Günalp
Running Kafka as a Native Binary Using GraalVM with Ozan GünalpRunning Kafka as a Native Binary Using GraalVM with Ozan Günalp
Running Kafka as a Native Binary Using GraalVM with Ozan Günalp
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
 
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3
しばちょう先生が語る!オラクルデータベースの進化の歴史と最新技術動向#3
 
Learn Oracle WebLogic Server 12c Administration
Learn Oracle WebLogic Server 12c AdministrationLearn Oracle WebLogic Server 12c Administration
Learn Oracle WebLogic Server 12c Administration
 
Weblogic Server Overview Weblogic Scripting Tool
Weblogic Server Overview Weblogic Scripting ToolWeblogic Server Overview Weblogic Scripting Tool
Weblogic Server Overview Weblogic Scripting Tool
 
シンプルでシステマチックな Oracle Database, Exadata 性能分析
シンプルでシステマチックな Oracle Database, Exadata 性能分析シンプルでシステマチックな Oracle Database, Exadata 性能分析
シンプルでシステマチックな Oracle Database, Exadata 性能分析
 
Why Splunk Chose Pulsar_Karthik Ramasamy
Why Splunk Chose Pulsar_Karthik RamasamyWhy Splunk Chose Pulsar_Karthik Ramasamy
Why Splunk Chose Pulsar_Karthik Ramasamy
 
Oracle databáze – Konsolidovaná Data Management Platforma
Oracle databáze – Konsolidovaná Data Management PlatformaOracle databáze – Konsolidovaná Data Management Platforma
Oracle databáze – Konsolidovaná Data Management Platforma
 
Extreme Replication - Performance Tuning Oracle GoldenGate
Extreme Replication - Performance Tuning Oracle GoldenGateExtreme Replication - Performance Tuning Oracle GoldenGate
Extreme Replication - Performance Tuning Oracle GoldenGate
 
TTN V2からTTN V3への移行ハンズオン by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 
TTN V2からTTN V3への移行ハンズオン  by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 TTN V2からTTN V3への移行ハンズオン  by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 
TTN V2からTTN V3への移行ハンズオン by TTN高崎イニシエーター/エルスピーナヴェインズ株式会社代表取締役青谷浩二様 
 
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
"Yahoo! JAPAN の Kubernetes-as-a-Service" で加速するアプリケーション開発
 
Zookeeper Architecture
Zookeeper ArchitectureZookeeper Architecture
Zookeeper Architecture
 
Performance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12cPerformance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12c
 
Sql 2012 always on
Sql 2012 always onSql 2012 always on
Sql 2012 always on
 
SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係
 

Similaire à Java Flight Recorder Behind the Scenes

Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVMStaffan Larsen
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorderWolfgang Weigend
 
JSR107 State of the Union JavaOne 2013
JSR107  State of the Union JavaOne 2013JSR107  State of the Union JavaOne 2013
JSR107 State of the Union JavaOne 2013Hazelcast
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Alexandre (Shura) Iline
 
ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfMiro Wengner
 
Coherence 12.1.2 Hidden Gems
Coherence 12.1.2 Hidden GemsCoherence 12.1.2 Hidden Gems
Coherence 12.1.2 Hidden Gemsharvraja
 
DevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderDevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderMiro Wengner
 
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...AMD Developer Central
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Roger Brinkley
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production EnvironmentsBruno Borges
 
Running your Java EE 6 Applications in the Cloud
Running your Java EE 6 Applications in the CloudRunning your Java EE 6 Applications in the Cloud
Running your Java EE 6 Applications in the CloudArun Gupta
 
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceSFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceLucidworks (Archived)
 
Spark to Production @Windward
Spark to Production @WindwardSpark to Production @Windward
Spark to Production @WindwardDemi Ben-Ari
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishArun Gupta
 
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...DataStax Academy
 
Tuning Java for Big Data
Tuning Java for Big DataTuning Java for Big Data
Tuning Java for Big DataScott Seighman
 

Similaire à Java Flight Recorder Behind the Scenes (20)

Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
 
JSR107 State of the Union JavaOne 2013
JSR107  State of the Union JavaOne 2013JSR107  State of the Union JavaOne 2013
JSR107 State of the Union JavaOne 2013
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdf
 
Coherence 12.1.2 Hidden Gems
Coherence 12.1.2 Hidden GemsCoherence 12.1.2 Hidden Gems
Coherence 12.1.2 Hidden Gems
 
DevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderDevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight Recorder
 
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
 
Effective Spark on Multi-Tenant Clusters
Effective Spark on Multi-Tenant ClustersEffective Spark on Multi-Tenant Clusters
Effective Spark on Multi-Tenant Clusters
 
Running your Java EE 6 Applications in the Cloud
Running your Java EE 6 Applications in the CloudRunning your Java EE 6 Applications in the Cloud
Running your Java EE 6 Applications in the Cloud
 
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceSFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
 
Spark to Production @Windward
Spark to Production @WindwardSpark to Production @Windward
Spark to Production @Windward
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
 
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...
C* Summit 2013: Real-Time Big Data with Storm, Cassandra, and In-Memory Compu...
 
Tuning Java for Big Data
Tuning Java for Big DataTuning Java for Big Data
Tuning Java for Big Data
 

Dernier

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Dernier (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Java Flight Recorder Behind the Scenes

  • 1. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.1
  • 2. Java Flight Recorder Behind the Scenes Staffan Larsen Java SE Serviceability Architect staffan.larsen@oracle.com @stalar
  • 3. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.3 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.
  • 4. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.4 Java Flight Recorder §  Tracer and Profiler §  Non-intrusive §  Built into the JVM itself §  On-demand profiling §  After-the-fact capture and analysis §  First released in 7u40 Photograph by Jeffrey Milstein http://butdoesitfloat.com/In-the-presence-of-massive-gravitational-fields-this-perfect
  • 5. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.5 Tracer and Profiler §  Captures both JVM and application data –  Garbage Collections –  Synchronization –  Compiler –  CPU Usage –  Exceptions –  I/O §  Sampling-based profiler –  Very low overhead –  Accurate data
  • 6. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.6 Non-Intrusive §  Typical overhead in benchmarks: 2-3% (!) §  Often not noticeable in typical production environments §  Turn on and off in runtime §  Information already available in the JVM –  Zero extra cost Photograph: Andrew Rivett http://www.flickr.com/photos/veggiefrog/3435380297/
  • 7. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.7 Built into the JVM itself §  Core of JFR is inside the JVM §  Can easily interact with other JVM subsystems §  Optimized C++ code §  Supporting functionality written in Java
  • 8. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.8 On-Demand Profiling §  Start from Java Mission Control –  Or from the command line §  Easily configure the amount of information to capture §  For a profile, a higher overhead can be acceptable §  When done, no overhead §  Powerful GUI for analysis
  • 9. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.9 After-the-Fact Analysis §  In its default mode, very low overhead §  Designed to be always-on §  Uses circular buffers to store data –  In-memory or on-disk §  When an SLA breach is detected, dump the current buffers §  Dump will have information leading up to the problem n n+1 n+2n+3 n+4
  • 10. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.10
  • 11. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.11 Agenda §  Overview of JFR §  Demo! §  Configuration topics §  Implementation details
  • 12. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12 Configuration §  Enable -­‐XX:+UnlockCommercialFeatures  -­‐XX:+FlightRecorder   §  Start -­‐XX:StartFlightRecording=filename=<path>,duration=<time>   §  Or jcmd  <pid>  JFR.start  filename=<path>  duration=<time>  
  • 13. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.13 Advanced Configuration Per Recording Session Max age of data maxage=<time> Max size to keep maxsize=<size> Global Settings (-XX:FlightRecorderOptions) Max stack trace depth stackdepth=<n> (default 64) Save recording on exit dumponexit=true Logging loglevel=[ERROR|WARN|INFO| DEBUG|TRACE] Repository path repository=<path>
  • 14. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.14 Recording Sessions §  Recordings can specify exactly which information to capture –  ~80 events with 3 settings each §  But: two preconfigured settings –  “default”: provides as much information as possible while keeping overhead to a minimum –  “profile”: has more information, but also higher overhead §  You can configure your own favorites in Mission Control
  • 15. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.15 Many Simultaneous Recording Sessions §  This works great §  Each session can have its own settings §  Caveat: If there are multiple sessions all of them get the union of the enabled events –  Ex: If event A is enabled in on recording, all recordings will see event A –  Ex: If event B has two different thresholds, the lower value will apply
  • 16. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.16 JVM How Is It Built? §  Information gathering –  Instrumentation calls all over the JVM –  Application information via Java API §  Collected in Thread Local buffers ⇢ Global Buffers ⇢Disk §  Binary, proprietary file format §  Managed via JMX JFR Thread Buffers Disk JMX Java API Global Buffers GC RuntimeCompiler
  • 17. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.17 “Everything Is an Event” §  Header §  Payload –  Event specific data Event ID End Time Start Time Thread ID StackTrace ID Payload Header Optional Size
  • 18. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.18 Event Types §  Instant –  Single point in time –  Ex: Thread starts §  Duration –  Timing for something –  Ex: GC §  Requestable –  Happens with a specified frequency –  Ex: CPU Usage every second
  • 19. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.19 Event Meta Data §  For every event –  Name, Path, Description §  For every payload item –  Name, Type, Description, Content Type
  • 20. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.20 “Content Type” §  Describes the semantics of a value §  Used to correctly display the value in the UI Content Type Displayed as Bytes 4 MB Percentage 34 % Address 0x23CDA540 Millis 17 ms Nanos 4711 ns
  • 21. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21 Event Definition in Hotspot <event  id="ThreadSleep"        path="java/thread_sleep"    label="Java  Thread  Sleep"  ...>        <value  field="time"      type="MILLIS"      label="Sleep  Time"/>   </event>   §  XML definitions are processed into C++ classes
  • 22. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.22 Event Emission in Hotspot JVM_Sleep(int  millis)  {        EventThreadSleep  event;          ...  //  actual  sleep  happens  here          event.set_time(millis);      event.commit();   }     §  Done! Data is now available in JFR
  • 23. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.23 Thread Park <event  id="ThreadPark"  path="java/thread_park"              label="Java  Thread  Park"              has_thread="true"  has_stacktrace="true"  is_instant="false">        <value  type="CLASS"  field="klass"  label="Class  Parked  On"/>        <value  type="MILLIS"  field="timeout"  label="Park  Timeout"/>        <value  type="ADDRESS"  field="address"                        label="Address  of  Object  Parked"/>   </event>  
  • 24. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.24 Thread Park UnsafePark(jboolean  isAbsolute,  jlong  time)  {      EventThreadPark  event;      JavaThreadParkedState  jtps(thread,  time  !=  0);      thread-­‐>parker()-­‐>park(isAbsolute  !=  0,  time);      if  (event.should_commit())  {          oop  obj  =  thread-­‐>current_park_blocker();          event.set_klass(obj  ?  obj-­‐>klass()  :  NULL);          event.set_timeout(time);          event.set_address(obj  ?  (TYPE_ADDRESS)obj  :  0);          event.commit();      }   }  
  • 25. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.25 Event Graph
  • 26. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.26 Event Details
  • 27. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.27 Buffers §  “Circular” §  Designed for low contention Thread Local Buffers Global Buffers Disk Chunk Repository JVM Java
  • 28. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.28 Filtering Early §  Enable/disable event §  Thresholds –  Only if duration is longer than X §  Enable/disable stack trace §  Frequency –  Sample every X
  • 29. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.29 File Format §  Self-contained –  Everything needed to parse an event is included in the file –  New events instantly viewable in the UI §  Binary, proprietary §  Designed for fast writing §  Single file, no dependencies Event Records Event Definitions …Header
  • 30. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.30 Dynamic Runtime and Long-Running Recordings §  Can’t leak memory –  Can’t aggregate information eternally –  Can’t keep references that prohibits class unloading §  Dynamic Runtime –  Classes can come and go –  Threads can come and go §  Solutions: Constant Pools, Checkpoints
  • 31. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.31 Problem: Many Events Reference Classes §  If every event contained the class name as a string, we would waste lots of space §  Solution: Class IDs class  Klass  {        …        u8  _trace_id;        …   }   17event id class count java.lang.Integer 2 … 17event id class count 4711 2 …
  • 32. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.32 Problem: When Do We Write the Class IDs? §  IDs need to be part of the file §  Classes can be unloaded at any time –  Class may not be around until end of recording §  Solution: write Class ID when classes are unloaded
  • 33. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.33 Problem: Size of the Class List §  Many classes are loaded, not all are referenced in events, we want to save space §  Solution: when a class ID is referenced, the class is also “tagged” –  Write only tagged classes in the JFR file #define  CLASS_USED  1     void  use_class_id(Klass*  const  klass)  {      klass-­‐>_trace_id  |=  CLASS_USED;   }  
  • 34. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.34 Problem: Leaking Memory §  Over time many classes will be tagged, the size of the class list will increase §  Solution: reset the tags each time a class list is written to disk §  We call this a “Checkpoint” §  A recording file may contain many class lists, each one is only valid for the data immediately preceding it
  • 35. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.35 Constant Pools §  The Class List is a special case of a Constant Pool §  Classes §  Methods §  Threads §  Thread Groups §  Stack Traces §  Strings class_pool.lookup(4711)      ➞  java.lang.Integer     method_pool.lookup(1729)      ➞  java.lang.Math:pow()  
  • 36. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.36 Checkpoints §  At regular intervals, a “checkpoint” is created in the recording §  Has everything needed to parse the recording since the last checkpoint checkpoint = events + constant pools + event meta-data events constant pools meta-data checkpoint JFR File
  • 37. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.37 Optimizations §  Fast Timestamps –  Fast, high resolution CPU time where available –  Invariant TSC instructions §  Stack Traces –  Each event stores the thread’s stack trace –  Pool of stack traces
  • 38. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.38 Differences vs. JRockit §  I/O: File path, Socket address §  Exceptions §  Reverse call trace view in Mission Control §  Easier configuration in Mission Control §  Deeper (configurable) stack traces §  Internal JVM differences: GC
  • 39. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.39 More Information §  Whitepaper http://www.oracle.com/missioncontrol §  User Guide http://docs.oracle.com/javase/7/docs/technotes/guides/jfr/index.html §  Forum https://forums.oracle.com/community/developer/english/java/ java_hotspot_virtual_machine/java_mission_control
  • 40. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.40 -­‐XX:+UnlockCommercialFeatures     -­‐XX:+FlightRecorder   Remember
  • 41. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.41 @stalar staffan.larsen@oracle.com serviceability-dev@openjdk.java.net
  • 42. Copyright © 2013, Oracle and/or its affiliates. All rights reserved.42