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
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
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
2k
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
330
Android の公式 Skill / Android skills
yanzm
0
160
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
160
データサイエンスを価値につなげるプロジェクト設計 〜 DS一年目が現場で得た気づき 〜
ysd113
1
280
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
1.3k
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
3k
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
270
200個のGitHubリポジトリを横断調査したかった
icck
0
140
攻撃者視点で考えるDetection Engineering
cryptopeg
3
2k
[チョークトーク資料]AWS DevOps Agent を使いこなす / AWS Dev Ops Agent Chalk Talk AWS Summit Japan 2026
kinunori
3
600
ACE-Step-1.5で見る 音楽生成AIのしくみと“破綻だけ直す”Retake機能の開発【zennfes spring 2026 登壇資料】
personabb
1
540
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
How to Ace a Technical Interview
jacobian
281
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
170
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
200
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
エンジニアに許された特別な時間の終わり
watany
107
250k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Marketing to machines
jonoalderson
1
5.5k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
440
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
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