the jvm - internal ( 스터디 자료 )
Post on 17-Aug-2015
90 Views
Preview:
TRANSCRIPT
/83
The JVM
2015.06 Gun Lee
1
/83 2
JVM에 대해 스터디하던 내용을
정리하여 공유합니다.
많은 부분이 엑셈에서 출판된
Java Performance Fundmental(김한도 저)
에서 발췌하였습니다.
제 슬라이드는 단지 이에 대한 소개이므로
더 깊은 내용은 위 도서를 직접 보시는 것을 강추!! 드립니다. ^^
/83
What is the JVM?
3
/83
What is the JVM?
4
… is Java virtual Machine…
/83
What is the JVM?
5
Write Once, run everywhere
/83
What is the JVM?
6
JVM Architecture
/83
Class, Classloader
7
/83
Class, Classloader
8
bytecode
/83
Class, Classloader
9
source
/83
Class, Classloader
10
javap –c
bytecode
/83
Class, Classloader
11
javap –verbose
/83
Class, Classloader
12
Constant pool
/83
Class, Classloader
13
opcode, operand
/83
Class, Classloader
14
classloader
/83
Class, Classloader
15
Namespace
- classloader 마다 존재
- class의 구분 namespace + full qualified name
/83
Class, Classloader
16
Namespace
/83
Class, Classloader
17
delegation model
class visibility
Parent first
/83
Class, Classloader
18
ClassNotFoundException
!
/83
Class, Classloader
19
Classloader Tree in WAS
Isolating the Application from other Applications
Sharing Class between deployed module
/83
Class, Classloader
20
Classloader Tree in WAS
/83
Class, Classloader
21
parent-first, child-last?
/83
Class, Classloader
22
parent-first, child-last?
Not always
/83
Class, Classloader
23
parent-first, child-last?
- Tomcat Bootstrap System WEB-INF/classes/* WEB-INF/lib/* Common Vendor specific extensions!
/83
Class, Classloader
24
Class
Classloader
constant pool bytecode local variable table
namespace delegation model - parent first
/83
Execution Engine
25
/83
Execution Engine
26
execute bytecodes
/83
Execution Engine
27
Interpreter
JIT(Just In Time) Compiler
/83
Execution Engine
28
Interpreter
read the bytecode line by line
no optimization
parsing & executing
해석시간은 짧으나 실행시간은 길다!
/83
Execution Engine
29
JIT Compiler
loads the whole method
generates native code
optimization
Native로 컴파일 하는 시간이 긺
여러 번 호출시 이득
/83
Execution Engine
30
JIT Compiler
/83
Execution Engine
31
Hotspot Compiler
Mixed mode system
/83
Execution Engine
32
Hotspot Compiler
/83
Execution Engine
33
Server VM vs Client VM
/83
Execution Engine
34
Server VM vs Client VM
Server VM – advanced adaptive compiler runtime performance profiling, optimizing
Client VM - better for GUI run faster smaller memory footprint
/83
Execution Engine
35
Profiling & Optimization
/83
Execution Engine
36
Profiling & Optimization
/83
Execution Engine
37
Profiling & Optimization
/83
Execution Engine
38
JVM Options
-Xint
-XX:CompileThreshold=<value> Client:1,500, Server:10,000
-Xcomp
/83
Runtime Data Area
39
/83
Runtime Data Area
40
Runtime Data Area
/83
Runtime Data Area
41
Runtime Data Area
/83
Runtime Data Area
42
Method area and Heap shared among all threads
/83
Runtime Data Area
43
Method area
/83
Runtime Data Area
44
Method area Type Information (Runtime) Constant Pool field Information Method Information
(& bytecode) Class Variables …
/83
Runtime Data Area
45
Method area Type Information (Runtime) Constant Pool field Information Method Information
(& bytecode) Class Variables …
Class??
/83
Runtime Data Area
46
Heap
a = new myObj();
b = new myObj();
Heap
Method Area Class
obj
obj
/83
Runtime Data Area
47
Heap
Check it out later…
The chapter. Garbage Collection
/83
Runtime Data Area
48
exclusive to each thread
/83
Runtime Data Area
49
PC register(Program counter)
contains the address of the Java Virtual Machine instruction currently being executed
/83
Runtime Data Area
50
JVM Stacks
Stack Trace
/83
Runtime Data Area
51
stack trace
stackframe
/83
Runtime Data Area
52
JVM Stacks http://www.slideshare.net/novathinker/2-runtime-
data-areas
- Page 68.
/83
Runtime Data Area
53
Runtime Data Area
/83
Garbage Collector
54
/83
Garbage Collector
55
GC ????
Stop the World !!
Out of Memory !!
/83
Garbage Collector
56
GC of Hotspot JVM
Weak Generation Hypothesis - High Infant Mortality
/83
Garbage Collector
57
Heap of Hotspot JVM
/83
Garbage Collector
58
GC & Reachability
/83
Garbage Collector
59
GC & Reachability
/83
Garbage Collector
60
Bump the pointer & TLAB (Thread Local Allocation Barrier)
/83
Garbage Collector
61
Mark alive object
--> Reachable from Rootset.
reference from Old Gen???
/83
Garbage Collector
62
Card Table & Write Barrier
1 byte card per 512 byte Old gen.
/83
Garbage Collector
63
Card Table & Write Barrier
/83
Garbage Collector
64
Minor GC - young Gen. Mark & Copy
/83
Garbage Collector
65
Full GC - Old Gen. Mark & sweep & compaction
/83
Garbage Collector
66
Parallel Collector – young gen.
/83
Garbage Collector
67
Parallel Collector – young gen.
Options
-XX:+UseParallelGC
-XX:ParallelGCThreds=<value>
/83
Garbage Collector
68
Parallel Compacting Collector - old Gen.
/83
Garbage Collector
69
Parallel Compacting Collector
Options
-XX:+UseParallelOldGC (+Java6)
/83
Garbage Collector
70
Parallel Compacting Collector
Options
-XX:+UseParallelOldGC (+Java6)
/83
Garbage Collector
71
CMS Collector – Old Gen
/83
Garbage Collector
72
CMS Collector – Old Gen
short pausing time No Compaction
-> disadvantage for fast allocation in promotion.
if the compaction task is needed, the STW time can be longer than any
other GC types.
/83
Garbage Collector
73
CMS Collector – Old Gen
Options
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
/83
Garbage Collector
74
GC log Options
-XX:+DisableExplicitGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc
/83
Garbage Collector
75
IBM JVM
/83
Garbage Collector
76
Pinned Class problem
[AF] Allocation Failure action=0
/83
Garbage Collector
77
IBM JVM – GC Options
-Xgcpolicy:<options> optthruput optavgpause gencon subpool
/83
Garbage Collector
78
Visual GC animation http://haks1999.github.io/haklab-gc/serial.html
/83
Garbage Collector
80
verbose GC analysis
HPJmeter, IBM GC Analyzer…
/83
and more…
81
Trouble shootings
Thread Dump Analysis Heap Dump Analysis
GC Log Analysis
/83
References ( contents, images )
http://www.oracle.com/technetwork/java/whitepaper-135217.html http://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf http://www.artima.com/insidejvm/ed2/jvm.html http://javapapers.com/core-java/java-jvm-run-time-data-areas/ http://blog.ragozin.info/2011/06/understanding-gc-pauses-in-jvm-hotspots.html http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html http://epicdevs.com/16 http://blog.naver.com/bumsukoh/110113098160 http://helloworld.naver.com/helloworld/1230 http://helloworld.naver.com/helloworld/1329 http://helloworld.naver.com/helloworld/329631 http://www.slideshare.net/novathinker/1-java-key http://www.slideshare.net/novathinker/2-runtime-data-areas http://www.slideshare.net/novathinker/3-garbage-collection http://www.slideshare.net/novathinker/4-class-loader http://www.slideshare.net/novathinker/5-execution-engine https://www.ibm.com/developerworks/community/blogs/738b7897-cd38-4f24-9f05-48dd69116837/entry/troubleshooting_and_memory_leak_analysis_with_java_data_objects_framework18?lang=en Java Performance(by Charlie Hunt , Binu John) / Addison-Wesley JAVA PERFORMANCE FUNDAMENTAL(김한도 저) / 엑셈
82
/83 83
Thank you !
Q&A or later
gunlee01@gmail.com
http://facebook.com/gunlee01
top related