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
Understanding Memory Management of JavaVM in 1...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shinji Tanaka
April 07, 2014
Technology
2.7k
13
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Understanding Memory Management of JavaVM in 15 minutes
Shinji Tanaka
April 07, 2014
More Decks by Shinji Tanaka
See All by Shinji Tanaka
Mackerel loves Machine Learnings
stanaka
0
3.2k
How to Contribute Go
stanaka
4
19k
Introduction to Mackerel
stanaka
0
1.2k
Upcoming features in 2016, Mackerel
stanaka
0
3.6k
Mackerel's first year and onward
stanaka
0
3.2k
Mackerel's first year and onward (in English)
stanaka
0
450
Blue-Green Deployment with ECS and monitoring
stanaka
0
660
Mackerel Meetup #4 (in Eng)
stanaka
0
640
Mackerel Meetup #4
stanaka
0
3.5k
Other Decks in Technology
See All in Technology
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
200
SRE Lounge Hiroshimaへの招待
grimoh
0
640
Keeping applications secure by evolving OAuth 2.0 and OpenID Connect
ahus1
PRO
1
160
ヘルスケア領域における AI 活用と その安全性担保のための取り組み (Leveraging AI in Healthcare and Our Efforts to Ensure Its Safety) - Google I/O Extended Tokyo 2026, July 11, 2026
zettaittenani
0
290
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
150
ADDF - ループエンジニアリングするフレームワークを作ったら/I Didn't Set Out to Build Loop Engineering, But ADDF Did
fruitriin
0
120
Databricks 生成AIガバナンス実践ワークショップ / LLMOps-workshop
databricksjapan
0
100
Claude Code 珍プレー好プレー
shinyasaita
0
330
Gen3R: 3D Scene Generation Meets Feed-Forward Reconstruction
spatial_ai_network
0
120
依頼文化をやめる日 EM視点で語るPlatform EngineeringとInclusive SRE / Discussing Platform Engineering and Inclusive SRE from an EM's Perspective
shin1988
4
5.4k
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
13
2k
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
3.4k
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
930
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
Typedesign – Prime Four
hannesfritz
42
3.1k
Producing Creativity
orderedlist
PRO
348
40k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Facilitating Awesome Meetings
lara
57
7k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The browser strikes back
jonoalderson
0
1.4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
180
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Transcript
Understanding Memory Management of JavaVM in 15 minutes @stanaka /
id:stanaka JVM Operation Casual Talks at 2014/4/7
Shinji TANAKA CTO at Hatena Co., Ltd. ࠷ۙͷ׆ಈ: Immutable Infrastructure
@stanaka / id:stanaka We’re Hiring at both KYOTO and TOKYO!
Java Virtual Machine ʮͯͳʯͰಈ͍͍ͯΔ(͍ͨ)JavaVM Hadoop Solr Elasticsearch Scala ← new!
powered by Scala https://mackerel.io/
JVMͷࠔΓͲ͜Ζ ࡉ͔ͳνϡʔχϯά͕Ͱ͖Δ ىಈ͕͍ σϑΥϧτ͕͍͚ͯͳ͍ ωοτ্ʹݹ͍ใ͕ଟ͍
JVMͷࠔΓͲ͜Ζ ࡉ͔ͳνϡʔχϯά͕Ͱ͖Δ ىಈ͕͍ σϑΥϧτ͕͍͚ͯͳ͍ ωοτ্ʹݹ͍ใ͕ଟ͍ G1HeapRegionSizeͬͯͳʹ?
JVMͷࠔΓͲ͜Ζ ࡉ͔ͳνϡʔχϯά͕Ͱ͖Δ ىಈ͕͍ σϑΥϧτ͕͍͚ͯͳ͍ ωοτ্ʹݹ͍ใ͕ଟ͍ ͍͜ͳ͢ʹɺͪΌΜͱ͕ͨࣝ͠ඞཁ!! G1HeapRegionSizeͬͯͳʹ?
Memory Model in JavaVM Stack ← ελοΫྖҬ εϨου͝ͱʹ͋Δ Non Heap
← JavaVM෦Ͱ͏ྖҬ ίʔυΩϟογϡ (JIT݁ՌͳͲ) Permanent Generation (Java8͔Βআ) Heap ← ΞϓϦέʔγϣϯ͕͏ྖҬ GCର
Heap Young Generation Eden Space Survivor Space (ෳ͋Δ) Old /
Tenured Generation
Garbage Collection Algorithms Mark & Sweep Mark & Compaction Generational
GC (JDK 1.2, 1998) Parallel GC Incremental GC (-Xincgc, Java8Ͱඇਪ) Concurrent Mark-Sweep GC, CMS (JDK 1.4.1 2002) Garbage-First GC, G1 GC (JDK 1.6u14 2009)
Minor-GC from Memory Management in the Java HotSpot Virtual Machine
[Whitepaper2006]
Minor-GC from Memory Management in the Java HotSpot Virtual Machine
[Whitepaper2006]
Parallel Collector from Memory Management in the Java HotSpot Virtual
Machine [Whitepaper2006]
Concurrent GC (CMS) from Memory Management in the Java HotSpot
Virtual Machine [Whitepaper2006]
Pros/Cons of CMS Pros Concurrent! Stop-the-World͕͔͍࣌ؒ Cons Old Gen͕flagmentԽ(compaction͞Εͳ͍)͠ Old
GenͰͷϝϞϦ֬อ͕͘ͳΔ
CMS / G1 from The Garbage-First Garbage Collector [JavaOne2008]
CMS vs G1 ͞ΕͨYoungྖҬΛ࣋ͨͳ͍ (G1) Heap͕ϦʔδϣϯͰׂ͞ΕΔ ΦϒδΣΫτஔͷ࠷దԽ͕͞ΕΔ(G1) SparseͳϦʔδϣϯ࠶ஔ͞ΕCompaction͞ΕΔ Snapshot-at-the-beginingʹΑΔMarking(G1) CMSͰDirty-card
GC Benchmark Parallel CMS G1 Total GC pauses 20,930ms 18,870ms
62,000ms Max GC pause 721ms 64ms 50ms JIRA benchmark test for 30 minutes with -Xms256m -Xmx768m -XX:MaxPermSize=256m https://plumbr.eu/blog/g1-vs-cms-vs-parallel-gc Tuning͢ΔͱG1ͷ΄͏͕CPUෛՙ ؚΊͯྑ͍ͱ͍͏݁Ռ͋Δ [JavaOne2013]
ͲͷGCΛ͏͖? ϫʔΫϩʔυͱαʔόʔεϖοΫ࣍ୈ ώʔϓαΠζ (ඦMBʙेGBʙTB) ΦϒδΣΫτੜɺαΠζɺण໋ͷ CPUޮͱϨΠςϯγͱνϡʔχϯάͷखؒ τϨʔυΦϑ
Reference Memory Management in the Java HotSpot Virtual Machine ˑ
http://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf [Whitepaper2006] A Generational Mostly-concurrent Garbage Collector https://www.cs.purdue.edu/homes/hosking/ismm2000/papers/printezis.pdf [ISMM2000] The Garbage-First Garbage Collector http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.63.6386&rep=rep1&type=pdf [ISMM2004] ˑ http://www.oracle.com/technetwork/server-storage/ts-5419-159484.pdf [JavaOne 2008] Garbage-First Garbage Collector: Migration to, Expectations and Advanced Tuning. ˑ http://www.slideshare.net/MonicaBeckwith/garbage-first-garbage-collector-g1-gc-migration-to- expectations-and-advanced-tuning [JavaOne2013] Java Virtual Machine Technology http://docs.oracle.com/javase/8/docs/technotes/guides/vm/ International Symposium on Memory Management (ISMM) http://www.sigplan.org/conferences/ismm/main