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
AI時代の開発生産性は、個人技からチーム設計へ
moongift
PRO
3
320
cccccc
moznion
0
1.9k
タスクの複雑さでモデルを選ぶ ── Thompson Samplingで動かす“トークン/コスト最適化
satohy0323
0
370
Databricks 生成AIガバナンス実践ワークショップ / LLMOps-workshop
databricksjapan
0
100
ADDF - ループエンジニアリングするフレームワークを作ったら/I Didn't Set Out to Build Loop Engineering, But ADDF Did
fruitriin
0
120
LLMやAIエージェントをソフトウェアに組み込むプラクティス
shibuiwilliam
1
360
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
1
250
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
210
インフラと開発の垣根を超えていき!〜元AWSインフラエンジニアがAWS開発で奮闘している話〜
hatahata021
2
180
ruby.wasmとPicoRuby.wasmに対応した仮想DOMライブラリを作ってる話 #kaigieffect_kaigi
sue445
PRO
0
150
CDKで書くECSのベストプラクティス、 改めて考え直す2026 #cdkconf2026
makies
0
120
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
2
3.6k
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
180
Balancing Empowerment & Direction
lara
6
1.2k
So, you think you're a good person
axbom
PRO
2
2.1k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
550
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
450
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
GraphQLとの向き合い方2022年版
quramy
50
15k
The Curious Case for Waylosing
cassininazir
1
430
Discover your Explorer Soul
emna__ayadi
2
1.2k
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