Using jvmstat and visualgc to Solve Memory Management Problems



Similar documents
Java Debugging Ľuboš Koščo

Java Performance Tuning

Java Garbage Collection Basics

Oracle Corporation Proprietary and Confidential

THE BUSY DEVELOPER'S GUIDE TO JVM TROUBLESHOOTING

Java Troubleshooting and Performance

Garbage Collection in the Java HotSpot Virtual Machine

Tools in the Box. Quick overview on helpful tools in the JDK and use cases for them. Florin Bunau

VisualVM: Integrated and Extensible Troubleshooting Tool for the Java Platform

Performance Monitoring and Tuning. Liferay Chicago User Group (LCHIUG) James Lefeu 29AUG2013

Tool - 1: Health Center

How To Use Java On An Ipa (Jspa) With A Microsoft Powerbook (Jempa) With An Ipad And A Microos 2.5 (Microos)

Advanced Liferay Architecture: Clustering and High Availability

Extreme Performance with Java

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

Debugging Java performance problems. Ryan Matteson

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

Memory Management in the Java HotSpot Virtual Machine

The Fundamentals of Tuning OpenJDK

Troubleshoot the JVM like never before. JVM Troubleshooting Guide. Pierre-Hugues Charbonneau Ilias Tsagklis

Garbage Collection in NonStop Server for Java

High-Availability. Configurations for Liferay Portal. James Min. Senior Consultant / Sales Engineer, Liferay, Inc.

Oracle WebLogic Server 11g: Monitor and Tune Performance

The Hotspot Java Virtual Machine: Memory and Architecture

<Insert Picture Here> Java Application Diagnostic Expert

Java Monitoring. Stuff You Can Get For Free (And Stuff You Can t) Paul Jasek Sales Engineer

Robert Honeyman

USE IMPROVE EVANGELIZE. JVM Internals, Stefan Parvu System Administrator.

Debug 101-Using ISA Tools for Apps in WebSphere Application Server z/os

Java Performance. Adrian Dozsa TM-JUG

Holly Cummins IBM Hursley Labs. Java performance not so scary after all

Effective Java Programming. measurement as the basis

Angelika Langer The Art of Garbage Collection Tuning

Berlin Mainframe Summit. Java on z/os IBM Corporation

Java Garbage Collection Characteristics and Tuning Guidelines for Apache Hadoop TeraSort Workload

How To Improve Performance On An Asa 9.4 Web Application Server (For Advanced Users)

A Practical Method to Diagnose Memory Leaks in Java Application Alan Yu

JVM Garbage Collector settings investigation

Tuning Your GlassFish Performance Tips. Deep Singh Enterprise Java Performance Team Sun Microsystems, Inc.

Language Based Virtual Machines... or why speed matters. by Lars Bak, Google Inc

Implementing a Well- Performing and Reliable Portal

Lua as a business logic language in high load application. Ilya Martynov ilya@iponweb.net CTO at IPONWEB

HeapStats: Your Dependable Helper for Java Applications, from Development to Operation

Instrumentation Software Profiling

IBM SDK, Java Technology Edition Version 1. IBM JVM messages IBM

What s Cool in the SAP JVM (CON3243)

TDA - Thread Dump Analyzer

B M C S O F T W A R E, I N C. BASIC BEST PRACTICES. Ross Cochran Principal SW Consultant

Validating Java for Safety-Critical Applications

A technical guide for monitoring Adobe LiveCycle ES deployments

General Introduction

Web Performance, Inc. Testing Services Sample Performance Analysis

11.1 inspectit inspectit

Java on z/os. Agenda. Java runtime environments on z/os. Java SDK 5 and 6. Java System Resource Integration. Java Backend Integration

JBoss Cookbook: Secret Recipes. David Chia Senior TAM, JBoss May 5 th 2011

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 5

Optimize GlassFish Performance in a Production Environment Performance White Paper February Abstract

BEAJRockit Mission Control. Using JRockit Mission Control in the Eclipse IDE

PTC System Monitor Solution Training

IBM WebSphere Server Administration

WebSphere Server Administration Course

Jonathan Worthington Scarborough Linux User Group

System Structures. Services Interface Structure

Part 3 - Performance: How to Fine-tune Your ODM Solution. An InformationWeek Webcast Sponsored by

WebSphere Performance Monitoring & Tuning For Webtop Version 5.3 on WebSphere 5.1.x

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

Performance Testing and Optimization in Web-Service Based Applications

THE BUSY JAVA DEVELOPER'S GUIDE TO WEBSPHERE DEBUGGING & TROUBLESHOOTING

MID-TIER DEPLOYMENT KB

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

Enterprise Manager Performance Tips

