Java Performance | Computer Hardware | Software Engineering

JAVA MEMORY MANAGEMENT

GARBAGE COLLECTION TUNING + SIZING MEMORY GENERATIONS

OVERVIEW

Theory and concepts:
   

JVM memory areas GC Tuning SAP standards HPJMeter JVMStat SAP Memory Analyser

Tools for logfile analysis



 

Case Study Discussion

} } . cha r ** a rgv) { int i. string * va r. i < 1000. for (i = 0.JAVA VS C++ # include < string> int ma in ( int a rgc. i + + ) { va r = ne w string (“me mory le a king or not”). de le te (va r).

i + + ) { va r = ne w String (“me mory ne ve r le a king”).String.JAVA VS C++ import ja va .la ng. String va r. } } . for (i = 0. i < 1000. public sta tic void ma in ( String [] a rgume nts) { int i.

TOWARDS HOTSPOT JVM .

HOTSPOT JVM .

HOW DOES GC WORK .

HOW DOES GC WORK .

HOW DOES GC WORK .

HOW DOES GC WORK .

0.2454258 secs] [Full GC 267628K->83769K(776768K). 0.042: [GC 111.1293306 secs]  Logfile: .1290354 secs] 26282K->2311K(32704K). 0.042: [Tenured: 18154K->2311K(24576K). 0.2300771 secs] [GC 325816K->83372K(776768K).0459067 secs]]  -XX:+PrintGCTimeStamps 111.8479984 secs]  -XX:+PrintGCDetails [GC [DefNew: 64575K->959K(64576K). 1. 0.0457646 secs] 196016K>133633K(261184K).GC LOGGING  -verbose:gc [GC 325407K->83000K(776768K). 0.042: [DefNew: 8128K->8128K(8128K). 0.0000505 secs]111.

age 10: 1811480 bytes.age 7: 627368 bytes. 87811880 total . 88811416 total .5326526 secs] .GC LOGGING  -XX:+PrintTenuringDistribution 1096.age 6: 3013488 bytes.789: [GC 1096.789: [ParNew Desired survivor size 86232268 bytes.age 8: 999536 bytes. 62902392 total .age 2: 12147696 bytes.age 3: 12295552 bytes. 91547552 total : 554848K->89528K(561792K). 87184512 total . 89736072 total . 81735080 total .age 1: 50754696 bytes.age 9: 924656 bytes. 50754696 total .5317388 secs] 607743K->146164K(1217152K) icms_dc=18 .age 5: 2435944 bytes. new threshold 6 (max 12) . 0. 0. 84171024 total . 75197944 total -age 4: 6537136 bytes.

PERFORMANCE CONCEPTS     TROUGHPUT: % of runtime in GC PAUSE FOOTPRINT PROMPTNESS .

GC DESIGN    SERIAL vs PARALLEL CONCURRENT vs STOPTHEWORLD COMPACTING vs NONCOMPACTING vs COPYING .

FOUR GARBAGE COLLECTORS     Default Collector -XX:+UseParallelGC -XX:UseConcMarkSweepGC -Xincgc .

DEFAULT GC   Single Thread Stop the World .

PARALLEL GC      Minor collections only +2 Processor machines -> Overhead Fragmentation Tenured generation Stop the World Full GC -> Performance Trap -XX:ParallelGCThreads=<nr> .

better promptness . low pauses.CONCURRENT    Parallel Minor GC Concurrent Full GC Fragmentation      Minors during Full Collections Memory + resource intensive -> free thread Future to overcome Performance Trap Large Tenured Generation High Troughput. lower footprint.

test a GC. retune memory sizes   Performance trap – non scalability of JVM .TUNING GUIDELINES  Use tools to get an idea of the applications lifetime distribution ++ objects alive during GC = longer pauses Young Generation Guarantee ++ Eden space and Survivor spaces:        Fast collection because more dead object Less collections does not equal longer pauses Less copying Less often full collections + faster full collections  More processors = more memory needed (esp Eden) Set memory sizes optimal.

SAP SETTINGS Sapnote 723909 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:NewSize = -XX:MaxNewSize -XX:PermSize = -XX:MaxPermSize (256m – 512m) -Xms = -Xmx = 2048 MB (170m Dispatcher + 50m per extra server) -XX:NewSize = 1/6 –Xmx (1/3 Dispatcher) -Xss2m -XX:SurvivorRatio=2 -XX:TargetSurvivorRatio=90 -XX:+UseParNewGC -XX:+PrintTenuringDistribution -XX:MaxTenuringThreshold=31 -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:DisableExplicitGC .

Sign up to vote on this title
UsefulNot useful