monitoring java applications and detecting performance ... · 2 agenda introduction problems of...

21
Tomáš Hůrka, Jiří Sedláček [email protected], [email protected] Monitoring Java applications and detecting performance problems using JDK tools and NetBeans Profiler

Upload: others

Post on 23-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

Tomáš Hůrka, Jiří Sedláč[email protected], [email protected]

Monitoring Java applications and detecting performance

problems using JDK tools and NetBeans Profiler

Page 2: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

2

Agenda● Introduction● Problems of Java applications●Monitoring tools in JDK● JDK 5.0● JDK 6.0

● Performance diagnosis, profiling● Profilers, profiling techniques● NetBeans Profiler

Page 3: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

3

Introduction

● Goals of this session:● Describe typical problems of Java

applications● Present tools and techniques to discover

these problems

Page 4: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

4

Agenda● Introduction● Problems of Java applications●Monitoring tools in JDK● JDK 5.0● JDK 6.0

● Performance diagnosis, profiling● Profilers, profiling techniques● NetBeans Profiler

Page 5: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

5

Problems of(Java) applications

● User point of view● Startup time● Response time● Memory footprint

Page 6: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

6

Problems of(Java) applications

● Threading problems● Blocking EDT, deadlocks etc.

● Performance problems● Inefficient algorithms, bad scalability etc.

● Memory problems● Wasting memory, memory leaks

Page 7: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

7

Problems ofJava applications

● Special to Java● Compiled vs. interpreted code● Classloading● Garbage Collection● Tuning JVM parameters

Page 8: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

8

Agenda● Introduction● Problems of Java applications●Monitoring tools in JDK● JDK 5.0● JDK 6.0

● Performance diagnosis, profiling● Profilers, profiling techniques● NetBeans Profiler

Page 9: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

9

Monitoring JDK 5.0

● Solaris, Linux, Mac OS X● jstack, jmap, jinfo commandline utilities● Post-mortem analysis of thread stacks,

heap, ...● Can also inspect live process

● Solaris 10:● Dtrace jstack action

Page 10: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

10

Monitoring JDK 5.0

● Windows● jps

● jconsole● 5.0u7 adds -XX:+HeapDumpOnOutOfMemoryError● Troubleshooting guide

Page 11: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

11

Monitoring JDK 5.0

● DEMO

Page 12: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

12

Monitoring JDK 6.0

● Improvements to commandline utilities● live process inspection (Windows)● capture heap dump● jmap -dump:file=<file>,live <pid>

● jhat● change “manageable” options/flags

dynamically● Built-in DTrace probes (Solaris 10)

Page 13: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

13

Monitoring JDK 6.0

● Improvements to commandline utilities● expose java.util.concurrent lock information● jstack -l

● jconsole improvements● start management agent in local VM● plug-in support● UI improvements

Page 14: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

14

Monitoring JDK 6.0

● DEMO

Page 15: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

15

Agenda● Introduction● Problems of Java applications●Monitoring tools in JDK● JDK 5.0● JDK 6.0

● Performance diagnosis, profiling● Profilers, profiling techniques● NetBeans Profiler

Page 16: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

16

Profilers, techniques

● Profiler● Tool that tracks the performance of

computer program● JVM metrics, graphs, call trees,

execution times, memory usage insights, heuristics etc.

● Techniques● JVM hooks, sampling, instrumentation

Page 17: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

17

NetBeans Profiler

● Integrated into NetBeans IDE● Profiler 5.5.1 (stable) or 6.0 Beta 1● Dynamic bytecode instrumentation, root

methods, calibration

Page 18: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

18

NetBeans ProfilerDemos (6.0 Beta 1)

● DEMO: Application monitoring, threads● DEMO: CPU profiling, optimization● DEMO: Memory analysis, leak detection

Page 19: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

19

Conclusion● Powerful tools for application

monitoring available in JDK● Profilers help you to discover

performance & memory problems in your applications

● You can use NetBeans Profiler for free:o)

Page 20: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

20

Resources● JDK 5.0 Troubleshooting Guide● http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf

● JDK 6.0 Troubleshooting Guide● http://java.sun.com/javase/6/webnotes/trouble/index.html

● Java Performance Tuning● http://www.javaperformancetuning.com

● NetBeans Profiler (download, docs...)● http://profiler.netbeans.org

Page 21: Monitoring Java applications and detecting performance ... · 2 Agenda Introduction Problems of Java applications Monitoring tools in JDK JDK 5.0 JDK 6.0 Performance diagnosis, profiling

Tomáš Hůrka, Jiří Sedláč[email protected], [email protected]

Monitoring Java applications and detecting performance

problems using JDK tools and NetBeans Profiler