University of Southern California Shibboleth High Availability with Terracotta

JBoss Seam Performance and Scalability on Dell PowerEdge 1855 Blade Servers

Mobile Application Development Android

Practical Performance Understanding the Performance of Your Application

Monitoring and Managing a JVM

Mission-Critical Java. An Oracle White Paper Updated October 2008

Production time profiling On-Demand with Java Flight Recorder

JBoss Data Grid Performance Study Comparing Java HotSpot to Azul Zing

CSCI E 98: Managed Environments for the Execution of Programs

Oracle JRockit Mission Control Overview

Introduction to Spark and Garbage Collection

Zulu by Azul OpenJDK for Azure

Oracle WebLogic Server 11g Administration

Blackboard Learn TM, Release 9 Technology Architecture. John Fontaine

Glassbox: Open Source and Automated Application Troubleshooting. Ron Bodkin Glassbox Project Leader

Chapter 2 System Structures

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

OpenProdoc. Benchmarking the ECM OpenProdoc v 0.8. Managing more than documents/hour in a SOHO installation. February 2013

Profiling and Testing with Test and Performance Tools Platform (TPTP)

Chapter 3 Operating-System Structures

IBM Tivoli Composite Application Manager for WebSphere

24x7 Scheduler Multi-platform Edition 5.2

Using Tomcat with CA Clarity PPM

JVM Performance Study Comparing Oracle HotSpot and Azul Zing Using Apache Cassandra

IBM Tivoli Composite Application Manager for WebSphere

Manage and Monitor your JVM with JMX

Transcription:

Using jvmstat and visualgc to Solve Memory Management Problems java.sun.com/javaone/sf 1 Wally Wedel Sun Software Services Brian Doherty Sun Microsystems, Inc.

Analyze JVM Machine Memory Management Problems Understanding memory management behavior Learn how to use jvmstat and visualgc to analyze and solve Java HotSpot virtual machine and Java technology-based application memory management problems 2

Agenda Monitoring overview jvmstat overview Designing for memory management Memory management problems Tiger update 3

Agenda Monitoring overview jvmstat overview Designing for memory management Memory management problems Tiger update 4

Monitoring and You Monitoring goals Maintain and manage system health Detection of performance problems Performance analysis Find source of performance problems Problem resolution System or application performance tuning System resource improvements Change design or implementation 5

Performance Management Process Start Analysis Design Code Benchmark Performance OK No Profile Monitor Yes Deploy 6

Agenda Monitoring overview jvmstat overview Well optimized applications Memory management problems Tiger update 7

What Is jvmstat? Light weight performance monitoring for the Java HotSpot virtual machine Java HotSpot VM instrumentation Monitoring tools Java Application Application Server Java Virtual Machine Operating System Hardware 8

Always On No special command line options No script modifications No app server configuration modifications No application restarts No down time No excuses All Java HotSpot virtual machine and J2SE platform functional, regression, and performance tests run with instrumentation turned on 9

jvmstat Tools jvmps Java process listing tool jvmstat Command line statistics logging tool visualgc JFC/Swing based tool for visualizing the operations of the Java HotSpot VM perfagent RMI server for remote monitoring 10

Instrumentation Configuration Classpath, path, library paths, etc. Basic Java language properties JVM software arguments, main args Class loader JIT compiler Garbage collector Space sizes, utilization Collection count, times 11

Generational Garbage Collected Heap Virtual Perm Permanent Generation Virtual Tenured (Old) Generation Tenured Virtual Survivor 0 Survivor 1 Eden Young Generation 12

Demo visualgc demo 13 2004 JavaOneJ SMS M Conference C Session S TS-2428 X X X X

Agenda Monitoring overview jvmstat overview Designing for memory management Memory management problems Tiger update 14

Design for Memory Management Don t second guess your garbage collector! Don t avoid allocation of transient objects Object creation is fast Thread local JIT optimized Minor GC is fast and efficient Minor GC can be multi-threaded Minimize long-lived objects Eventually promote to Old Gen Major (Full) GC takes longer than Minor GC Avoid object caching Move infrequently accessed long-lived objects to persistent storage 15

Design for Memory Management (Cont.) Avoid calling System.gc() Results in Full GC event Advisory only Avoid frequent allocation of large transient objects Result in direct allocation in Old Gen Classes are objects too Allocated in Perm Gen Requires Major (Full) GC Well-designed class loads and unloads Watch out for dynamically generated JSP pages 16

Design for Memory Management (Cont.) Avoid finalized objects Requires additional GC work Promptness not guaranteed Use java.lang.ref classes instead 17

