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.1k
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
630
Mackerel Meetup #4
stanaka
0
3.5k
Other Decks in Technology
See All in Technology
AIのReact習熟度を測る
uhyo
2
660
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
270
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
250
GitHub Copilot app最速の発信の裏側
tomokusaba
1
200
マルチアカウント環境での コーディングエージェントを使った障害調査が大変なので AIエージェントにReadOnly権限を付与してみた / ReadOnly AI Agents for Multi-Account AWS Incident Response
yamaguchitk333
2
110
Kiro Ambassador を目指す話
k_adachi_01
0
110
脆弱性対応、どこで線を引くか
rymiyamoto
1
420
サイバーエージェントにおけるAI推進戦略と変革への取り組み
shotatsuge
0
190
AI-DLCを “そのまま導入しなかった”話 ~組織に合わせてアジャストした 私たちの実践共有~
hiroramos4
PRO
1
230
[AWS Summit Japan 2026]迷っているあなたへ_小さな一歩が、やがて自分を助けてくれる
sh_fk2
1
180
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
420
Bucharest Tech Week 2026 - Guardians of the Cloud-Native Galaxy
edeandrea
PRO
0
130
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
630
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
390
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Believing is Seeing
oripsolob
1
150
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