JavaCro'14 - Profile any environment with Java Flight Recorder – Johan Janssen

Post on 28-Nov-2014

944 views 0 download

description

Since the Java 7 update 40 Java Flight Recorder and Mission Control are shipped with the JDK. With these tools it is possible to profile an application not only on a developer computer, but also on production. The overhead of profiling with Flight Recorder is minimal, which allows us to use the profiler on any environment. These profiling tools are relatively new and unfortunately unknown to a lot of developers. This talk will give an overview of Java Flight Recorder and Mission Control so the audience can start profiling their applications afterwards.

transcript

Johan Janssen, Info Support

�Current situation

�Why should we use a profiler?

�Java Mission Control�Java Mission Control

�Java Flight Recorder

�JOverflow plugin

�Demo

�Questions

�High application response time

�High memory usage (per end user)

�High CPU usage�High CPU usage

�High I/O

�We want to create high quality software!

�Increase Java memory settings

�Increase physical memory

�Increase CPU’s�Increase CPU’s

�Distribute application over multiple

machines

�Scaling is difficult

oMemory per machine is limited

oMemory bandwidth is limited

Garbage collection�Garbage collection

�Maintenance cost

�We still have low quality software!

�High performance

oMinimal overhead (1-3%)

oUsable in productionoUsable in production

�New in Java 7 u40

�Integrated in the Hotspot JVM from the

JRockit JVM

�Commercial feature for production

�Free for development use

�Method profiling

�Allocation profiling

�I/O analysis�I/O analysis

�Garbage collector analysis

�Third party events analysis

�Exceptions analysis

�Heap analysis

�Configure triggers

� JMX compliant monitoring tool

� Dynamically monitor and manage the JVM

� Analyze recordings made by the Flight Recorder

� Fully customizable dashboards� Fully customizable dashboards

� Java 7 u40 contains 5.2.0

� Java 8 contains 5.3.0

o Minor release

o Bugfixes and incremental improvements (UI

etcetera)

o Eclipse support

�Eclipse

o Integration with codebase

�Application $JDK$\bin\jmcApplication $JDK$\bin\jmc

�Adjust eclipse.ini-showsplash

org.eclipse.platform

-vm-vm

C:\Program Files\Java\jdk1.8.0_05\jre\bin

�Install new softwarehttp://download.oracle.com/technology/products/missionconhttp://download.oracle.com/technology/products/missionconhttp://download.oracle.com/technology/products/missionconhttp://download.oracle.com/technology/products/missioncontrol/updatesites/base/5.3.0/eclipse/trol/updatesites/base/5.3.0/eclipse/trol/updatesites/base/5.3.0/eclipse/trol/updatesites/base/5.3.0/eclipse/

�Install Mission Control

�JConsole++

�Live, real time monitoring of JVM

�Triggers�Triggers

�Record and analysis tool for JVM’s

�JVM events are recorded in detail

�Minimal performance impact�Minimal performance impact

�Recording files

o JFR binary

�Multiple recordings at the same time

�Eclipse

�Application $JDK$\bin\jmc

�Commandline�Commandline

�Jcmd

�Use correct JDK

�Specify correct options:�Specify correct options:

-XX:+UnlockCommercialFeatures

-XX:+FlightRecorder

�Perform heap dump

�Visualize heap dump

�Analyze heap dump (automatically) �Analyze heap dump (automatically)

�Unused data structures

�Data structures that reserve more

space as the default size is bigger

�Objects instead of primitives

�Complex collections instead of arrays

�Duplicate data

� Apply manual patch before installing plugins!!Apply manual patch before installing plugins!!Apply manual patch before installing plugins!!Apply manual patch before installing plugins!!

� Remove the following lines from

<JDK>/lib/missioncontrol/configuration/org.eclips

e.equinox.simpleconfigurator/bundles.info :e.equinox.simpleconfigurator/bundles.info :

org.eclipse.equinox.log.nl_ja

org.eclipse.equinox.log.nl_zh

org.eclipse.equinox.supplement.nl_ja

org.eclipse.equinox.supplement.nl_zh

�Overlap with Mission Control

�Tools are part of OpenJDK

�Likely to stay alongside Mission Control�Likely to stay alongside Mission Control

�Development will focus on Mission

Control

johan.janssen@infosupport.com