Typical Memory Management Tuning Even well-behaved applications may need tuning Regular application pauses RMI DGC activity or System.gc() calls Tune RMI DGC period Premature Full GC -XX:NewRatio (NewSize/MaxNewSize) too large Long application pauses Caused by long full garbage collections Premature promotion Undersized Eden and Survivor spaces Poor throughput Caused by frequent garbage collections 18

Agenda Monitoring overview jvmstat overview Designing for memory management Memory management problems Tiger update 19

Application Design Problems Memory leaks Unproductive Full GCs leading to OOM error Too many long lived objects object caches Frequent, long Full GC events Poor throughput Frequent allocation of large objects Overriding Object.finalize() Excessive class loading and unloading Full GC required to unload classes Avoid use of -Xnoclassgc 20

Analyzing Memory Management In the following demo: A small application Contrived memory management problems Premature promotion causing Major GC s rather than Minor GC s Out of memory problem due to Perm Gen exhaustion Out of memory problem due to Old Gen exhaustion caused by slow release of object graphs Allocation of very large objects directly to Old Gen Illustrate the problems using visualgc 21

Demo Analysis Patterns in visualgc 22 2004 JavaOneJ SMS M Conference C Session S TS-2428 X X X X

Demo Summary Solution strategies Premature promotion causing Major GC s rather than Minor GC s Adjust java command parameters to allocate more heap to Young Gen (40% max recommended) Resize Survivor Spaces to allow more objects to be retained in Young Gen Modify application to produce fewer smaller objects that can be collected from Young Gen 23

Demo Summary (2) Solution strategies Out of memory problem due to Perm Gen exhaustion Enlarge Perm Gen space using -XX:MaxPermGen Modify application to use fewer interned Strings or fewer JSP pages Avoid use of -Xnoclassgc 24

Demo Summary (3) Solution strategies Out of memory problem due to Old Gen exhaustion caused by slow release of object graphs Modify application to release unused or unneeded object graphs Avoid unnecessary object caching Debug object leaks Modify java command to use larger heap size Use 64-bit JVM technology to enable heaps larger than 4GB 25

Agenda Monitoring overview jvmstat overview Well optimized applications Memory management problems Tiger update 26

Tiger Update jvmstat technologies Subset of jvmstat tools jps jvmps jstat jvmstat and jsnap jstatd perfagent Unsupported demo tools in SDK only Backward compatible with Java HotSpot VM 1.4.1 and 1.4.2 Monitor previous versions with Tiger SDK visualgc available as a separate download http://www.sun.com/developers/coolstuff 27

Tiger Update JSR 174 JVM software monitoring and management New java.lang.management APIs Monitoring and management interfaces JMX API-based Memory threshold event notification API New java.lang.instrument APIs Byte-code instrumentation support jconsole demo application Packaged with SDK only 28

Tiger Update Serviceability tools Demo Tools for debugging and monitoring jstack java stack trace Native and java frames with -m option jmap java memory map Heap configuration, object histogram jinfo JVM software information JVM machine flag settings, system properties jsadebugd remote access Heavier weight than jvmstat Stops process momentarily Solaris Operating System and Linux only 29

30 Tiger Update Smart tuning Specify pause time, throughput, and memory utilization goals Garbage collector monitors various memory allocation and collection patterns Dynamically resizes GC spaces Optimize GC performance based on measured memory allocation behavior Server class systems (-XX:+UseParallelGC) Young Gen resizing initially Inter-generation resizing in future Heap tuning becomes largely unnecessary for most applications

Summary visualgc offers immediate analysis jvmstat offers later analysis Strive for good memory utilization Recognize indicators of memory utilization problems Use java command line parameters to alleviate problems 31

Call to Action Understand your Java application s memory management characteristics Monitor your production applications using lightweight monitoring tools. Tune the Java HotSpot VM and improve your Java technology-based application s memory management characteristics to achieve optimal system performance. 32

33 For More Information Sessions: TS-1216 Choices and Trade-Offs in Garbage Collection in the Java HotSpot VM TS-3065 Observability Architecture in the J2SE 1.5 Platform TS-2861 Monitoring and Management of the Java 2 Platform, Standard Edition (J2SE ) BOF BOF-1217 Performance of J2SE, J2EE, Web Server, Web Services, Portal Hands-On Lab 7232 Java Technology-Based Application Performance Analysis Visit our website http://java.sun.com/performance/

Q&A Wally Wedel, Brian Doherty 34 2004 JavaOneJ SMS M Conference C Session S TS-2428 X X X X

Using jvmstat and visualgc to Solve Memory Management Problems java.sun.com/javaone/sf 35 Wally Wedel Sun Software Services Brian Doherty Sun Microsystems, Inc.