Welcome to the session...

Similar documents
Mission Possible - Near zero overhead profiling. Klara Ward Principal Software Developer Java Mission Control team, Oracle February 6, 2018

Java Flight Recorder Runtime Guide Release 5.5

Alan Bateman Java Platform Group, Oracle November Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1

Java Platform, Standard Edition Java Flight Recorder Command Reference. Release 10

Lesson 2 Dissecting Memory Problems

Java Performance: The Definitive Guide

Project Loom Ron Pressler, Alan Bateman June 2018

Ahead of Time (AOT) Compilation

The Z Garbage Collector Low Latency GC for OpenJDK

ORACLE ENTERPRISE MANAGER 10g ORACLE DIAGNOSTICS PACK FOR NON-ORACLE MIDDLEWARE

JDK 9/10/11 and Garbage Collection

The Z Garbage Collector An Introduction

Zing Vision. Answering your toughest production Java performance questions

The Z Garbage Collector Scalable Low-Latency GC in JDK 11

JVM Memory Model and GC

JVM Troubleshooting MOOC: Troubleshooting Memory Issues in Java Applications

Oracle Java SE Advanced for ISVs

2011 Oracle Corporation and Affiliates. Do not re-distribute!

Oracle WebCenter Portal Performance Tuning

generate-jvm-report shows the threads, classes, memory, and loggers for a given target instance. Name Synopsis

Servlet Performance and Apache JServ

Mark Falco Oracle Coherence Development

The G1 GC in JDK 9. Erik Duveblad Senior Member of Technical Staf Oracle JVM GC Team October, 2017

Virtual Machine Design

InnoDB: Status, Architecture, and Latest Enhancements

Safe Harbor Statement

Flight Recorder Run Time Guide Release R28

End-to-End Java Security Performance Enhancements for Oracle SPARC Servers Performance engineering for a revenue product

What's new in MySQL 5.5? Performance/Scale Unleashed

Unified JVM Logging in JDK 9

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Attila Szegedi, Software

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Distributed Systems 8. Remote Procedure Calls

Concurrent Garbage Collection

The Art of JVM Profiling. Andrei Pangin Vadim Tsesko

A RESTful Java Framework for Asynchronous High-Speed Ingest

TIBCO BusinessEvents Extreme. System Sizing Guide. Software Release Published May 27, 2012

Elastic Data. Harvey Raja Principal Member Technical Staff Oracle Coherence

generate-jvm-report shows the threads, classes, memory, and loggers for a given target instance. Name Synopsis

A NEW PLATFORM FOR A NEW ERA. Copyright 2014 Pivotal. All rights reserved.

<Insert Picture Here> Get on the Grid. JVM Language Summit Getting Started Guide. Cameron Purdy, VP of Development, Oracle

Application Management Webinar. Daniela Field

Separating Access Control Policy, Enforcement, and Functionality in Extensible Systems. Robert Grimm University of Washington

Java in a World of Containers

MySQL Performance Tuning 101

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

Why GC is eating all my CPU? Aprof - Java Memory Allocation Profiler Roman Elizarov, Devexperts Joker Conference, St.

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

Is your profiler speaking the same language as you? Simon

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Fundamentals of GC Tuning. Charlie Hunt JVM & Performance Junkie

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program.

CSE 451: Operating Systems Winter Processes. Gary Kimura

Debugging Your Production JVM TM Machine

High-Level Language VMs

Enterprise Architect. User Guide Series. Profiling

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

Enterprise Architect. User Guide Series. Profiling. Author: Sparx Systems. Date: 10/05/2018. Version: 1.0 CREATED WITH

<Insert Picture Here> Maxine: A JVM Written in Java

Using Intel VTune Amplifier XE and Inspector XE in.net environment

Windows Java address space

NPTEL Course Jan K. Gopinath Indian Institute of Science

Don t Get Caught In the Cold, Warm-up Your JVM Understand and Eliminate JVM Warm-up Overhead in Data-parallel Systems

Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls

Buffer Management for XFS in Linux. William J. Earl SGI

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Java Without the Jitter

Dynamic Memory Allocation

Java performance - not so scary after all

Garbage Collection. Steven R. Bagley

Compiler Design Spring 2017

6.035 Project 3: Unoptimized Code Generation. Jason Ansel MIT - CSAIL

Extreme Performance Platform for Real-Time Streaming Analytics

Typical Issues with Middleware

CA485 Ray Walshe Google File System

<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2

6.828: OS/Language Co-design. Adam Belay

Apache Spark 2.0 Performance Improvements Investigated With Flame Graphs. Luca Canali CERN, Geneva (CH)

TIBCO ActiveSpaces Transactions. System Sizing Guide. Software Release Published February 15, 2017

