SlideShare a Scribd company logo
1
Monitoring and Troubleshooting
Tools in JDK ‘bin’
Poonam Parhar
Copyright © 2019 Oracle and/or its affiliates.
Consulting Member of Technical Staff
JVM Sustaining Engineer, 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, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
What is Troubleshooting ?
• Systematic approach to solving problems
• Three simple steps:
• 1. Understand the problem/error
• 2. Collect the required diagnostic data
• 3. Analyze the collected data
Good Troubleshooting tools are our friends!
Copyright © 2019 Oracle and/or its affiliates.
JDK Troubleshooting/Monitoring Tools
• Tools that allow us to
• Monitor Java applications
• Profile Java applications
• Extract useful diagnostic information from Java applications
• Analyze diagnostic data
• Even perform after-the-fact analysis
• Can work locally or remotely
Copyright © 2019 Oracle and/or its affiliates.
Agenda
• Tools available in JDK ‘bin’ folder
• Monitoring Tools
• Troubleshooting Tools
• Newly Added Tools
• Decommissioned Tools
Copyright © 2019 Oracle and/or its affiliates.
Monitoring Tools
• jconsole - Starts a graphic console to monitor and manage Java
applications.
• jps - Experimental: Lists the instrumented Java Virtual
Machines (JVMs) on the target system.
• jstat - Experimental: Monitors JVM statistics
• jstatd - Experimental: Monitors JVMs and enables remote
monitoring tools to attach to JVMs.
• jmc – Java Mission Control: JMX console, and JFR recording
and analysis tool
Open	
sourced	
and	is	not	
shipped	
with	
Oracle	JDK
Copyright © 2019 Oracle and/or its affiliates.
JConsole
• JConsole is a GUI based monitoring tool for Java applications
• JMX client
• Helps in monitoring and managing
• Java Applications and the JVM
• Local and remote applications
• jconsole executable available in JDK/bin
• Using jConsole locally is not recommended for production
environments
• For remote monitoring:
• com.sun.management.jmxremote.port=portNum
Copyright © 2019 Oracle and/or its affiliates.
Java	Application
JMX	Client	
Application
Instrumented	JVM
JMX	Agent
MBean
Server
MBean
MBean
MBean
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
jps (experimental) – Java Process Status
tool
• Lists the JVMs running on the system
• Obtains processes information from /tmp/hsperfdata_user/<pid>
files
• List of the JVMs reported can be limited by the OS level permissions
granted to the user
• Can list the JVMs on local or remote hosts
• For remote monitoring ‘jstatd’ should be running on the remote
system
• Accepts optional argument <protocol:><//hostname>:[<port>]
• On local hosts, the VM identifier is typically the OS process id of the
application
Copyright © 2019 Oracle and/or its affiliates.
$ jps -h
illegal argument: -h
usage: jps [-help]
jps [-q] [-mlvV] [<hostid>]
Definitions:
<hostid>: <hostname>[:<port>]
$ jps -m
9848 GCBasher.jar -time:100000000
7084 Jps –m
$ jps -l
3056 jdk.jcmd/sun.tools.jps.Jps
9848 GCBasher.jar
$ jps -v
6324 Jps -Dapplication.home=d:Javajdk-9 -Xms8m -Djdk.module.main=jdk.jcmd
9848 GCBasher.jar
C:Userspobajaj.ORADEV>jps -q
9876
9848
jps examples
Copyright © 2019 Oracle and/or its affiliates.
jstat (experimental) – JVM Statistics
• Tool to monitor JVM statistics
• Performance statistics about HotSpot JVM
• Reads information from /tmp/hsperfdata_user/<pid> file
• Accepts various options to print statistics about different
components of the JVM
• class, compiler, gc, gccapacity, gccause, gcnew, gcnewcapacity, gcold,
gcoldcapacity, gcmetacapacity, gcutil, printcompilation
• For remote monitoring ‘jstatd’ must be running on the remote
system
• Accepts optional argument <protocol:><//hostname>:[<port>]
Copyright © 2019 Oracle and/or its affiliates.
jstatd (experimental) - jstat Daemon
• Launches an RMI server application that monitors the creation
and termination of HotSpot JVM based java applications
• Provides an interface to allow remote monitoring tools to attach
to Java virtual machines running on the system
• Note: There is no encryption or authentication with jstatd
Copyright © 2019 Oracle and/or its affiliates.
Monitoring Tools
• jconsole - Starts a graphic console to monitor and manage Java
applications.
• jps - Experimental: Lists the instrumented Java Virtual Machines
(JVMs) on the target system.
• jstat - Experimental: Monitors JVM statistics
• jstatd - Experimental: Monitors JVMs and enables remote
monitoring tools to attach to JVMs.
Copyright © 2019 Oracle and/or its affiliates.
Troubleshooting Tools
• jcmd – Sends diagnostic commands to a running JVM
• jdb – java platform debugger
• jinfo – Experimental: Obtains and updates configuration information
• jmap – Experimental: Can create heap dumps or heap histograms for
a java process
• jstack – Experimental: Prints Java thread stack traces for a Java
process
• jhsdb – Attaches to a hanging process or a crash dump file for
postmortem analysis
• jfr – command line tool to analyze JFR recording files
New	
tool	
in	
JDK	
9
New	
diagnostic	
commands
New	tool	in	JDK	
12
Copyright © 2019 Oracle and/or its affiliates.
jcmd – Java Command
• Java Diagnostic Command utility
• Utility to send diagnostic commands to a running JVM
• Uses Attach API to execute d-commands (helper routines) in
the JVM
• Can be used only on the same local machine as the target JVM
Copyright © 2019 Oracle and/or its affiliates.
jcmd: popular commands
• jcmd <process id/main class> VM.version
• jcmd <process id/main class> VM.system_properties
• jcmd <process id/main class> VM.flags
• jcmd <process id/main class> GC.class_histogram
• jcmd <process id/main class> GC.class_stats
• jcmd <process id/main class> GC.heap_dump
filename=heapdump
• jcmd <process id/main class> Thread.print
Copyright © 2019 Oracle and/or its affiliates.
jcmd: Java Flight Recordings commands
• jcmd <process id/main class> JFR.start name=MyRecording
settings=profile delay=20s duration=2m
filename=/tmp/myrecording.jfr
• jcmd <process id/main class> JFR.check
• jcmd <process id/main class> JFR.stop
• jcmd <process id/main class> JFR.dump name=MyRecording
filename=/tmp/myrecording.jfr
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
jcmd Attach	API
Diagnostic	
Routines
Commands
Output
Local	
machine
Copyright © 2019 Oracle and/or its affiliates.
jdb – Java Debugger
• Command-line debugger for Java Class files
• jdb <options> <class> <arguments>
• Uses Java Debug Interface (JDI)
• JDI is a component of Java Platform Debugger Architecture
(JPDA)
• Can perform inspection and debugging of a local or remote
Java Virtual Machine
Copyright © 2019 Oracle and/or its affiliates.
jinfo
jmap
jstack
Local	live	process
Core	dump	file
Remote	Debug	ServerJDK	8
JDK	
9+
Serviceability	Agent
Attach	API
Copyright © 2019 Oracle and/or its affiliates.
jinfo – Java Configuration Information
• Configuration (flags) information of a running Java process
• Can update the manageable flags at runtime
• It can:
• Print the value of a VM flag
• Enable or disable a specified VM flag
• Set the value of a VM flag
• Print VM flags and system properties
Copyright © 2019 Oracle and/or its affiliates.
jmap (experimental) – Java Memory Map
• Heap objects information and Heap dumps
• Classloader Statistics
• -clstats <pid>
• Finalization Information
• -finalizerinfo <pid>
• Class Histograms
• -histo[:live] <pid>
• Heap Dumps
• -dump:<dump-options> <pid>
• JDK 9 removed: heap info and shared memory mappings
Copyright © 2019 Oracle and/or its affiliates.
jstack (experimental) – Java Stack
• Thread dump
• Deadlock detection
• jstack –l to see the concurrent locks information
• Removed support for –F and –m options
Copyright © 2019 Oracle and/or its affiliates.
jcmd – comparison with old tools
jcmd Individual	tools Function
jcmd without	any	argument jps List	Java Processes
jcmd with	VM.system_properties,	VM.flags,	VM.set_flag jinfo VM	Configuration
jcmd with	GC.class_stats,	GC.class_histogram,	
GC.heap_dump,	GC.finalizer_info
jmap Generate	Heap	Dump	
and	Class	Histogram,	get	
Class	Statistics and	
Finalization	information
jcmd with	Thread.print jstack Thread Dump
jcmd PerfCounter.print jstat Print	Performance	
Counters
Copyright © 2019 Oracle and/or its affiliates.
jhsdb- Java HotSpot Debugger
• Can be used to launch a postmortem debugger (SA) to analyze
core dump files
• Can be used for live java processes too
• jhsdb clhsdb [--pid pid | --exe executable --core coredump]
• jhsdb debugd [options] pid [server-id]|[option] executable core [server-id]
• jhsdb hsdb [--pid pid | --exe executable --core coredump]
• jhsdb jstack [--pid pid | --exe executable --core coredump] [options]
• jhsdb jmap [--pid pid | --exe executable --core coredump] [options]
• jhsdb jinfo [--pid pid | --exe executable --core coredump] [options]
• jhsdb jsnap [options] [--pid pid | --exe executable --core coredump]
Copyright © 2019 Oracle and/or its affiliates.
jinfo
jmap
jstack
Local	live	process
Core	dump	file
Remote	Debug	Server
JDK	
9+
Serviceability	Agent
Attach	API
Copyright © 2019 Oracle and/or its affiliates.
jhsdb
Local	live	process
Core	dump	file
Remote	Debug	Server
JDK	
9+
Serviceability	Agent
Non-cooperative	manner
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
JFR Tool
• Where	GUI	tools	(e.g.	JMC)	can	not	be	used
• https://bugs.openjdk.java.net/browse/JDK-8205516
• Available	since	JDK	12
• Will	also	be	available	in	11.0.6	Oracle	JDK
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
JFR Tool Commands
jfr print recording.jfr
jfr print --events CPULoad,GarbageCollection recording.jfr
jfr print --json --events CPULoad recording.jfr
jfr print --categories "GC,JVM,Java*" recording.jfr
jfr print --events "jdk.*" --stack-depth 64 recording.jfr
jfr summary recording.jfr
jfr metadata recording.jfr
Copyright © 2019 Oracle and/or its affiliates.
Troubleshooting Tools
• jcmd – Sends diagnostic commands to a running JVM
• jdb – java platform debugger
• jinfo – Experimental: Generates configuration information
• jmap – Experimental: Can create heap dumps or heap
histograms for a java process
• jstack – Experimental: Prints Java thread stack traces for a Java
process
• jhsdb – Attaches to a hanging process or a crash dump file for
postmortem analysis
• jfr – command line tool to analyze JFR recording files
Copyright © 2019 Oracle and/or its affiliates.
Tools Removed in JDKs
• JDK 9
• Java VisualVM
• jhat
• jsadebugd
• JDK 11
• jmc
Copyright © 2019 Oracle and/or its affiliates.
Java VisualVM
• Not included since JDK 9
• Open Source Project: https://visualvm.github.io/download.html
• Other tools (profiling and live monitoring) available: Java
Mission Control, JConsole
• Several Open Source heap dumps analysis tools available
• Eclipse MAT
Copyright © 2019 Oracle and/or its affiliates.
jhat
• Removed in JDK 9
• Web application that can be launched with the ‘jhat’ command
available in the JDK/bin folder
• Enables heap dump analysis by browsing objects in the heap
dump using any web browser
• By default the web server is started at port 7000.
• jhat supports a wide range of pre-designed queries and Object
Query Language(OQL) to explore the objects in heap dumps
• Several other heap dump analysis tools available
Copyright © 2019 Oracle and/or its affiliates.
jsadebugd
• Removed in Java 9
• Attaches to a Java process or core file and acts as a debug
server
• Up until JDK 8, tools such as jstack, jmap, and jinfo could
remotely attach to a debug server using Java RMI
• The debug server can now be launched with ‘jhsdb debugd’
Copyright © 2019 Oracle and/or its affiliates.
JMC - Java Mission Control
• Open Sourced: http://hg.openjdk.java.net/jmc
• Building JMC: http://hirt.se/blog/?p=947
• Not available in ‘bin’ since JDK 11
• Non-intrusive, low-overhead tool to monitor, manage and profile Java
applications
• Suitable for production environments
• JMC Tools Chain
• JMX Console
• Monitoring and managing live java applications
• JMX MBeans Browser
• Java Flight Recorder
• Engine built in the Java Runtime
• Record interesting events at the application and the JVM level
• Compact binary proprietary format
• Tracking events leading up to a problem provides great help in troubleshooting
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Update on JFR
• JEP 328: Flight Recorder
• JFR open sourced in JDK 11
• Was a commercial feature earlier, and needed commercial license and -
XX:+UnlockCommercialFeatures option
• Flight Recorder API
• Added in JDK 9
• Old Object Sample Event (Memory Leak Profiler)
• Added in JDK 10
• Marcus’s blog post: http://hirt.se/blog/?p=1055
• Performance enhancements in data collection and recording
• Ability to dump recordings even at VM crashes or OOMs
• Improved and new Events (safepoint, codecache, compiler, G1, module)
Copyright © 2019 Oracle and/or its affiliates.
Summary
• Enhanced Tools
• jcmd – we encourage to use this tool instead of other individual tools
• New Tools
• jfr tool
• jhsdb for postmortem analysis
• Removed Tools
• Java VisualVM
• jhat
• jsadebugd
• jmc
Copyright © 2019 Oracle and/or its affiliates.
69
Monitoring and Troubleshooting
Tools in JDK ‘bin’
Poonam Parhar
Consulting Member of Technical Staff
JVM Sustaining Engineer, Oracle
Copyright © 2019 Oracle and/or its affiliates.

