Integrated Profiling Tools: NetBeans Profiler

searchcoilΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 3 μέρες)

289 εμφανίσεις

1
Integrated Profiling
Integrated Profiling
Tools: NetBeans
Tools: NetBeans
Profiler
Profiler
1
2
Agenda

Issues with Traditional Profiling Schemes

Introduction (of NetBeans profiler)

Architecture and Technologies used

Features

What is new in NetBeans Profiler 6.x?
3
Performance,
Performance,
Debugging,
Debugging,
Monitoring,
Monitoring,
Management,
Management,
Code analysis,
Code analysis,
Testing
Testing
Free online course
Free online course
http://javapassion.com/
http://javapassion.com/
javaperformance/
javaperformance/
3
4
You can try the demos yourself!

Performance profiling
>
http://www.javapassion.com/handsonlabs
/nbprofilerperformance/index.html

Memory profiling
>
http://www.javapassion.com/handsonlabs
/nbprofilermemory/index.html

Profiling real-life applications
>
http://www.javapassion.com/handsonlabs
/nbprofilerreallife/index.html
Issues with
Issues with
Traditional
Traditional
Profiling
Profiling
Schemes
Schemes
6
Issues of Traditional Application
Profiling Schemes

You might have to add ad-hoc profiling code to the
application and rebuild the application
>
This is not practical if you don't have source code

You cannot pick and choose the area of profiling
>
You have to profile the whole application including underlying
system code
>
Profiling app server code is not something you care about
>
The interpretation of the collected data is not easy

Profiling adds significant overhead
>
Profiling data is tainted by the profiling itself
7
NetBeans Application Profiling

Provides runtime behavior of your application
>
Heap memory size, GC statistics, threads data
>
CPU time used by application methods

Selectively choose specific part of your application
for profiling

>
No “profiler tainted performance data” problem
>
Filter out any system level code from profiling through
configuration

No need to rebuild the application with ad-hoc
profiling code fragments
>
You can profile running application (JDK 6)
Introduction of
Introduction of
NetBeans
NetBeans
Profiler
Profiler
9

Full featured Java profiler
>
Application monitoring (threads, VM telemetry)
>
Performance profiling (CPU)
>
Memory profiling, memory leaks detection

Easy to use for beginners
>
Benefit from IDE integration – part of dev. cycle
>
Predefined profiling tasks

Advanced features for experienced users
>
Ability to fine-tune various profiling settings
>
Profiling “big” applications
NetBeans Profiler - It is Free!
10
Platform Support

Supported OS
>
Windows 2000, XP, 2003 Server
>
Linux
>
Solaris Sparc & x86
>
Mac OS X 10.4.2 and newer
>
64bit JVMs supported

Supported JVM
>
JDK 5.0_04 and newer, JDK 5.0_12 recommended
>
JDK 6.0 b26 and newer, latest JDK 6.0
recommended
Architecture &
Architecture &
Technology
Technology
Used
Used
12
Architecture
NetBeans Profiler GUI
Profiled Application
(local or remote)
Shared Memory-Mapped File
Profiler Tool / GUI
Profiler Agent
TCP/IP
13
Technologies Used

Dynamic bytecode instrumentation

Hybrid sampling/instrumentation
approach

Calibration, delivering real times

Root methods
14

Dynamic Bytecode Instrumentation

The insertion of instrumentation bytecodes is done at
runtime

After you have selected a class or method for profiling,
the next time it is invoked by the application, the profiler
will insert the necessary instrumentation
>
Using the JVMTI's redefineClass(Class[] classes, byte[][]
newBC) method.
Profiling
Profiling
Features
Features
16
Capabilities

Integration with the IDE
>
Profile Main Project, Profile Project
>
Profile File: main, applet, servlet, jsp
>
Profile Test

Supported IDE project types
>
Java Application
>
Web Application
>
FreeForm Project
>
NetBeans Module
17
Capabilities

Attach to external application
>
In context of IDE project, any project type
>
Without sources, global attach

Local Attach
>
Direct attach
>
Dynamic attach

Remote Attach
>
Direct attach
18
Threads Monitoring

Threads timeline
>
Thread name, class
>
Thread status in time

Threads details
>
Activity statistics
>
Timestamp for each
state
>
Description of system
threads
19
VM Telemetry Monitoring

Virtual machine telemetry visualization
>
Allocated heap, used heap
>
Number of threads running in VM
>
Relative time spent in garbage collection
>
Special Surviving Generation metrics – memory
leak detection
20
CPU Profiling

Entire application or
Part of application

Instrumentation filter

Instr. / sampling

Instr. schemes

Special methods

CPU snapshots

Back traces
Demo:
Demo:
CPU Profiling
CPU Profiling
http://www.javapassion.com/han
http://www.javapassion.com/han
dsonlabs/nbprofilerperformance/
dsonlabs/nbprofilerperformance/
index.html#Exercise_4
index.html#Exercise_4
22
Memory Profiling

Tracking allocations or
object liveness

Tracking every n
th
obj.

Recording stack traces

Limited stack depth

Surviving generations
Demo:
Demo:
Memory Profiling
Memory Profiling
http://www.javapassion.com/han
http://www.javapassion.com/han
dsonlabs/nbprofilermemory/inde
dsonlabs/nbprofilermemory/inde
x.html#Exercise_2
x.html#Exercise_2
New Features
New Features
in NetBeans 6.x
in NetBeans 6.x

Profiling Points
26

Profiling Points

Work like breakpoints
>
Automatically trigger actions when certain conditions are met

Triggers
>
execution of a line of code
>
time elapsed
>
memory used.

Actions
>
Heap dumps
>
Resetting of results collected
>
Running of a load generator script
>
Take a snapshot
Demo:
Demo:
Profiling Points
Profiling Points
http://www.javapassion.com/han
http://www.javapassion.com/han
dsonlabs/nbprofilerperformance/
dsonlabs/nbprofilerperformance/
index.html#Exercise_2
index.html#Exercise_2
Heap Walker
Demo:
Demo:
Heap Walker
Heap Walker
http://www.javapassion.com/han
http://www.javapassion.com/han
dsonlabs/nbprofilermemory/inde
dsonlabs/nbprofilermemory/inde
x.html#Exercise_3
x.html#Exercise_3
Dynamic Attachment: JDK 1.6
Demo:
Demo:
Dynamic
Dynamic
Attachment
Attachment
http://www.javapassion.com/han
http://www.javapassion.com/han
dsonlabs/nbprofilermemory/inde
dsonlabs/nbprofilermemory/inde
x.html#Exercise_4
x.html#Exercise_4
JMeter Integration
Drill Down Graph
Thank You!
Thank You!