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



Similar documents
Java Debugging Ľuboš Koščo

TDA - Thread Dump Analyzer

Using jvmstat and visualgc to Solve Memory Management Problems

Debugging Java performance problems. Ryan Matteson

Java Troubleshooting and Performance

JAVA IN A NUTSHELL O'REILLY. David Flanagan. Fifth Edition. Beijing Cambridge Farnham Köln Sebastopol Tokyo

THE BUSY DEVELOPER'S GUIDE TO JVM TROUBLESHOOTING

Effective Java Programming. measurement as the basis

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

Manage and Monitor your JVM with JMX

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

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

Java Performance Tuning

Robert Honeyman

GlassFish Server Open Source Edition

Eclipse Memory Analyzer and other Java stuff

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

talent. technology. true business value

Deploying a Logi Info Application on WAS

CS 209 Programming in Java #1

Advanced Performance Forensics

1 How to Monitor Performance

Monitoring and Managing a JVM

NonStop Server for Java 7.0 Tools Reference Pages

VisualVM: Integrated and Extensible Troubleshooting Tool for the Java Platform

Java Garbage Collection Basics

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

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

Java Mission Control

WEBLOGIC ADMINISTRATION

Debugging Java Applications

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

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

What s Cool in the SAP JVM (CON3243)

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

Oracle WebLogic Thread Pool Tuning

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

Tool - 1: Health Center

Zing Vision. Answering your toughest production Java performance questions

An Overview of Java. overview-1

Monitoring, Tracing, Debugging (Under Construction)

2 Introduction to Java. Introduction to Programming 1 1

Oracle WebLogic Server 11g: Monitor and Tune Performance

PTC System Monitor Solution Training

An Oracle White Paper September Advanced Java Diagnostics and Monitoring Without Performance Overhead

Oracle JRockit Mission Control Overview

Extreme Performance with Java

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

Instrumentation Software Profiling

Advanced Liferay Architecture: Clustering and High Availability

How to Enable Remote JMX Access to Quartz Schedulers. M a y 1 2,

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

Deployment and Monitoring. Pascal Robert MacTI

Blackboard Open Source Monitoring

Java Power Tools. John Ferguson Smart. ULB Darmstadt 1 PI. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

WebLogic Server Admin

2015 ej-technologies GmbH. All rights reserved. JProfiler Manual

WebSphere v5 Administration, Network Deployment Edition

WEBSPHERE APPLICATION SERVER ADMIN V8.5 (on Linux and Windows) WITH REAL-TIME CONCEPTS & REAL-TIME PROJECT

Java SE Performance Tuning Revision A

Taming Operations in the Apache Hadoop Ecosystem. Jon Hsieh, Kate Ting, USENIX LISA 14 Nov 14, 2014

For Introduction to Java Programming, 5E By Y. Daniel Liang

Monitoring and Diagnosing Production Applications Using Oracle Application Diagnostics for Java. An Oracle White Paper December 2007

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

Discovering Performance Bottlenecks with the SAP JVM Profiler and SAP Memory Analyzer

WebSphere Server Administration Course

IBM WebSphere Server Administration

Building Applications with JBuilder

Identifying Performance Bottleneck using JRockit. - Shivaram Thirunavukkarasu Performance Engineer Wipro Technologies

MONITORING CF WHAT ARE MY OPTIONS AND WHY SHOULD I

Lab 4 In class Hands-on Android Debugging Tutorial

Chronon: A modern alternative to Log Files

Angelika Langer The Art of Garbage Collection Tuning

Java VM monitoring and the Health Center API. William Smith

Rational Application Developer Performance Tips Introduction

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

Simba XMLA Provider for Oracle OLAP 2.0. Linux Administration Guide. Simba Technologies Inc. April 23, 2013

<Insert Picture Here> Java Application Diagnostic Expert

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

IBM Technology for Java Virtual Machine in IBM i5/os

Architecting ColdFusion For Scalability And High Availability. Ryan Stewart Platform Evangelist

Java Performance. Adrian Dozsa TM-JUG

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

Top 10 Issues for Java in Production. SriSatish Ambati Cliff Click Jr. Azul Systems, Inc

Essentials of Java Performance Tuning. Dr Heinz Kabutz Kirk Pepperdine Sun Java Champions

Contents. Java - An Introduction. Java Milestones. Java and its Evolution

L01: Using the WebSphere Application Server Liberty Profile for lightweight, rapid development. Lab Exercise

Setting up PostgreSQL

Monitoring.NET Framework with Verax NMS

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

Monitoring HP OO 10. Overview. Available Tools. HP OO Community Guides

Development Environment and Tools for Java. Brian Hughes IBM

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

Troubleshoot Java Stack High CPU Utilization

Monitoring Java enviroment / applications

The Hotspot Java Virtual Machine: Memory and Architecture

Transcription:

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

http://docs.oracle.com/javase/7/docs/technotes/tools/ - No new tool in Java 7, very few changes in options Basic Tools : Security Tools : Internationalization Tools: Remote Method Invocation (RMI) Tools : Java IDL and RMI-IIOP Tools : Java Deployment Tools : Java Web Start Tools : Java Troubleshooting, Profiling : Monitoring and Management Tools : Java Web Services Tools : Troubleshooting Tools : Scripting Tools appletviewer, apt, extcheck, jar, java, javac, javadoc, javah, javap, jdb keytool, jarsigner, policytool, kinit, klist, ktab native2ascii rmic, rmiregistry, rmid, serialver tnameserv, idlj, orbd, servertool javafxpackager, pack200, unpack200 javaws jconsole, jps, jstat, jstatd, jvisualvm schemagen, wsgen, wsimport, xjc jinfo, jhat, jmap, jsadebugd, jstack jrunscript