More Related Content

PDF
USENIX ATC 2017: Visualizing Performance with Flame Graphs
PPTX
Broken Linux Performance Tools 2016
PDF
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
PDF
Phoenix Framework
PPTX
The Next Linux Superpower: eBPF Primer
PDF
Performance Wins with eBPF: Getting Started (2021)
PDF
YOW2020 Linux Systems Performance
PDF
Velocity 2015 linux perf tools
USENIX ATC 2017: Visualizing Performance with Flame Graphs
Broken Linux Performance Tools 2016
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Phoenix Framework
The Next Linux Superpower: eBPF Primer
Performance Wins with eBPF: Getting Started (2021)
YOW2020 Linux Systems Performance
Velocity 2015 linux perf tools

What's hot (20)

PDF
Kernel Recipes 2017: Using Linux perf at Netflix
PDF
Linux 4.x Tracing Tools: Using BPF Superpowers
PDF
Introduction to big data and apache spark
PDF
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
PDF
Kdump and the kernel crash dump analysis
PDF
Linux Performance Analysis: New Tools and Old Secrets
PDF
Spark Summit EU talk by Luc Bourlier
PPTX
Sisteme de Operare: Securitatea memoriei
PDF
eBPF Trace from Kernel to Userspace
PDF
Open Network OS Overview as of 2015/10/16
PDF
Linux kernel tracing
PDF
VMworld 2013: ESXi Native Networking Driver Model - Delivering on Simplicity ...
PDF
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
PPTX
High Performance, High Reliability Data Loading on ClickHouse
PPTX
Staring into the eBPF Abyss
PDF
Using VPP and SRIO-V with Clear Containers
PDF
Spring Boot & Actuators
PDF
Linux Systems Performance 2016
PPTX
IBM JVM 소개 - Oracle JVM 과 비교
PDF
Get Rid Of OutOfMemoryError messages
Kernel Recipes 2017: Using Linux perf at Netflix
Linux 4.x Tracing Tools: Using BPF Superpowers
Introduction to big data and apache spark
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kdump and the kernel crash dump analysis
Linux Performance Analysis: New Tools and Old Secrets
Spark Summit EU talk by Luc Bourlier
Sisteme de Operare: Securitatea memoriei
eBPF Trace from Kernel to Userspace
Open Network OS Overview as of 2015/10/16
Linux kernel tracing
VMworld 2013: ESXi Native Networking Driver Model - Delivering on Simplicity ...
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
High Performance, High Reliability Data Loading on ClickHouse
Staring into the eBPF Abyss
Using VPP and SRIO-V with Clear Containers
Spring Boot & Actuators
Linux Systems Performance 2016
IBM JVM 소개 - Oracle JVM 과 비교
Get Rid Of OutOfMemoryError messages
Ad

