Effective Java Heap Memory Analysis on Enterprise-Scale SAP Memory Analyzer. Vedran Lerenc, SAP NetWeaver Java Server Technology October 11th 2007

Similar documents
Basic Steps and Features Walk-through

Practical Lessons in Memory Analysis

AUTOMATED HEAPDUMP ANALYSIS FOR DEVELOPERS, TESTERS, AND SUPPORT EMPLOYEES

Eclipse Memory Analyzer Release Review

SAP Memory Analyzer: Multi-Gigabyte Java Heap Dumps Are Nothing to Fear Now

Eclipse Memory Analyzer Graduation, Move and 1.0 Release Review

Eclipse Memory Analyzer Release Review 0.8

Java performance - not so scary after all

MemoryLint. Petr Nejedlý, Radim Kubacki SUN Microsystems, BOF-9066

Effec%ve So*ware. Lecture 9: JVM - Memory Analysis, Data Structures, Object Alloca=on. David Šišlák

Need to Node: Profiling Node.js Applications

JPDM, A Structured approach To Performance Tuning. Copyright 2017 Kirk Pepperdine. All rights reserved

Debugging Your Production JVM TM Machine

profiling Node.js applications

MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION

1 Performance Optimization in Java/J2EE

IBM Monitoring and Diagnostic Tools for Java TM...

Dynamic Memory Allocation

Big Data Infrastructure at Spotify

Kodewerk. Java Performance Services. The War on Latency. Reducing Dead Time Kirk Pepperdine Principle Kodewerk Ltd.

Heap Compression for Memory-Constrained Java

Best Practices for Developing & Deploying Java Applications with Docker

CA341 - Comparative Programming Languages

Realtime Search with Lucene. Michael

CSE 373: Data Structures and Algorithms. Memory and Locality. Autumn Shrirang (Shri) Mare

JVM Memory Model and GC


A new Mono GC. Paolo Molaro October 25, 2006

Manjunath Subburathinam Sterling L2 Apps Support 11 Feb Lessons Learned. Peak Season IBM Corporation

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

Typical Issues with Middleware

Troubleshooting Memory Problems in Java Applications

Scalable Post-Mortem Debugging Abel Mathew. CEO -

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

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

Building Memory-efficient Java Applications: Practices and Challenges

OSGi on the Server. Martin Lippert (it-agile GmbH)

Java Memory Management. Märt Bakhoff Java Fundamentals

StackVsHeap SPL/2010 SPL/20

CS-537: Midterm Exam (Fall 2008) Hard Questions, Simple Answers

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

Enterprise Architect. User Guide Series. Profiling

Concurrent Garbage Collection

Computer Memory. Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1

NG2C: Pretenuring Garbage Collection with Dynamic Generations for HotSpot Big Data Applications

Java Performance Tuning From A Garbage Collection Perspective. Nagendra Nagarajayya MDE

An Oracle White Paper October Advanced Compression with Oracle Database 11g

How to keep capacity predictions on target and cut CPU usage by 5x

Programming in Android. Nick Bopp

Diagnostics in Testing and Performance Engineering

Connecting ESRI to Anything: EAI Solutions

The HALFWORD HEAP EMULATOR

Leak Canary Intro Jennifer McGee

Today s Agenda. Today s Agenda 9/8/17. Networking and Messaging

ANALYZING THE MOST COMMON PERFORMANCE AND MEMORY PROBLEMS IN JAVA. 18 October 2017

Future of JRockit & Tools

ECE 598 Advanced Operating Systems Lecture 10

Lab 9. Julia Janicki. Introduction

Java Performance: The Definitive Guide

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

Application Management Webinar. Daniela Field

MODULE 1 JAVA PLATFORMS. Identifying Java Technology Product Groups

JVM and application bottlenecks troubleshooting

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Welcome to this IBM podcast, Realizing More. Value from Your IMS Compiler Upgrade. I'm Kimberly Gist

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Open Programmable Architecture

Java & Coherence Simon Cook - Sales Consultant, FMW for Financial Services

Eclipse as a Web 2.0 Application Position Paper

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

SAP EDUCATION SAMPLE QUESTIONS: C_TBIT51_73. Questions. Note: There are 2 correct answers to this question. developer. the basis administrator.