start the demo here cd DemoServer javac $(find * grep.java) echo Main-Class: demo.jug.demoserver > manifest.txt jar -cvfm DemoServer.jar manifest.txt $(find * grep.class) java -jar DemoServer.jar

jps JVM Process Status Tool - Lists instrumented HotSpot JVMs on a target system. jps 18027 Java2Demo.JAR 18032 jps - Useful for getting the pid of the JVM. Needed for other commands. - Has options for listing arguments JVM arguments used, program arguments, application name, main class etc..

jstack Stack Trace for Java - Prints a stack trace of threads for a given process or core file or remote debug server Jstack 3299 Java stack information for the threads listed above: ================================================ === "BadRunnablePool--RunnableA": at demo.jug.demoserver$runnablea.run(demoserver.java:20 6) - waiting to lock <0xab789c98> (a java.lang.object - Useful for quickly seeing the current stack. - Can be grep-ed - Detects deadlocks - Can load a dump file.. Found one Java-level deadlock: ============================= "BadRunnablePool--RunnableA": waiting to lock monitor 0x08a65c9c (object 0xab789c98, a java.lang.object), which is held by "BadRunnablePool--RunnableA- RunnableA-RunnableA-RunnableB"

jstat JVM Statistics Monitoring Tool Collects and logs performance statistics as specified by the command line options Statistics on : -class -compiler -gc -gccapacity -gccause -gcnew -gcnewcapacity -gcold -gcoldcapacity -gcpermcapacity -gcutil -printcompilation Behavior of the class loader. Behavior of the HotSpot Just-in-Time compiler. Behavior of the garbage collected heap. Capacities of the generations and their corresponding spaces. Same as -gcutil, with the cause of the last and current Behavior of the new generation. Sizes of the new generations and its corresponding spaces. Behavior of the old and permanent generations. Sizes of the old generation. Sizes of the permanent generation. Summary of garbage collection statistics. HotSpot compilation method statistics.

jstat jstat -gcutil 3436 250 100 S0 S1 E O P YGC YGCT FGC FGCT GCT 46.27 0.00 93.71 5.44 15.05 2 0.010 0 0.000 0.010 46.27 0.00 99.49 5.44 15.05 2 0.010 0 0.000 0.010 0.00 60.73 7.10 5.44 15.05 3 0.011 0 0.000 0.011 0.00 60.73 11.85 5.44 15.05 3 0.011 0 0.000 0.011 0.00 60.73 18.47 5.44 15.05 3 0.011 0 0.000 0.011 0.00 60.73 23.44 5.44 15.05 3 0.011 0 0.000 0.011 0.00 60.73 31.07 5.44 15.05 3 0.011 0 0.000 0.011... -Quickly profile and see what s happening to the JVM -Can grep it, use output for specific project tools

Java Command line debugger jdb -Can connect to JVMs not started in debug-mode, with read-only functionality.! This does not include setting breakpoints. Does include : thread-stack-moving, dumping locals, seeing source code etc.. # connect directly to JVM jdb -connect sun.jvm.hotspot.jdi.sapidattachingconnector:pid=2343 # connect through debug-daemon to JVM (jsadebugd <pid> started first) jdb connect sun.jvm.hotspot.jdi.sadebugserverattachingconnector:debugservername=192.168.1.102 # or to core dump files jdb connect sun.jvm.hotspot.jdi.sacoreattachingconnector:javaexecutable=$java_home/bin/java,core=~/corefile

jdb - Connect to process started in debug java -agentlib:jdwp=transport=dt_socket,address=localhost:3333,server=y,suspend=y -jar DemoServer.jar jdb -connect com.sun.jdi.socketattach:hostname=localhost,port=3333 - see threads - see stack traces, live - stepping - catch exceptions and decide flow -breakpoints -watch points Advantages over IDE : -really fast over far-away servers -quick debugging -can debug without having the source code locally Disadvantages over IDE : -no conditional breakpoints - slow use for daily dev-debug

jmap -Memory Map for Java - Prints shared object memory maps or heap memory details of a given process or core file or a remote debug server - Can be used for obtaining quick info on memory (heap status, GC used) - Most commonly used to obtain heap dump - Dump can be further used by analysis in non-standard profilers too. jmap -dump:format=b,file=dump1 3813 Take a snapshot in some critical moment and analyze it later.!! Pauses the JVM until it is done Why did the servers take so much memory, what objects did we have etc..

jhat Heap Dump Browser Starts a web server on a heap dump file (for example, produced by jmap -dump), allowing the heap to be browsed. Can make all sorts of cool standard queries - All Classes Query - Class Query - Object Query - Instances Query - Roots Query - Reachable Objects Query - Instance Counts for All Classes Query - All Roots Query - Histogram Queries jhat dump1 - New Instances Query (cool diff between dumps)

jhat Can also make custom OQL queries select JavaScript-expression-to-select [ from [instanceof] classname identifier [ where JavaScript-boolean-expression-to-filter ] ] select s from java.util.arraylist s where s.size >= 2000

jvisualvm Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the functionality offered by the standalone tools jmap, jinfo, jstat and jstack have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug-ins. java -Dcom.sun.management.jmxremote.port=5555 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.1.102 -jar DemoServer.jar jstatd -J-Djava.security.policy=permissions.txt -J-Djava.rmi.server.hostname=192.168.1.102

jvisualvm

jvisualvm

jvisualvm And much more other cool stuff

Thank you for your time http://docs.oracle.com/javase/7/docs/technotes/tools/ http://docs.oracle.com/javase/7/docs/webnotes/tsg/tsg-vm/html/tools.html Further reading and advanced uses of some tools Java Performance - Charlie Hunt (Author), Binu John) Publication Date: October 14, 2011