Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Profiling for JVM
Search
Kengo TODA
October 16, 2012
Technology
2
260
Profiling for JVM
Simple introduction about how to judge the reason why your Java program is slow
Kengo TODA
October 16, 2012
Tweet
Share
More Decks by Kengo TODA
See All by Kengo TODA
生成AI 業務応用向けガイドライン 斜め読み / Overview of Generative AI Business Application Guidelines
eller86
0
100
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
1.4k
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.4k
ヒューマンスキル / The Humanskills
eller86
0
680
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
380
Server-side Kotlinを使うスタートアップでどんなDetektルールが育ったか / Detekt rules made in start-up working with Server-side Kotlin
eller86
0
1.5k
Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101
eller86
1
1.8k
Goodbye JSR305, Hello JSpecify!
eller86
2
5.1k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.4k
Other Decks in Technology
See All in Technology
Grafana MCP serverでなんかし隊 / Try Grafana MCP server
kohbis
0
340
Create a Rails8 responsive app with Gemini and RubyLLM
palladius
0
120
Whats_new_in_Podman_and_CRI-O_2025-06
orimanabu
3
180
In Praise of "Normal" Engineers (LDX3)
charity
2
860
原則から考える保守しやすいComposable関数設計
moriatsushi
3
360
「どこにある?」の解決。生成AI(RAG)で効率化するガバメントクラウド運用
toru_kubota
2
390
工具人的一生: 開發很多 AI 工具讓我 慵懶過一生
line_developers_tw
PRO
0
140
型システムを知りたい人のための型検査器作成入門
mame
15
3.8k
Tenstorrent HW/SW 概要説明
tenstorrent_japan
0
390
TODAY 看世界(?) 是我們在看扣啦!
line_developers_tw
PRO
0
160
Snowflake Intelligenceで実現できるノーコードAI活用
takumimukaiyama
1
220
Amplifyとゼロからはじめた AIコーディング 成果と展望
mkdev10
1
220
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
The Invisible Side of Design
smashingmag
299
51k
The Cost Of JavaScript in 2023
addyosmani
50
8.3k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.7k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Docker and Python
trallard
44
3.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
650
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
4 Signs Your Business is Dying
shpigford
184
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Transcript
PROFILING FOR JVM How to verify your hypothesis - @eller86
1
Agenda Process to detect the cause of performance problem What
is “profiling”? Tools to profile 2
Process to detect the cause of performance problem Make hypothesis
from experience and knowledge Get Servlet’s log from middle ware like Jetty Read source code, do debugging, do profiling 3
What is “profiling”? where? why? GC storm algorithm CPU Other
reading code heap dump I/O Lock? Waiting other system? I/O GC Other thread dump IZQPUIFTJT WFSJpDBUJPO 4
Tools to profile jmap jstack jstat VisualVM 5
Overview 6
Judging the reason why JVM uses CPU heavily $ jstat
-gcutil [PID] 250 7 S0 S1 E O P YGC YGCT FGC FGCT GCT 12.44 0.00 27.20 9.49 96.70 78 0.176 5 0.495 0.672 12.44 0.00 62.16 9.49 96.70 78 0.176 5 0.495 0.672 12.44 0.00 83.97 9.49 96.70 78 0.176 5 0.495 0.672 0.00 7.74 0.00 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 23.37 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 43.82 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 58.11 9.51 96.71 79 0.177 5 0.495 0.673 GC was fired Young generation GC was fired 7
Detecting method which costs too much time 8
How to read method name Foo.x() means “method x of
Foo class” Foo$Bar.x() means “method x of Bar class, and Bar is inner class of Foo” Foo.<init> means “constructor of Foo class” Foo.<clinit> means “static initializer of Foo class” 9
Taking thread dump $ jstack -l [PID] > thread-dump.txt 10
Checking count of objects 11
Taking heap dump $ jmap -dump:format=b,file=dump.dat [PID] 12
Key points Hypothesis needs verification Know “normal” performance to detect
“abnormal” one Imagine globally, verify locally (narrow down step by step) 13
Reference JDK tools and utilities Browsing heap dump VisualVM Diagnosis
documentation @ developerWorks My gist about JVM profiling, blog article and another article 14