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
3
250
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
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1k
ヒューマンスキル / The Humanskills
eller86
0
510
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
290
Server-side Kotlinを使うスタートアップでどんなDetektルールが育ったか / Detekt rules made in start-up working with Server-side Kotlin
eller86
0
1.3k
Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101
eller86
1
1.4k
Goodbye JSR305, Hello JSpecify!
eller86
2
4.7k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.2k
Javaプログラミングの体験向上に関する活動 / DX enhancement around Java programming
eller86
0
3.7k
静的解析ツールで生産性向上
eller86
1
880
Other Decks in Technology
See All in Technology
リスクから学ぶKubernetesコンテナセキュリティ/k8s-risk-and-security
mochizuki875
1
310
I tried the newly introduced certification "Applied Skills" on Microsoft Learn
mappie_kochi
0
130
O'Reilly Superstream: Building a RAG App to Chat with Your Data
pamelafox
0
120
【インフラエンジニアbooks】30分でわかる「AWS継続的セキュリティ実践ガイド」
hssh2_bin
4
1.6k
【shownet.conf_】ShowNet 2024 ~ Inter * Network ~
shownet
PRO
0
490
ADRを運用して3年経った僕らの現在地
onk
PRO
10
4.8k
【shownet.conf_】ShowNet伝送改めShowNet APN 2024
shownet
PRO
0
420
ドメインと向き合う - 旅行予約編
hidenorigoto
4
560
Rubyはなぜ「たのしい」のか? / Why is Ruby a programmers' best friend? #tqrk15
expajp
4
1.8k
普通の Web エンジニアのための様相論理入門 #yapcjapan / YAPC Hakodate 2024
ytaka23
5
1.3k
【shownet.conf_】ローカル5Gを活用したウォーキングツアーの体感向上
shownet
PRO
0
320
ITエンジニアとして知っておいてほしい、電子メールという大きな穴
logica0419
6
1.1k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
67
4.2k
Unsuck your backbone
ammeep
668
57k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
110
6.9k
Creatively Recalculating Your Daily Design Routine
revolveconf
217
12k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Code Reviewing Like a Champion
maltzj
519
39k
Teambox: Starting and Learning
jrom
131
8.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.7k
From Idea to $5000 a Month in 5 Months
shpigford
380
46k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Scaling GitHub
holman
458
140k
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