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

JVM Memory Management Details
JVM Memory Management DetailsJVM Memory Management Details
JVM Memory Management DetailsAzul Systems Inc.
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machineNikhil Sharma
 
IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교JungWoon Lee
 
Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Alex Motley
 
Java Heap Dump Analysis Primer
Java Heap Dump Analysis PrimerJava Heap Dump Analysis Primer
Java Heap Dump Analysis PrimerKyle Hodgson
 
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
Performance Tuning -  Memory leaks, Thread deadlocks, JDK toolsPerformance Tuning -  Memory leaks, Thread deadlocks, JDK tools
Performance Tuning - Memory leaks, Thread deadlocks, JDK toolsHaribabu Nandyal Padmanaban
 
Performance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionPerformance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionHaribabu Nandyal Padmanaban
 
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...Simplilearn
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking JenkinsMiro Cupak
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKJosé Paumard
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfJosé Paumard
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in JavaAllan Huang
 
Everything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @TwitterEverything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @TwitterAttila Szegedi
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in javaRakesh Mittal
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesBruno Borges
 

What's hot (20)

JVM Memory Management Details
JVM Memory Management DetailsJVM Memory Management Details
JVM Memory Management Details
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Java modules
Java modulesJava modules
Java modules
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교
 
Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)
 
Java Heap Dump Analysis Primer
Java Heap Dump Analysis PrimerJava Heap Dump Analysis Primer
Java Heap Dump Analysis Primer
 
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
Performance Tuning -  Memory leaks, Thread deadlocks, JDK toolsPerformance Tuning -  Memory leaks, Thread deadlocks, JDK tools
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
 
Performance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionPerformance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage Collection
 
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...
JMeter Load Testing | Load Testing Using JMmeter | JMeter Tutorial For Beginn...
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdf
 
Core java
Core javaCore java
Core java
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in Java
 
Everything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @TwitterEverything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @Twitter
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in java
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 

Viewers also liked (14)

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
 
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

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 

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