92209431 java performance
TRANSCRIPT
-
7/28/2019 92209431 Java Performance
1/20
JAVA MEMORY MANAGEMENT
GARBAGE COLLECTION TUNING +SIZING MEMORY GENERATIONS
-
7/28/2019 92209431 Java Performance
2/20
OVERVIEW
Theory and concepts:
JVM memory areas
GC
Tuning
SAP standards
Tools for logfile analysis
HPJMeter
JVMStat
SAP Memory Analyser
Case Study
Discussion
-
7/28/2019 92209431 Java Performance
3/20
JAVA VS C++
# include < string>
int main ( int argc, cha r ** argv)
{
int i;string * var;
for (i = 0; i < 1000; i + + )
{
var = new string (memory leaking or not);delete (var);
}
-
7/28/2019 92209431 Java Performance
4/20
JAVA VS C++
import java.lang.String;
public sta tic void main ( String [] a rguments)
{
int i;String var;
for (i = 0; i < 1000; i + + )
{
var = new String (memory never lea king);}
}
-
7/28/2019 92209431 Java Performance
5/20
TOWARDS HOTSPOT JVM
-
7/28/2019 92209431 Java Performance
6/20
HOTSPOT JVM
-
7/28/2019 92209431 Java Performance
7/20
HOW DOES GC WORK
-
7/28/2019 92209431 Java Performance
8/20
HOW DOES GC WORK
-
7/28/2019 92209431 Java Performance
9/20
HOW DOES GC WORK
-
7/28/2019 92209431 Java Performance
10/20
HOW DOES GC WORK
-
7/28/2019 92209431 Java Performance
11/20
GC LOGGING -verbose:gc
[GC 325407K->83000K(776768K), 0.2300771 secs]
[GC 325816K->83372K(776768K), 0.2454258 secs]
[Full GC 267628K->83769K(776768K), 1.8479984 secs]
-XX:+PrintGCDetails
[GC [DefNew: 64575K->959K(64576K), 0.0457646 secs] 196016K->133633K(261184K), 0.0459067 secs]]
-XX:+PrintGCTimeStamps
111.042: [GC 111.042: [DefNew: 8128K->8128K(8128K),
0.0000505 secs]111.042: [Tenured: 18154K->2311K(24576K),0.1290354 secs] 26282K->2311K(32704K), 0.1293306 secs]
Logfile:
-
7/28/2019 92209431 Java Performance
12/20
GC LOGGING
-XX:+PrintTenuringDistribution
1096.789: [GC 1096.789: [ParNew Desired survivor size 86232268 bytes, new threshold 6 (max12)
- age 1: 50754696 bytes, 50754696 total
- age 2: 12147696 bytes, 62902392 total
- age 3: 12295552 bytes, 75197944 total-age 4: 6537136 bytes, 81735080 total
- age 5: 2435944 bytes, 84171024 total
- age 6: 3013488 bytes, 87184512 total
- age 7: 627368 bytes, 87811880 total
- age 8: 999536 bytes, 88811416 total
- age 9: 924656 bytes, 89736072 total
- age 10: 1811480 bytes, 91547552 total
: 554848K->89528K(561792K), 0.5317388 secs] 607743K->146164K(1217152K) icms_dc=18 ,0.5326526 secs]
-
7/28/2019 92209431 Java Performance
13/20
PERFORMANCE CONCEPTS
TROUGHPUT: % of runtime in GC
PAUSE
FOOTPRINT
PROMPTNESS
-
7/28/2019 92209431 Java Performance
14/20
GC DESIGN
SERIAL vs PARALLEL
CONCURRENT vs STOPTHEWORLD
COMPACTING vs NONCOMPACTING vsCOPYING
-
7/28/2019 92209431 Java Performance
15/20
FOUR GARBAGE COLLECTORS
Default Collector
-XX:+UseParallelGC
-XX:UseConcMarkSweepGC
-Xincgc
-
7/28/2019 92209431 Java Performance
16/20
-
7/28/2019 92209431 Java Performance
17/20
PARALLEL GC
Minor collections only
+2 Processor machines -> Overhead
Fragmentation Tenured generation
Stop the World Full GC -> Performance Trap
-XX:ParallelGCThreads=
-
7/28/2019 92209431 Java Performance
18/20
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, low pauses, lower footprint, better
promptness
-
7/28/2019 92209431 Java Performance
19/20
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, test a GC, retune memory sizes
Performance trap non scalability of JVM
-
7/28/2019 92209431 Java Performance
20/20
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