SlideShare a Scribd company logo
1 of 27
Inside the JVM
STRUCTURE OF JAVA VIRTUAL MACHINE
Development Center @ Pikicast.com
김병부 ( Benjamin )
Benjamin
: about me
 Pikicast
 Netmarble
 U-Angel
 Joins.com and etc
因果關係
: 인과관계
 System Crash, Service Crash. Application Crash
 서비스가 죽는 것은 항상 원인이 있습니다
 시스템이 원인인지, 어플리케이션이 원인인지, 데이터 베이스가 원인인지
알아야 같은 현상을 막을 수 있습니다.
 서비스는 한번에 죽지 않습니다. 서서히 죽어갈 뿐입니다.
List of JVM
 List of JVM??
 The Java Virtual Machine Specification
 Hotspot JVM
 Open JVM
 IBM JVM
 TinyVM
 Dalvik JM ??
 Stack Machine vs Register Machine
JVM
: Java Virtual Machine #1
 Class File
 Bytecode 의 집합
 Interpreter / JIT Compiler
 Java Stack
 Heap
 Thread 들이 공유하는 메모리 영역
 Method Area
 Thread 들이 공유하는 메모리 영역
 Class 변수, 상수, Class 정보, Method 정보
Thread
1st Keyword inside of the JVM
Thread State
: java.lang.Thread.State
 NEW
 RUNNABLE
 TIMED_WAITING
 WAITING
 BLOCKED
 TERMINATED
 Since Java 1.5
Thread
:list of thread in the Hotspot JVM
 Thread 종류
 Non – Daemon Thread :
 E.g. Thread, VM Thread
 Daemon Thread :
 Garbage Collector Thread, JMX Monitoring Thread
 System Threads
 VM thread
 GC threads
 Periodic task thread – timer events i.e. interrupts for schedule
 Compiler thread – compiles byte code to native code in runtime
Thread
: Multi-Thread
 Each thread has ..
 Program Counter (PC)
 Stack
 Native stack
 Stack Frame
 Multi Thread – Context Switching & Scheduling
 Thread-Safe
 Keyword – synchronized
JVM Stack
 JVM Stack per Thread!!!
 Stack Frame per Method
 Local Variable Array
 Operand Stack
 Reference to Constant Pool
Thread dump
: How to dump JVM Thread
 jstack [pid] or kill –3 [pid]Thread Dump Date JVM Type, Mode
Thread name
Thread
Priority
Thread ID
Native
Thread ID
Thread STATUS
Thread STACK
info
Thread Dump Tool
: IBM Thread and Monitor Dump Analyzer for Java
Heap Area
2nd Keyword inside of the JVM
JVM Memory Structure
: with JVM options
 Basic Structure
 Depends on GC options
 Promotion
 Minor GC vs Major GC
 Young Generation
 Old and Perm Generation
 STW – Stop the world
 From Java8,
 No more PERM gen.
 Metaspace (Native Heap)
What is difference between Method
Area and PERM GEN?
 Actually the Method Area is a part of the PERM GEN
A third generation closely related to the tenured generation is the permanent generation.
The permanent generation is special because it holds data needed by the virtual machine
to describe objects that do not have an equivalence at the Java language level. For
example objects describing classes and methods are stored in the permanent generation.
Thread and Heap
: Reference from Stack to Heap
Garbage Collection
 GC options
 Serial GC, Parallel GC – Mark, Sweep, Compact
 Incremental GC
 CMS
 G1GC
CMS vs G1GC
 CMS GC
 Concurrent – Mark – Sweep GC
 more CPU,
 G1GC
 Garbage-First GC
 Region
 Recommend over 4G memory
Heap Dump
: How to dump JVM Heap
 jmap –dump:format=b,file=[file name].hprof [PID]
 JVM 메모리 사이즈 만큼의 binary 파일이 생성된다.
 Binary 파일이므로 분석툴이 필요함.
Heap Dump Tool
: IBM HeapAnalyzer Or Eclipse Memory Analyzer
OOME Case
: Out Of Memory Exception
 java.lang.OutOfMemoryError : Java heap space
 java.lang.OutOfMemoryError : PermGen space
 java.lang.OutOfMemoryError : Request array size exceeds VM limit