Similar to Troubleshooting Tools In JDK (20)

PDF
Monitoring and Troubleshooting Tools in Java 9
ODP
Java code coverage with JCov. Implementation details and use cases.
PDF
JDK 8 and JDK 8 Updates in OpenJDK
PDF
JVMs in Containers - Best Practices
PPTX
Production Time Profiling Out of the Box
PDF
JVMs in Containers
PDF
Diagnosing Your Application on the JVM
PDF
ASML_FlightRecorderMeetsJava.pdf
PDF
DevDays: Profiling With Java Flight Recorder
PPTX
Splunk Conf 2014 - Splunking the Java Virtual Machine
PPTX
Java Mission Control in Java SE 7U40
PDF
JDK 10 Java Module System
PDF
Why should i switch to Java SE 7
PDF
Java mission control and java flight recorder
PDF
Impact2014: Introduction to the IBM Java Tools
PDF
JavaOne 2016: Life after Modularity
PDF
Graal Tutorial at CGO 2015 by Christian Wimmer
PDF
2015 Java update and roadmap, JUG sevilla
PDF
Serverless Java: JJUG CCC 2019
PDF
Exciting Features and Enhancements in Java 23 and 24
Monitoring and Troubleshooting Tools in Java 9
Java code coverage with JCov. Implementation details and use cases.
JDK 8 and JDK 8 Updates in OpenJDK
JVMs in Containers - Best Practices
Production Time Profiling Out of the Box
JVMs in Containers
Diagnosing Your Application on the JVM
ASML_FlightRecorderMeetsJava.pdf
DevDays: Profiling With Java Flight Recorder
Splunk Conf 2014 - Splunking the Java Virtual Machine
Java Mission Control in Java SE 7U40
JDK 10 Java Module System
Why should i switch to Java SE 7
Java mission control and java flight recorder
Impact2014: Introduction to the IBM Java Tools
JavaOne 2016: Life after Modularity
Graal Tutorial at CGO 2015 by Christian Wimmer
2015 Java update and roadmap, JUG sevilla
Serverless Java: JJUG CCC 2019
Exciting Features and Enhancements in Java 23 and 24
Ad

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation theory and applications.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
“AI and Expert System Decision Support & Business Intelligence Systems”
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Building Integrated photovoltaic BIPV_UPV.pdf
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Big Data Technologies - Introduction.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing

Troubleshooting Tools In JDK

  • 1. 1 Monitoring and Troubleshooting Tools in JDK ‘bin’ Poonam Parhar Copyright © 2019 Oracle and/or its affiliates. Consulting Member of Technical Staff JVM Sustaining Engineer, 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, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 3. What is Troubleshooting ? • Systematic approach to solving problems • Three simple steps: • 1. Understand the problem/error • 2. Collect the required diagnostic data • 3. Analyze the collected data Good Troubleshooting tools are our friends! Copyright © 2019 Oracle and/or its affiliates.
  • 4. JDK Troubleshooting/Monitoring Tools • Tools that allow us to • Monitor Java applications • Profile Java applications • Extract useful diagnostic information from Java applications • Analyze diagnostic data • Even perform after-the-fact analysis • Can work locally or remotely Copyright © 2019 Oracle and/or its affiliates.
  • 5. Agenda • Tools available in JDK ‘bin’ folder • Monitoring Tools • Troubleshooting Tools • Newly Added Tools • Decommissioned Tools Copyright © 2019 Oracle and/or its affiliates.
  • 6. Monitoring Tools • jconsole - Starts a graphic console to monitor and manage Java applications. • jps - Experimental: Lists the instrumented Java Virtual Machines (JVMs) on the target system. • jstat - Experimental: Monitors JVM statistics • jstatd - Experimental: Monitors JVMs and enables remote monitoring tools to attach to JVMs. • jmc – Java Mission Control: JMX console, and JFR recording and analysis tool Open sourced and is not shipped with Oracle JDK Copyright © 2019 Oracle and/or its affiliates.
  • 7. JConsole • JConsole is a GUI based monitoring tool for Java applications • JMX client • Helps in monitoring and managing • Java Applications and the JVM • Local and remote applications • jconsole executable available in JDK/bin • Using jConsole locally is not recommended for production environments • For remote monitoring: • com.sun.management.jmxremote.port=portNum Copyright © 2019 Oracle and/or its affiliates.
  • 9. Copyright © 2019 Oracle and/or its affiliates.
  • 10. Copyright © 2019 Oracle and/or its affiliates.
  • 11. Copyright © 2019 Oracle and/or its affiliates.
  • 12. Copyright © 2019 Oracle and/or its affiliates.
  • 13. Copyright © 2019 Oracle and/or its affiliates.
  • 14. Copyright © 2019 Oracle and/or its affiliates.
  • 15. jps (experimental) – Java Process Status tool • Lists the JVMs running on the system • Obtains processes information from /tmp/hsperfdata_user/<pid> files • List of the JVMs reported can be limited by the OS level permissions granted to the user • Can list the JVMs on local or remote hosts • For remote monitoring ‘jstatd’ should be running on the remote system • Accepts optional argument <protocol:><//hostname>:[<port>] • On local hosts, the VM identifier is typically the OS process id of the application Copyright © 2019 Oracle and/or its affiliates.
  • 16. $ jps -h illegal argument: -h usage: jps [-help] jps [-q] [-mlvV] [<hostid>] Definitions: <hostid>: <hostname>[:<port>] $ jps -m 9848 GCBasher.jar -time:100000000 7084 Jps –m $ jps -l 3056 jdk.jcmd/sun.tools.jps.Jps 9848 GCBasher.jar $ jps -v 6324 Jps -Dapplication.home=d:Javajdk-9 -Xms8m -Djdk.module.main=jdk.jcmd 9848 GCBasher.jar C:Userspobajaj.ORADEV>jps -q 9876 9848 jps examples Copyright © 2019 Oracle and/or its affiliates.
  • 17. jstat (experimental) – JVM Statistics • Tool to monitor JVM statistics • Performance statistics about HotSpot JVM • Reads information from /tmp/hsperfdata_user/<pid> file • Accepts various options to print statistics about different components of the JVM • class, compiler, gc, gccapacity, gccause, gcnew, gcnewcapacity, gcold, gcoldcapacity, gcmetacapacity, gcutil, printcompilation • For remote monitoring ‘jstatd’ must be running on the remote system • Accepts optional argument <protocol:><//hostname>:[<port>] Copyright © 2019 Oracle and/or its affiliates.
  • 18. jstatd (experimental) - jstat Daemon • Launches an RMI server application that monitors the creation and termination of HotSpot JVM based java applications • Provides an interface to allow remote monitoring tools to attach to Java virtual machines running on the system • Note: There is no encryption or authentication with jstatd Copyright © 2019 Oracle and/or its affiliates.
  • 19. Monitoring Tools • jconsole - Starts a graphic console to monitor and manage Java applications. • jps - Experimental: Lists the instrumented Java Virtual Machines (JVMs) on the target system. • jstat - Experimental: Monitors JVM statistics • jstatd - Experimental: Monitors JVMs and enables remote monitoring tools to attach to JVMs. Copyright © 2019 Oracle and/or its affiliates.
  • 20. Troubleshooting Tools • jcmd – Sends diagnostic commands to a running JVM • jdb – java platform debugger • jinfo – Experimental: Obtains and updates configuration information • jmap – Experimental: Can create heap dumps or heap histograms for a java process • jstack – Experimental: Prints Java thread stack traces for a Java process • jhsdb – Attaches to a hanging process or a crash dump file for postmortem analysis • jfr – command line tool to analyze JFR recording files New tool in JDK 9 New diagnostic commands New tool in JDK 12 Copyright © 2019 Oracle and/or its affiliates.
  • 21. jcmd – Java Command • Java Diagnostic Command utility • Utility to send diagnostic commands to a running JVM • Uses Attach API to execute d-commands (helper routines) in the JVM • Can be used only on the same local machine as the target JVM Copyright © 2019 Oracle and/or its affiliates.
  • 22. jcmd: popular commands • jcmd <process id/main class> VM.version • jcmd <process id/main class> VM.system_properties • jcmd <process id/main class> VM.flags • jcmd <process id/main class> GC.class_histogram • jcmd <process id/main class> GC.class_stats • jcmd <process id/main class> GC.heap_dump filename=heapdump • jcmd <process id/main class> Thread.print Copyright © 2019 Oracle and/or its affiliates.
  • 23. jcmd: Java Flight Recordings commands • jcmd <process id/main class> JFR.start name=MyRecording settings=profile delay=20s duration=2m filename=/tmp/myrecording.jfr • jcmd <process id/main class> JFR.check • jcmd <process id/main class> JFR.stop • jcmd <process id/main class> JFR.dump name=MyRecording filename=/tmp/myrecording.jfr Copyright © 2019 Oracle and/or its affiliates.
  • 24. Copyright © 2019 Oracle and/or its affiliates.
  • 25. Copyright © 2019 Oracle and/or its affiliates.
  • 26. Copyright © 2019 Oracle and/or its affiliates.
  • 27. Copyright © 2019 Oracle and/or its affiliates.
  • 28. Copyright © 2019 Oracle and/or its affiliates.
  • 30. jdb – Java Debugger • Command-line debugger for Java Class files • jdb <options> <class> <arguments> • Uses Java Debug Interface (JDI) • JDI is a component of Java Platform Debugger Architecture (JPDA) • Can perform inspection and debugging of a local or remote Java Virtual Machine Copyright © 2019 Oracle and/or its affiliates.
  • 32. jinfo – Java Configuration Information • Configuration (flags) information of a running Java process • Can update the manageable flags at runtime • It can: • Print the value of a VM flag • Enable or disable a specified VM flag • Set the value of a VM flag • Print VM flags and system properties Copyright © 2019 Oracle and/or its affiliates.
  • 33. jmap (experimental) – Java Memory Map • Heap objects information and Heap dumps • Classloader Statistics • -clstats <pid> • Finalization Information • -finalizerinfo <pid> • Class Histograms • -histo[:live] <pid> • Heap Dumps • -dump:<dump-options> <pid> • JDK 9 removed: heap info and shared memory mappings Copyright © 2019 Oracle and/or its affiliates.
  • 34. jstack (experimental) – Java Stack • Thread dump • Deadlock detection • jstack –l to see the concurrent locks information • Removed support for –F and –m options Copyright © 2019 Oracle and/or its affiliates.
  • 35. jcmd – comparison with old tools jcmd Individual tools Function jcmd without any argument jps List Java Processes jcmd with VM.system_properties, VM.flags, VM.set_flag jinfo VM Configuration jcmd with GC.class_stats, GC.class_histogram, GC.heap_dump, GC.finalizer_info jmap Generate Heap Dump and Class Histogram, get Class Statistics and Finalization information jcmd with Thread.print jstack Thread Dump jcmd PerfCounter.print jstat Print Performance Counters Copyright © 2019 Oracle and/or its affiliates.
  • 36. jhsdb- Java HotSpot Debugger • Can be used to launch a postmortem debugger (SA) to analyze core dump files • Can be used for live java processes too • jhsdb clhsdb [--pid pid | --exe executable --core coredump] • jhsdb debugd [options] pid [server-id]|[option] executable core [server-id] • jhsdb hsdb [--pid pid | --exe executable --core coredump] • jhsdb jstack [--pid pid | --exe executable --core coredump] [options] • jhsdb jmap [--pid pid | --exe executable --core coredump] [options] • jhsdb jinfo [--pid pid | --exe executable --core coredump] [options] • jhsdb jsnap [options] [--pid pid | --exe executable --core coredump] Copyright © 2019 Oracle and/or its affiliates.
  • 39. Copyright © 2019 Oracle and/or its affiliates.
  • 40. Copyright © 2019 Oracle and/or its affiliates.
  • 41. Copyright © 2019 Oracle and/or its affiliates.
  • 42. Copyright © 2019 Oracle and/or its affiliates.
  • 43. Copyright © 2019 Oracle and/or its affiliates.
  • 44. Copyright © 2019 Oracle and/or its affiliates.
  • 45. Copyright © 2019 Oracle and/or its affiliates.
  • 46. Copyright © 2019 Oracle and/or its affiliates.
  • 47. Copyright © 2019 Oracle and/or its affiliates.
  • 48. Copyright © 2019 Oracle and/or its affiliates.
  • 49. JFR Tool • Where GUI tools (e.g. JMC) can not be used • https://bugs.openjdk.java.net/browse/JDK-8205516 • Available since JDK 12 • Will also be available in 11.0.6 Oracle JDK Copyright © 2019 Oracle and/or its affiliates.
  • 50. Copyright © 2019 Oracle and/or its affiliates.
  • 51. JFR Tool Commands jfr print recording.jfr jfr print --events CPULoad,GarbageCollection recording.jfr jfr print --json --events CPULoad recording.jfr jfr print --categories "GC,JVM,Java*" recording.jfr jfr print --events "jdk.*" --stack-depth 64 recording.jfr jfr summary recording.jfr jfr metadata recording.jfr Copyright © 2019 Oracle and/or its affiliates.
  • 52. Troubleshooting Tools • jcmd – Sends diagnostic commands to a running JVM • jdb – java platform debugger • jinfo – Experimental: Generates configuration information • jmap – Experimental: Can create heap dumps or heap histograms for a java process • jstack – Experimental: Prints Java thread stack traces for a Java process • jhsdb – Attaches to a hanging process or a crash dump file for postmortem analysis • jfr – command line tool to analyze JFR recording files Copyright © 2019 Oracle and/or its affiliates.
  • 53. Tools Removed in JDKs • JDK 9 • Java VisualVM • jhat • jsadebugd • JDK 11 • jmc Copyright © 2019 Oracle and/or its affiliates.
  • 54. Java VisualVM • Not included since JDK 9 • Open Source Project: https://visualvm.github.io/download.html • Other tools (profiling and live monitoring) available: Java Mission Control, JConsole • Several Open Source heap dumps analysis tools available • Eclipse MAT Copyright © 2019 Oracle and/or its affiliates.
  • 55. jhat • Removed in JDK 9 • Web application that can be launched with the ‘jhat’ command available in the JDK/bin folder • Enables heap dump analysis by browsing objects in the heap dump using any web browser • By default the web server is started at port 7000. • jhat supports a wide range of pre-designed queries and Object Query Language(OQL) to explore the objects in heap dumps • Several other heap dump analysis tools available Copyright © 2019 Oracle and/or its affiliates.
  • 56. jsadebugd • Removed in Java 9 • Attaches to a Java process or core file and acts as a debug server • Up until JDK 8, tools such as jstack, jmap, and jinfo could remotely attach to a debug server using Java RMI • The debug server can now be launched with ‘jhsdb debugd’ Copyright © 2019 Oracle and/or its affiliates.
  • 57. JMC - Java Mission Control • Open Sourced: http://hg.openjdk.java.net/jmc • Building JMC: http://hirt.se/blog/?p=947 • Not available in ‘bin’ since JDK 11 • Non-intrusive, low-overhead tool to monitor, manage and profile Java applications • Suitable for production environments • JMC Tools Chain • JMX Console • Monitoring and managing live java applications • JMX MBeans Browser • Java Flight Recorder • Engine built in the Java Runtime • Record interesting events at the application and the JVM level • Compact binary proprietary format • Tracking events leading up to a problem provides great help in troubleshooting Copyright © 2019 Oracle and/or its affiliates.
  • 58. Copyright © 2019 Oracle and/or its affiliates.
  • 59. Copyright © 2019 Oracle and/or its affiliates.
  • 60. Copyright © 2019 Oracle and/or its affiliates.
  • 61. Copyright © 2019 Oracle and/or its affiliates.
  • 62. Copyright © 2019 Oracle and/or its affiliates.
  • 63. Copyright © 2019 Oracle and/or its affiliates.
  • 64. Copyright © 2019 Oracle and/or its affiliates.
  • 65. Copyright © 2019 Oracle and/or its affiliates.
  • 66. Copyright © 2019 Oracle and/or its affiliates.
  • 67. Update on JFR • JEP 328: Flight Recorder • JFR open sourced in JDK 11 • Was a commercial feature earlier, and needed commercial license and - XX:+UnlockCommercialFeatures option • Flight Recorder API • Added in JDK 9 • Old Object Sample Event (Memory Leak Profiler) • Added in JDK 10 • Marcus’s blog post: http://hirt.se/blog/?p=1055 • Performance enhancements in data collection and recording • Ability to dump recordings even at VM crashes or OOMs • Improved and new Events (safepoint, codecache, compiler, G1, module) Copyright © 2019 Oracle and/or its affiliates.
  • 68. Summary • Enhanced Tools • jcmd – we encourage to use this tool instead of other individual tools • New Tools • jfr tool • jhsdb for postmortem analysis • Removed Tools • Java VisualVM • jhat • jsadebugd • jmc Copyright © 2019 Oracle and/or its affiliates.
  • 69. 69 Monitoring and Troubleshooting Tools in JDK ‘bin’ Poonam Parhar Consulting Member of Technical Staff JVM Sustaining Engineer, Oracle Copyright © 2019 Oracle and/or its affiliates.