Application Container Cloud

A program execution is memory safe so long as memory access errors never occur:

Chapter 8: Memory-Management Strategies

TIBCO BusinessEvents Extreme. System Sizing Guide. Software Release Published February 17, 2015

Oracle Business Activity Monitoring 12c Best Practices ORACLE WHITE PAPER DECEMBER 2015

InnoDB: What s new in 8.0

Transformation-free Data Pipelines by combining the Power of Apache Kafka and the Flexibility of the ESB's

Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring. Timothy Burris, Cloud Adoption & Technical Enablement

Chapter 9 Memory Management

Java Mission Control & Java Flight Recorder in JDK 9 A Sneak Peek

10/26/2017 Universal Java GC analysis tool - Java Garbage collection log analysis made easy

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace

Java in a World of Containers

DB Connect Is Back. and it is better than ever. Tyler Muth Denis Vergnes. September 2017 Washington, DC

Running class Timing on Java HotSpot VM, 1

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Java Performance Tuning and Optimization Student Guide

Performance Analysis of Java Communications with and without CORBA

Vertical Profiling: Understanding the Behavior of Object-Oriented Applications

Transcription:

Welcome to the session... Copyright 2013, Oracle and/or its affiliates. All rights reserved. 02/22/2013 1

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. Basically, don t trust anything I say... Copyright 2013, Oracle and/or its affiliates. All rights reserved. 02/22/2013 2

Java Flight Recorder - Next generation diagnostics and profiling Rickard Bäckman HotSpot JVM Compiler Team, Java Platform