Building mobile app using Cordova and AngularJS, common practices. Goran Kopevski

Rows and Range, Preceding and Following

Managed runtimes & garbage collection

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

SaaS Integration. Rick Nucci. Addressing a top 3 priority for SaaS adoption. Founder and CTO Boomi

Lesson 3 Diagnostic Data Collection and Analysis tools

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

About Terracotta Ehcache. Version 10.1

Performance Per Watt. Native code invited back from exile with the Return of the King:

Book keeping. Will post HW5 tonight. OK to work in pairs. Midterm review next Wednesday

A deep dive into QML memory management internals

SELF-AWARE APPLICATIONS AUTOMATIC PRODUCTION DIAGNOSIS DINA GOLDSHTEIN

Static analysis for quality mobile applications

Lesson 2 Dissecting Memory Problems

From Java Code to Java Heap Understanding the Memory Usage of Your Application

SAP NetWeaver 04, 7.0, 7.01, CE 7.1, CE 7.11

Heapy a memory profiler and debugger for Python

Memory Management 3/29/14 21:38

Troubleshooting Guide and FAQs Community release

It s Not the Cost, It s the Quality! Ion Stoica Conviva Networks and UC Berkeley

In the following chapter two most common WAFS architectures are presented and the most common and simple set of used techniques is shown.

Welcome to the session...

Storage. Outline. Variables and updating. Copy vs. Ref semantics Lifetime. Dangling References Garbage collection

Understanding Latency and Response Time Behavior

Find native memory leaks in Java

Data Structure Aware Garbage Collector

Overview of Caffeine ABAP to Go

Run-time Environments - 3

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

Transcription:

Effective Java Heap Memory Analysis on Enterprise-Scale SAP Memory Analyzer Vedran Lerenc, SAP NetWeaver Java Server Technology October 11th 2007

Memory 101 Heap MB Full Garbage Collection 2 a.m. Out Of Memory Minor Garbage Collection Memory utilization trend IOIOII IOIIOI OIOIO IIOIIOI -XX:+Heap DumpOnOutOf MemoryError t SAP 2007 / Page 2

Agenda 1. Memory 101 1.1. Java Memory Classification 1.2. HPROF Binary Heap Dump Content 1.3. How To Acquire A Heap Dump 2. Analysis Techniques 2.1. Shallow Size vs. Retained Size 2.2. Dominator Tree 2.3. Aggregation Patterns 2.4. 4-Step Approach To Finding Issues 3. Summary 3.1. Critical Problems 3.2. Lessons Learned 3.3. Announcement SAP 2007 / Page 3

Java Memory Classification (Very Simplified View) MB Heap Objects Perm Classes SAP 2007 / Page 4

HPROF Binary Heap Dump Content MB IOIOII IOIIOI OIOIO IIOIIOI All Objects Class, fields, primitive values and references All Classes ClassLoader, name, super class, static fields All ClassLoaders Defined classes Garbage Collection Roots Objects defined to be reachable by the JVM SAP 2007 / Page 5

HPROF Binary Heap Dump Content MB IOIOII IOIIOI OIOIO IIOIIOI A heap dump contains a snapshot of objects that are alive at one point in time. A full GC is triggered before the heap dump is written. IOIOII IOIIOI OIOIO IIOIIOI A heap dump cannot not answer who and where objects have been created. which objects have been garbage collected. SAP 2007 / Page 6

How To Acquire A Heap Dump Available in 1.4.2_12 and 5.0_ 7 and 6.0 upwards -XX:+HeapDumpOnOutOfMemoryError Alternatives to get it on demand -XX:+HeapDumpOnCtrlBreak jmap -dump:format=b,file=<filename.hprof> <pid> JConsole SAP Memory Analyzer / JVMMON / (MMC)

Demo SAP Memory Analyzer Disclaimer: Class, class loader and thread names have been changed to protect the identity of our customers. Any similarities to actual disasters that you have witnessed, either in real or virtual reality, are purely coincidental.

Agenda 1. Memory 101 1.1. Java Memory Classification 1.2. HPROF Binary Heap Dump Content 1.3. How To Acquire A Heap Dump 2. Analysis Techniques 2.1. Shallow Size vs. Retained Size 2.2. Dominator Tree 2.3. Aggregation Patterns 2.4. 4-Step Approach To Finding Issues 3. Summary 3.1. Critical Problems 3.2. Lessons Learned 3.3. Announcement SAP 2007 / Page 9

