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

Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Michal Balinski
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAvasuraj pandey
 
Collectors in the Wild
Collectors in the WildCollectors in the Wild
Collectors in the WildJosé Paumard
 
Introduction of Java GC Tuning and Java Java Mission Control
Introduction of Java GC Tuning and Java Java Mission ControlIntroduction of Java GC Tuning and Java Java Mission Control
Introduction of Java GC Tuning and Java Java Mission ControlLeon Chen
 
Tomcat and apache httpd training
Tomcat and apache httpd trainingTomcat and apache httpd training
Tomcat and apache httpd trainingFranck SIMON
 
JVM Memory Management Details
JVM Memory Management DetailsJVM Memory Management Details
JVM Memory Management DetailsAzul Systems Inc.
 
Introduction to Java 11
Introduction to Java 11 Introduction to Java 11
Introduction to Java 11 Knoldus Inc.
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz SAurabh PRajapati
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application StructureSEONGTAEK OH
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewBrett Meyer
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
 
Reactive programming
Reactive programmingReactive programming
Reactive programmingSUDIP GHOSH
 
Node js Modules and Event Emitters
Node js Modules and Event EmittersNode js Modules and Event Emitters
Node js Modules and Event EmittersTheCreativedev Blog
 

What's hot (20)

Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAva
 
Collectors in the Wild
Collectors in the WildCollectors in the Wild
Collectors in the Wild
 
The Java memory model made easy
The Java memory model made easyThe Java memory model made easy
The Java memory model made easy
 
Introduction of Java GC Tuning and Java Java Mission Control
Introduction of Java GC Tuning and Java Java Mission ControlIntroduction of Java GC Tuning and Java Java Mission Control
Introduction of Java GC Tuning and Java Java Mission Control
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
Tomcat and apache httpd training
Tomcat and apache httpd trainingTomcat and apache httpd training
Tomcat and apache httpd training
 
JVM Memory Management Details
JVM Memory Management DetailsJVM Memory Management Details
JVM Memory Management Details
 
Introduction to Java 11
Introduction to Java 11 Introduction to Java 11
Introduction to Java 11
 
Java GC
Java GCJava GC
Java GC
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application Structure
 
Session bean
Session beanSession bean
Session bean
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
Node js Modules and Event Emitters
Node js Modules and Event EmittersNode js Modules and Event Emitters
Node js Modules and Event Emitters
 
Java & advanced java
Java & advanced javaJava & advanced java
Java & advanced java
 
Node.js
Node.jsNode.js
Node.js
 

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

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

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