public class Example { public void savetransaction(transaction tn) { synchronized (somelock) { // save to some shared data structure } } } 4

public class Example { public void savetransaction(transaction tn) { System.err.println(threadId + Waiting for lock ); synchronized (somelock) { System.err.println(threadId + Got lock ); // save to some shared data structure } System.err.println(threadId + Lock released ); } } 5

... few million lines of output [T1] Waiting for lock [T3] Waiting for lock [T2] Waiting for lock [T2] Got lock [T1] Got lock [T1] Lock released [T3] Got lock [T3] Lock released [T2] Lock released... another million lines of output 6

Java Flight Recorder - Overview Released in 7u40 7

Java Flight Recorder - Overview 8

Java Flight Recorder - Overview Event Recorder & Profiler 9

Java Flight Recorder - Overview Implemented in the JVM 10

Java Flight Recorder - Overview No restart required 11

Java Flight Recorder - Overview After-the-facts analysis - What went wrong? 12

Event Recorder JVM tracks lots of information 13

Event Recorder JVMTI? 14

Event Recorder Instrumented JVM & JDK - Make that information visible 15

Profiler What is my CPU doing?!? 16

Inside the JVM Core in the JVM High-level things in Java 17

Inside the JVM Access to JVM internals & subsystems 18

Inside the JVM Class Unloading & Safepoints 19

Non-intrusive Designed to run all the time. In your production environment 20

Non-intrusive Low overhead Captures information that is already there 21

Non-intrusive Enable & disable at runtime 22

After-the-facts Problem in the environment 23

After-the-facts What happened before? 24

After-the-facts Keeps history of information 25

After-the-facts Java Mission Control - Dump the data on an SLA breach 26

Things JFR captures Compilation statistics Socket read/write VM Operations Context switches Object Count Exceptions Class Unload Garbage Collection Method Compilation CPU Load Class Load Object allocation Threads Locks Metaspace Statistics CodeCache Profiling Thread.sleep File read/write Garbage Collection statistics 27

Sampling Profiler How to implement a profiler? 28

Sampling Profiler JVMTI 29

Sampling Profiler Byte code instrumentation 30

Sampling Profiler Stop the thread, walk the stack, collect the methods. 31

Demo 32

Enable Java Flight Recorder -XX:+UnlockCommercialFeatures -XX:+FlightRecorder 33

Start recording -XX:StartFlightRecording=filename=<...>,duration=5m 34

Start on demand Java Mission Control or jcmd <pid> JFR.start <options> 35

Some interesting options stackdepth=<nr> dumponexit=<true/false> 36

Events Abstraction of captured information 37

Events Captures something interesting Latency? Performance? 38

Instant Events Happens instantly - Thread start, Thread stop, Class unload 39

Duration Events Happens over a period of time - Compilation, Garbage Collection, Wait for a lock 40

Requestable Events Something that should be done repeatedly - CPU Load, Profiling Events Context switches 41

Settings & Filtering Enable & disable 42

Settings & Filtering Threshold 43

Settings & Filtering Frequency / Period 44

Settings & Filtering Stack traces 45

Settings & Filtering Control signal / noise 46

Settings & Filtering Filter early! 47

Recording Start a recording 48

Recording Generates a stream of events 49

Recording Applies a filter and captures the remaining 50

Recording One stream of Events 51

Recording Multiple recordings 52

Recording The Union of Events 53

Profiles A preconfigured settings for a recording 54

Profiles default & profile 55

Profiles Create your own 56

Java Flight Recorder Implementation 57

Java Flight Recorder Challenges Assembly! File format Implementation Events C++ Low level Memory buffers 58

Challenges Overhead must be low 59

Challenges Memory footprint 60

Challenges The JVM environment is changing 61

Challenges Scalability 62

Events in detail Header Optional Size Event ID End Time Start Time Thread StackTrace Payload 63

Events in detail Self-describing Events 64

Event Metadata Name, Path, Description 65

Event Payload Metadata Name, Type, Description & Content Type 66

Content Type Semantics of a Value Content Type Displayed as Bytes 42 MB Percentage 42% Address 0xDEADBEEF Millis 242 ms 67

Content Type Can be multiple Values Content Type Class Displayed Class Loader Name Modifiers (public,final) 68

Event definition in HotSpot <event id="threadsleep" path="java/thread_sleep" label="java Thread Sleep" has_thread="true" has_stacktrace="true" is_instant="false"> <value type="millis" field="time" label="sleep Time"/> </event> What does it actually mean? path is a identifier for the UI, label is a description of the Event has_thread means each event is tied to a Thread has_stacktrace means get a stack trace for the Event is_instant decides whether it is instant event or not Finally the payload with a type name and a description. 69

Event in C++ EventThreadSleep event;...... if (event.should_commit()) { event.set_time(millis); event.commit(); } An example of an event in the HotSpot source code. This event repots the time a thread slept. Thread.sleep() So the event is created and when the thread returns from sleep we check if the event was enabled and should be committed. If so we save the time and commit. 70

Or in assembler 281: cmp BYTE [rbp-0x60],0x0 # should commit 285: je 300 # jump if zero 287: mov QWORD rbp-0x58],rbx # save time 291: lea rdi,[rbp-0x70] # get pointer 295: call 0x101b17dc4 # commit This is basically the assembler code generated for the same code (for amd64). Reserve some memory on the stack, initialize it. Check if the event was enabled, otherwise jump away. Save the time, get the pointer and call commit. The overhead of an event that is disabled is very small. Compare a value to zero and jump away. 71

Buffers Thread-local buffers 72

Buffers Promoted to Global buffers - Global buffers are circular Global Buffer Global Buffer Global Buffer Global Buffer 73

File Format Binary proprietary 74

File Format Fast writing 75

File Format Self Contained Header Event Records Event Meta Data 76

Low-level Enough High-Level Problems & Solutions 77

Starting Problem Classes are referenced by Events 78

Starting Problem java.lang.string 79

Starting Problem org.springframework.security.ui.preauth.preaut henticatedgrantedauthoritieswebauthenticatio ndetails 80

Starting Problem 99 characters! 81

Starting Problem class Klass { u8 _trace_id; } Introduce a unique ID event id class count 17 java.lang.integer 2 event id class count 17 242 2 java.lang.integer java.lang.string java.lang.math java.util.list 82

New problem Mapping 83

Class List Must be synchronized 84

Class List Class Load? 85

Class List Class Load? - Startup performance! 86

Class List End of a Recording? 87

Class List End of a Recording? - Classes can unload! 88

Class List Piggyback Class Unloading! 89

Class List The Class List can grow Big 90

Class List Lots of classes + Long class names = Lots of wasted memory 91

Tagged Classes Reserve a bit in the ID 92

Tagged Classes Tag referenced classes! #define CLASS_USED 1 void use_class_id(klass* const klass) { klass->_trace_id = CLASS_USED; } 93

Class List Classes come & go. Don t waste memory 94

Checkpoints Special Event 95

Checkpoints Writes the Class List, Resets the tags & clears the Class List class_pool.lookup(242) java.lang.integer method_pool.lookup(314) java.lang.math:pow() 96

Constant Pool Classes, Methods, Stack Traces, Threads, Thread Groups, Strings 97

Checkpoints - revisit Events + Constant Pools + Event Metadata = Checkpoint 98

Checkpoints - revisit checkpoint events constant pools meta-data... 99

Checkpoints - revisit Contain everything required to parse the events prior to the checkpoint 100

More information Whitepaper http://www.oracle.com/missioncontrol User Guide http://docs.oracle.com/javase/7/docs/technotes/guides/jfr/index.html Forum http://forums.oracle.com/community/developer/english/java/ java_hotspot_virtual_machine/java_mission_control 101

Q&A 102

Thank you 103