Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JVM GCs and why should I care?
Search
Maciej Biłas
June 28, 2013
Technology
90
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JVM GCs and why should I care?
Very brief introduction into JVM GC tuning given at a SoftwareMill tech talk.
Maciej Biłas
June 28, 2013
Transcript
17 slides
JVM GCs and why should I care? Maciej Biłas <
[email protected]
>
You should not unless you have to
How do I tell I have to? -verbose:gc -Xloggc:<filename> -XX:+PrintGCDetails
-XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime
Yes, now you have to time since start: [Full] GC
heap_taken_before_GC -> heap_taken_after_GC (total heap size) pause in seconds 29422.361: [Full GC 1704272K->1175099K(1781760K), 5.2196310 secs] 29427.588: [GC 1176939K(1781760K), 0.0135230 secs] 29430.034: [Full GC 1651801K->1239586K(1781760K), 5.3722150 secs] 29435.591: [Full GC 1411504K->1196906K(1781760K), 5.3212200 secs]
What now? Add more memory to the heap before doing
any GC tuning.
Pro tips • Have a realistic stress test • Diagnose
if the problem is GC-related • Define your performance goals
What to optimize? • Throughput • Latency • Memory
Available collectors • Serial • Parallel • CMS (+ parallel
new) • G1 • experimental in late Java 6, available in Java 7
The heap
Perm gen • Perm gen does not count to heap
size • Perm gen is gone since Java 8
JVM defaults if CPUs >= 2 && memory >= 2GiB
server else client
Client and server classes Machine Heap size GC Client ???
Serial Server Initial: memory / 64 Max: MIN(memory / 4, 1GiB) Parallel Source: http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.ergonomics.default_size
JSW case -server -Xms5000m -Xmx5000m -XX:NewRatio=1 -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC
-XX:+UseCompressedOops -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -verbose:gc
JSW after tuning 2022.201: [GC 2022.201: [ParNew: 2176832K- >139349K(2304000K), 0.1241120
secs] 2311896K- >274413K(4864000K) icms_dc=0 , 0.1243120 secs] [Times: user=0.48 sys=0.00, real=0.13 secs] 2746.297: [GC 2746.298: [ParNew: 2187349K- >122293K(2304000K), 0.2227440 secs] 2322413K- >327073K(4864000K) icms_dc=0 , 0.2229290 secs] [Times: user=0.67 sys=0.08, real=0.23 secs] 3528.443: [GC 3528.443: [ParNew: 2170293K- >57977K(2304000K), 0.0544880 secs] 2375073K- >278050K(4864000K) icms_dc=0 , 0.0546750 secs] [Times: user=0.18 sys=0.02, real=0.06 secs]
You can also try -XX:MaxGCPauseMillis
Not covered here • Most GC tuning flags • Go
check them yourselves • Safe points • Other GC implementations • the pauseless one from Azul especially
Resources • JVM 6.0 Tuning http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html • List of JVM
options http://www.oracle.com/technetwork/java/javase/tech/vmoptions- jsp-140102.html • Sizing TLABs https://blogs.oracle.com/daviddetlefs/entry/tlab_sizing_an_annoying_little • Server class machine detection http://docs.oracle.com/javase/6/docs/technotes/guides/vm/server- class.html • Java Garbage Collection Distilled http://www.infoq.com/articles/Java_Garbage_Collection_Distilled
More Decks by Maciej Biłas
See All by Maciej Biłas
akka-cluster-etcd
maciejb
0
280
Testing with Docker
maciejb
1
130
ArchieML
maciejb
0
160
I code for Warsaw
maciejb
0
230
Warsaw JUG: Listen to the sounds of your application
maciejb
0
170
Poznań JUG: Listen to the sounds of your application
maciejb
0
91
Other Decks in Technology
See All in Technology
Well, that’s weird…
csswizardry
3
260
攻撃と守りは何が変わり、何が変わらないのか~最近の不正アクセスから考える、リスク評価と標準の使いどころ
oidfj
2
380
Test Impact Analysis を武器に立ち向かう、AI 時代のテスト増加に対するヌーラボのアプローチ / getting-started-datadog-test-impact-analysis
k6s4i53rx
3
900
20261119_AgentCore
takuyay0ne
2
350
テスト自動化の先、テスト自律化に向けて
mineo_matsuya
3
810
AI時代のTechLeadの問い〜Tech Lead Conference 2026 Autumn / questions-for-tech-leads-in-the-age-of-ai
haru860
0
100
40以上のマイクロサービスを支えるKubernetes JITアクセス — 160以上の恒久RoleBindingを削減
jumpe1
0
100
設計手法を「道具」として使いこなすために
a_suenami
7
1.8k
Claude Certified Developer – Professional 試験対策
shinoisa
0
290
Platform Engineering をベースとした Agentic Software Factory の実践
110y
3
1k
統制されたID・権限をどう利用するか : DPoP/FAPIによるAPIセキュリティ強化
oidfj
2
350
全てを疑え!非自明な挙動と異常系から考える堅牢なカスタムコントローラ開発入門(CNDW2026)
lycorptech_jp
PRO
0
120
Featured
See All Featured
[SF Ruby Conf 2025] Rails X
palkan
3
1.6k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
690
So, you think you're a good person
axbom
PRO
2
2.3k
The Limits of Empathy - UXLibs8
cassininazir
2
800
Fireside Chat
paigeccino
43
4.1k
Un-Boring Meetings
codingconduct
0
510
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
660
The Pragmatic Product Professional
lauravandoore
37
7.5k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
590
WCS-LA-2024
lcolladotor
0
1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k