Conclusion
Conclusion inside of the JVM
Note
 Dump 는 10초 간격으로 3번씩 뜬다.
 Perm 영역에서도 OOM 이 발생할 수도 있다.
 Hotspot JVM > Open JVM
 Async Process 가 만능은 아님
 MultiThread 도 Pool로 관리하자
 Thread-safe and Pool Management
 우리에겐 G1GC 가 가장 맞는 케이스
 Throughput based tuning
 Response time based tuning
Reference
 http://blog.jamesdbloom.com/JVMInternals.html
 http://d2.naver.com/helloworld/1230
 http://blog.takipi.com/garbage-collectors-serial-vs-parallel-vs-cms-vs-the-g1-and-
whats-new-in-java-8/
 http://www.slideshare.net/MonicaBeckwith/garbage-first-garbage-collector-g1-gc-
migration-to-expectations-and-advanced-tuning
 http://www.poalsoft.com/blog/?p=34
Thank you

More Related Content

What's hot

Thread Dump Analysis
Thread Dump AnalysisThread Dump Analysis
Thread Dump AnalysisDmitry Buzdin
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJavabynataraJ
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage CollectionAzul Systems Inc.
 
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOUHOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOULucas Jellema
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programmingElizabeth Thomas
 
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Edureka!
 
Linux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownLinux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownScyllaDB
 
Process Management
Process ManagementProcess Management
Process ManagementRoy Lee
 
jcmd #javacasual
jcmd #javacasualjcmd #javacasual
jcmd #javacasualYuji Kubota
 
JVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesJVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesKris Mok
 
java 8 new features
java 8 new features java 8 new features
java 8 new features Rohit Verma
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at NetflixBrendan Gregg
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringShapeBlue
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerKoichi Sakata
 

What's hot (20)

Thread Dump Analysis
Thread Dump AnalysisThread Dump Analysis
Thread Dump Analysis
 
Completable future
Completable futureCompletable future
Completable future
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage Collection
 
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOUHOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
 
Linux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownLinux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance Showdown
 
Process Management
Process ManagementProcess Management
Process Management
 
jcmd #javacasual
jcmd #javacasualjcmd #javacasual
jcmd #javacasual
 
JVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesJVM: A Platform for Multiple Languages
JVM: A Platform for Multiple Languages
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at Netflix
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Java notes
Java notesJava notes
Java notes
 
Java platform
Java platformJava platform
Java platform
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 

Viewers also liked (15)

Memory management in oracle
Memory management in oracleMemory management in oracle
Memory management in oracle
 
Inside the JVM
Inside the JVMInside the JVM
Inside the JVM
 
What is persistence in java
What is persistence in javaWhat is persistence in java
What is persistence in java
 
Jvm Architecture
Jvm ArchitectureJvm Architecture
Jvm Architecture
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)
 
Understanding JVM
Understanding JVMUnderstanding JVM
Understanding JVM
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
JVM
JVMJVM
JVM
 
JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual Machine
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Chapter 2: Operating System Structures
Chapter 2: Operating System StructuresChapter 2: Operating System Structures
Chapter 2: Operating System Structures
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 

Similar to Inside the jvm

An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeOmar Bashir
 
Java Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderIsuru Perera
 
Lecture 2 Java Virtual Machine .pptx
Lecture 2 Java Virtual Machine .pptxLecture 2 Java Virtual Machine .pptx
Lecture 2 Java Virtual Machine .pptxAnupamKumar559254
 
10 examples of hot spot jvm options in java
10 examples of hot spot jvm options in java10 examples of hot spot jvm options in java
10 examples of hot spot jvm options in javayamingd
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and ProfilingWSO2
 
Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013MattKilner
 
Fun with bytecode weaving
Fun with bytecode weavingFun with bytecode weaving
Fun with bytecode weavingMatthew
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaIsuru Perera
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time JavaDeniz Oguz
 
JVM, byte codes & jvm languages
JVM, byte codes & jvm languagesJVM, byte codes & jvm languages
JVM, byte codes & jvm languagesEdgar Espina
 
Ijaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinderIjaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinderijaprr_editor
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination ExtRohit Kelapure
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunningguest1f2740
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance TunningTerry Cho
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuningJerry Kurian
 

Similar to Inside the jvm (20)

An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
 
Java Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight Recorder
 
Lecture 2 Java Virtual Machine .pptx
Lecture 2 Java Virtual Machine .pptxLecture 2 Java Virtual Machine .pptx
Lecture 2 Java Virtual Machine .pptx
 
GraalVm and Quarkus
GraalVm and QuarkusGraalVm and Quarkus
GraalVm and Quarkus
 
10 examples of hot spot jvm options in java
10 examples of hot spot jvm options in java10 examples of hot spot jvm options in java
10 examples of hot spot jvm options in java
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and Profiling
 
Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013
 
Taming The JVM
Taming The JVMTaming The JVM
Taming The JVM
 
Fun with bytecode weaving
Fun with bytecode weavingFun with bytecode weaving
Fun with bytecode weaving
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
 
jvm goes to big data
jvm goes to big datajvm goes to big data
jvm goes to big data
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time Java
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
JVM, byte codes & jvm languages
JVM, byte codes & jvm languagesJVM, byte codes & jvm languages
JVM, byte codes & jvm languages
 
Ijaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinderIjaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinder
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination Ext
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Temadag om-java-jamaica vm-2013-09
Temadag om-java-jamaica vm-2013-09Temadag om-java-jamaica vm-2013-09
Temadag om-java-jamaica vm-2013-09
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 

Recently uploaded

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Inside the jvm

  • 1. Inside the JVM STRUCTURE OF JAVA VIRTUAL MACHINE Development Center @ Pikicast.com 김병부 ( Benjamin )
  • 2. Benjamin : about me  Pikicast  Netmarble  U-Angel  Joins.com and etc
  • 3. 因果關係 : 인과관계  System Crash, Service Crash. Application Crash  서비스가 죽는 것은 항상 원인이 있습니다  시스템이 원인인지, 어플리케이션이 원인인지, 데이터 베이스가 원인인지 알아야 같은 현상을 막을 수 있습니다.  서비스는 한번에 죽지 않습니다. 서서히 죽어갈 뿐입니다.
  • 4. List of JVM  List of JVM??  The Java Virtual Machine Specification  Hotspot JVM  Open JVM  IBM JVM  TinyVM  Dalvik JM ??  Stack Machine vs Register Machine
  • 5. JVM : Java Virtual Machine #1  Class File  Bytecode 의 집합  Interpreter / JIT Compiler  Java Stack  Heap  Thread 들이 공유하는 메모리 영역  Method Area  Thread 들이 공유하는 메모리 영역  Class 변수, 상수, Class 정보, Method 정보
  • 7. Thread State : java.lang.Thread.State  NEW  RUNNABLE  TIMED_WAITING  WAITING  BLOCKED  TERMINATED  Since Java 1.5
  • 8.
  • 9. Thread :list of thread in the Hotspot JVM  Thread 종류  Non – Daemon Thread :  E.g. Thread, VM Thread  Daemon Thread :  Garbage Collector Thread, JMX Monitoring Thread  System Threads  VM thread  GC threads  Periodic task thread – timer events i.e. interrupts for schedule  Compiler thread – compiles byte code to native code in runtime
  • 10. Thread : Multi-Thread  Each thread has ..  Program Counter (PC)  Stack  Native stack  Stack Frame  Multi Thread – Context Switching & Scheduling  Thread-Safe  Keyword – synchronized
  • 11. JVM Stack  JVM Stack per Thread!!!  Stack Frame per Method  Local Variable Array  Operand Stack  Reference to Constant Pool
  • 12. Thread dump : How to dump JVM Thread  jstack [pid] or kill –3 [pid]Thread Dump Date JVM Type, Mode Thread name Thread Priority Thread ID Native Thread ID Thread STATUS Thread STACK info
  • 13. Thread Dump Tool : IBM Thread and Monitor Dump Analyzer for Java
  • 14. Heap Area 2nd Keyword inside of the JVM
  • 15. JVM Memory Structure : with JVM options  Basic Structure  Depends on GC options  Promotion  Minor GC vs Major GC  Young Generation  Old and Perm Generation  STW – Stop the world  From Java8,  No more PERM gen.  Metaspace (Native Heap)
  • 16. What is difference between Method Area and PERM GEN?  Actually the Method Area is a part of the PERM GEN A third generation closely related to the tenured generation is the permanent generation. The permanent generation is special because it holds data needed by the virtual machine to describe objects that do not have an equivalence at the Java language level. For example objects describing classes and methods are stored in the permanent generation.
  • 17. Thread and Heap : Reference from Stack to Heap
  • 18. Garbage Collection  GC options  Serial GC, Parallel GC – Mark, Sweep, Compact  Incremental GC  CMS  G1GC
  • 19. CMS vs G1GC  CMS GC  Concurrent – Mark – Sweep GC  more CPU,  G1GC  Garbage-First GC  Region  Recommend over 4G memory
  • 20. Heap Dump : How to dump JVM Heap  jmap –dump:format=b,file=[file name].hprof [PID]  JVM 메모리 사이즈 만큼의 binary 파일이 생성된다.  Binary 파일이므로 분석툴이 필요함.
  • 21. Heap Dump Tool : IBM HeapAnalyzer Or Eclipse Memory Analyzer
  • 22.
  • 23. OOME Case : Out Of Memory Exception  java.lang.OutOfMemoryError : Java heap space  java.lang.OutOfMemoryError : PermGen space  java.lang.OutOfMemoryError : Request array size exceeds VM limit
  • 25. Note  Dump 는 10초 간격으로 3번씩 뜬다.  Perm 영역에서도 OOM 이 발생할 수도 있다.  Hotspot JVM > Open JVM  Async Process 가 만능은 아님  MultiThread 도 Pool로 관리하자  Thread-safe and Pool Management  우리에겐 G1GC 가 가장 맞는 케이스  Throughput based tuning  Response time based tuning
  • 26. Reference  http://blog.jamesdbloom.com/JVMInternals.html  http://d2.naver.com/helloworld/1230  http://blog.takipi.com/garbage-collectors-serial-vs-parallel-vs-cms-vs-the-g1-and- whats-new-in-java-8/  http://www.slideshare.net/MonicaBeckwith/garbage-first-garbage-collector-g1-gc- migration-to-expectations-and-advanced-tuning  http://www.poalsoft.com/blog/?p=34

