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
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
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
450
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.1k
ヒューマンスキル / The Humanskills
eller86
0
560
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
320
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.5k
Goodbye JSR305, Hello JSpecify!
eller86
2
4.9k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.3k
Javaプログラミングの体験向上に関する活動 / DX enhancement around Java programming
eller86
0
3.8k
Other Decks in Technology
See All in Technology
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
500
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 @ AXIES 2024
ritou
3
1.4k
kargoの魅力について伝える
magisystem0408
0
200
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
140
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
540
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
320
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
420
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
11
3.3k
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
94
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Navigating Team Friction
lara
183
15k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Site-Speed That Sticks
csswizardry
2
190
Become a Pro
speakerdeck
PRO
26
5k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
GraphQLとの向き合い方2022年版
quramy
44
13k
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