Shallow Size vs. Retained Size class X { static } LinkedList LinkedList$Entry SomeEntry String char[]

Determine Retained Size via GC Simulation 1. Remove all references to object X 2. Mark all objects which are still reachable from the GC Roots 3. The unmarked objects constitute the retained set of object X

Demo SAP Memory Analyzer Disclaimer: Class, class loader and thread names have been changed to protect the identity of our customers. Any similarities to actual disasters that you have witnessed, either in real or virtual reality, are purely coincidental.

Dominator Tree X dominates Y if all paths from the roots to Y run through X

Dominator Tree Benefit #1 Retained Set and Size is just a Sub-Tree Retained Set Retained Size

Dominator Tree Benefit #2 Quickly Find the Greedy Memory Pigs Immediate Dominator Shows the Closest Responsible for Keeping an Analyzed Object Alive

Dominator Tree Benefit #3 Quick Approximation for the Retained Size + Quick approximation of the Retained Size for a set of objects is done by summing up the distinct top dominators in the set

Dominator Tree Benefit #4 Biggest Distinct Object Graphs Top-level Dominators Show Biggest Distinct Objects Easy Grouping by Class, ClassLoader

Demo SAP Memory Analyzer Disclaimer: Class, class loader and thread names have been changed to protect the identity of our customers. Any similarities to actual disasters that you have witnessed, either in real or virtual reality, are purely coincidental.

Aggregation Patterns 1. Look For A Property 2. Group Objects By It 3. Inspect Big Memory Chunks 4. Identify Systematic Activity Examples: Arrays by Length Strings by Value It s like looking for the butterfly swallowed by the hurricane it has caused!

Group in Top Dominators Group Along Shortest Paths Group Dominator Tree by class to find big groups of distinct object graphs Multiple Paths shows common sections near the GC roots

Group Referrers by Class (list) (header) (entries) (payload)

Demo SAP Memory Analyzer Disclaimer: Class, class loader and thread names have been changed to protect the identity of our customers. Any similarities to actual disasters that you have witnessed, either in real or virtual reality, are purely coincidental.

4-Step Approach To Finding Issues Get an Overview Find Big Chunks Inspect Content Identify Holders Total heap size Total number of objects, classes and class loaders Class Histogram SAP 2007 / Page 23

Agenda 1. Memory 101 1.1. Java Memory Classification 1.2. HPROF Binary Heap Dump Content 1.3. How To Acquire A Heap Dump 2. Analysis Techniques 2.1. Shallow Size vs. Retained Size 2.2. Dominator Tree 2.3. Aggregation Patterns 2.4. 4-Step Approach To Finding Issues 3. Summary 3.1. Critical Problems 3.2. Lessons Learned 3.3. Announcement SAP 2007 / Page 24

Critical Problems Heap Inefficient data structures (e.g. badly used collections, keeping XML DOM,...) Caches (i.e. unknown entry size, different competing caches,...) Perm Model/Proxy-driven class generation Leaking loaders In General Real size of objects not apparent to programmer No application/user quota

Lessons Learned Inspecting heap dumps of enterprise scale needs new ideas and approaches Performance is crucial Functionality is even more important to tell apart noise from real problems It s not about leaks, it s about footprint It s relatively easy to find the leak But it s really difficult to get down general memory consumption of a component Analysis can be automated (Expert System) Instead of figuring it out yourself, let the tool do the job for you That s our current focus!

Announcement Today: SAP Memory Analyzer is Free Software. Handles large heap dumps easily I am pretty impressed Very nice UI It's really fast Soon: SAP Memory Analyzer goes This Open tool is my Source! favorite Significant performance advantage Performance is great Exceedingly easy to use Eclipse Technology Bravo! Project Quickly exposed problem Very Cool Quite impressed SAP 2007 / Page 27

Thank you! Vedran Lerenc, SAP NetWeaver Java Server Technology October 11th 2007 WIKI & Download @ www.sdn.sap.com/irj/sdn/wiki?path=/display/java/java+memory+analysis or just for SAP Memory Analyzer SAP 2007 / Page 28