Editor's Notes

  1. Java byte code is interpreted however this is not as fast as directly executing native code on the JVM’s host CPU. To improve performance the Oracle Hotspot VM looks for “hot” areas of byte code that are executed regularly and compiles these to native code. The native code is then stored in the code cache in non-heap memory. In this way the Hotspot VM tries to choose the most appropriate way to trade-off the extra time it takes to compile code verses the extra time it take to execute interpreted code.
  2. 데몬 스레드는 다른 비데몬 스레드가 없다면 동작을 중지한다. 사용자가 직접 스레드를 생성하지 않더라도, Java 애플리케이션이 기본적으로 여러 개의 스레드를 생성한다. 대부분이 데몬 스레드인데 가비지 컬렉션이나, JMX 등의 작업을 처리하기 위한 것이다. 'static void main(String[] args)' 메서드가 실행되는 스레드는 비데몬 스레드로 생성되고, 이 스레드가 동작을 중지하면 다른 데몬 스레드도 같이 동작을 중지하게 되는 것이다. 이 main 메서드가 실행되는 스레드를 HotSpot VM에서는 VM Thread라고 부른다.
  3. Each frame contains: - Local variable array - Return value - Operand stack Reference to runtime constant pool for class of the current method Program counter – CPU 명령어 포인터
  4. Reference to Constant Pool : 각 클래스와 인터페이스의 상수뿐만 아니라, 메서드와 필드에 대한 모든 레퍼런스까지 담고 있는 테이블이다. 즉, 어떤 메서드나 필드를 참조할 때 JVM은 런타임 상수 풀을 통해 해당 메서드나 필드의 실제 메모리상 주소를 찾아서 참조한다.
  5. OLD generation == Tenured generation