SlideShare a Scribd company logo
JVM veVisualVM
JVM’i anlayalım ve analiz edelim
Dilaver Demirel - 20150913
Başlıklar
• JVM Nedir?
• Threads (deamon,non-deamon)
• Heap Nedir?
• Stack Nedir?
• Garbage Collection nedir?
• Örnek Uygulama /VisualVM
JVM Nedir?
Threads (deamon,non-deamon)
• Daemon thread JVM’nin kendi içerisinde garbage collection (çöp toplama)
gibi amaçlar için kullanılır
• Non-daemon thread ise bizim programımızda çalışan threadlerdir
JVM’e yüklenen
classların
Meta datalarını
Tutar. Perm gen
Memorynin
Bir parçasıdır.
JVM Block Diagram
Threadler çalışırken
kullanılan class
instancelerinin
tutulduğu alan
Threadlerlerin
method invocationlarında
Kullandıkları
geçici memory alanı
Heap Nedir?
• Java Heap JVM tarafından oluşturulur ve çeşitli hafıza
alanlarından oluşur
• Eden – new operatörü ile oluşturulan tüm nesneler önce bu hafıza
alanında oluşturulur.
• Survivor – nesneler old heap hafıza alanına transfer edilmeden
önce bir müddet survivor hafıza alanlarında kalır. Buradaki amaç
kısa ömürlü olan nesnelerin Garbage Collector tarafından
toplanmasına ve old heap alanına geçmelerini engellemektir.
• Old – uzun ömürlü nesnelerin ölene kadar kaldıkları hazıfa alanıdır.
• Permanent – sınıfların ve statik değerlerin yer aldığı hazıfa alanıdir.
JVM’in ihtiyacı olan metadatayı tutar. Heap memorynin bir parçası
değildir. Perm gen objeler full gc yapıldığında temizlenir.
JVM Memory Parametreleri
Switch Description
-Xms Sets the initial heap size for when the JVM starts.
-Xmx Sets the maximum heap size.
-Xmn Sets the size of theYoung Generation.
-XX:PermSize Sets the starting size of the Permanent Generation.
-XX:MaxPermSize
Sets the maximum size of the Permanent
Generation
Stack Nedir?
• Metodlar , metodlara gönderdiğimiz
parametreler , local primitive tipler
ve local referanslar(object
referance) bulunur
• Eğer primitive değişken class
içerisindeyse Heap memory
de, metod
içerisindeyse Stackmemory de
tutulur
Her threadin kendine ait stack alanı vardır.
Bir method çağrıldığında oluşan geçici datalar bir stack frame içinde tutulur
Garbage Collection
• Farklı JVM implementasyonları için farklı teknikler kullanır, standart bir tanımı
yoktur
• Temel görevi kullanimi son bulmus, hiçbir nesne örnegi tarafindan referans
gösterilmeyen, bellek bölgelerini tesipit edip o bölgelerdeki bellek alanini
bosaltmaktir
• Eğer kullanılmayan nesneler tespit edilip boşaltamazsa memory leak(bellek sızıntısı
oluşur)
• GC’nin ne zaman calisacagi JVM’in kontrolundedir
GC Adımları
Kaynaklar
• http://www.artima.com/insidejvm/ed2/jvm2.html
• http://www.artima.com/insidejvm/ed2/gc.html
• http://serkansakinmaz.blogspot.com.tr/2013/08/java-da-stack-ve-heap-kavram.html
• https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/
• http://bilgehanarslan.com/jvm-nedir/
• http://jvmmemory.com/
• http://www.kurumsaljava.com/2015/01/08/jvm-stack-nedir-ve-nasil-calisir/
• http://javapapers.com/core-java/java-jvm-run-time-data-areas/#Method_Area
• http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html#t1s2
• http://www.journaldev.com/2856/java-jvm-memory-model-and-garbage-collection-monitoring-tuning

More Related Content

What's hot

Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4
HngNguyn748044
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABC
Robert Bohne
 
Comparación de API y SOA
Comparación de API y SOAComparación de API y SOA
Comparación de API y SOA
Diego Suarez
 
Cloud Native Applications Maturity Model
Cloud Native Applications Maturity ModelCloud Native Applications Maturity Model
Cloud Native Applications Maturity Model
Jim Bugwadia
 
Cloud migration
Cloud migrationCloud migration
Cloud migration
christen gumbi
 
Global Netflix Platform
Global Netflix PlatformGlobal Netflix Platform
Global Netflix Platform
Adrian Cockcroft
 
Future of Cloud 2022 - Grow and Be Green
Future of Cloud 2022 - Grow and Be GreenFuture of Cloud 2022 - Grow and Be Green
Future of Cloud 2022 - Grow and Be Green
Vishal Sharma
 
Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive Programming
Stéphane Maldini
 
VMware Tanzu Kubernetes Connect
VMware Tanzu Kubernetes ConnectVMware Tanzu Kubernetes Connect
VMware Tanzu Kubernetes Connect
VMware Tanzu
 
React Native
React NativeReact Native
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
Krishnaprasad k
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native Application
Emiliano Pecis
 
Mern stack developement
Mern stack developementMern stack developement
Mern stack developement
kalyankumar836878
 
Observables in Angular
Observables in AngularObservables in Angular
Observables in Angular
Knoldus Inc.
 
Webinar "Introduction to OpenStack"
Webinar "Introduction to OpenStack"Webinar "Introduction to OpenStack"
Webinar "Introduction to OpenStack"
CREATE-NET
 
How Workato creates robust data pipelines and automations for you?
How Workato creates robust data pipelines and automations for you?How Workato creates robust data pipelines and automations for you?
How Workato creates robust data pipelines and automations for you?
Jeraldine Phneah
 
How to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platformHow to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platform
actualtechmedia
 
Kubeflow at Spotify (For the Kubeflow Summit)
Kubeflow at Spotify (For the Kubeflow Summit)Kubeflow at Spotify (For the Kubeflow Summit)
Kubeflow at Spotify (For the Kubeflow Summit)
Josh Baer
 
MULTI-CLOUD ARCHITECTURE
MULTI-CLOUD ARCHITECTUREMULTI-CLOUD ARCHITECTURE
MULTI-CLOUD ARCHITECTURE
Maganathin Veeraragaloo
 
Bridging Microservices, APIs and Integration
Bridging Microservices, APIs and IntegrationBridging Microservices, APIs and Integration
Bridging Microservices, APIs and Integration
Kasun Indrasiri
 

What's hot (20)

Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABC
 
Comparación de API y SOA
Comparación de API y SOAComparación de API y SOA
Comparación de API y SOA
 
Cloud Native Applications Maturity Model
Cloud Native Applications Maturity ModelCloud Native Applications Maturity Model
Cloud Native Applications Maturity Model
 
Cloud migration
Cloud migrationCloud migration
Cloud migration
 
Global Netflix Platform
Global Netflix PlatformGlobal Netflix Platform
Global Netflix Platform
 
Future of Cloud 2022 - Grow and Be Green
Future of Cloud 2022 - Grow and Be GreenFuture of Cloud 2022 - Grow and Be Green
Future of Cloud 2022 - Grow and Be Green
 
Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive Programming
 
VMware Tanzu Kubernetes Connect
VMware Tanzu Kubernetes ConnectVMware Tanzu Kubernetes Connect
VMware Tanzu Kubernetes Connect
 
React Native
React NativeReact Native
React Native
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native Application
 
Mern stack developement
Mern stack developementMern stack developement
Mern stack developement
 
Observables in Angular
Observables in AngularObservables in Angular
Observables in Angular
 
Webinar "Introduction to OpenStack"
Webinar "Introduction to OpenStack"Webinar "Introduction to OpenStack"
Webinar "Introduction to OpenStack"
 
How Workato creates robust data pipelines and automations for you?
How Workato creates robust data pipelines and automations for you?How Workato creates robust data pipelines and automations for you?
How Workato creates robust data pipelines and automations for you?
 
How to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platformHow to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platform
 
Kubeflow at Spotify (For the Kubeflow Summit)
Kubeflow at Spotify (For the Kubeflow Summit)Kubeflow at Spotify (For the Kubeflow Summit)
Kubeflow at Spotify (For the Kubeflow Summit)
 
MULTI-CLOUD ARCHITECTURE
MULTI-CLOUD ARCHITECTUREMULTI-CLOUD ARCHITECTURE
MULTI-CLOUD ARCHITECTURE
 
Bridging Microservices, APIs and Integration
Bridging Microservices, APIs and IntegrationBridging Microservices, APIs and Integration
Bridging Microservices, APIs and Integration
 

More from Dilaver Demirel

Git - Code Versiyon Yönetim Sistemi
Git - Code Versiyon Yönetim SistemiGit - Code Versiyon Yönetim Sistemi
Git - Code Versiyon Yönetim Sistemi
Dilaver Demirel
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
Dilaver Demirel
 
Unit test
Unit testUnit test
Unit test
Dilaver Demirel
 
12factor apps
12factor apps12factor apps
12factor apps
Dilaver Demirel
 
Software/Yazılım Test
Software/Yazılım TestSoftware/Yazılım Test
Software/Yazılım Test
Dilaver Demirel
 
SDLC - Software Development Life Cycle
SDLC - Software Development Life CycleSDLC - Software Development Life Cycle
SDLC - Software Development Life Cycle
Dilaver Demirel
 
Yazılım Prensipleri ve Code Review Check List
Yazılım Prensipleri ve Code Review Check ListYazılım Prensipleri ve Code Review Check List
Yazılım Prensipleri ve Code Review Check List
Dilaver Demirel
 
Oracle Weblogic Server
Oracle Weblogic ServerOracle Weblogic Server
Oracle Weblogic Server
Dilaver Demirel
 
Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
Dilaver Demirel
 
Pentaho BI
Pentaho BIPentaho BI
Pentaho BI
Dilaver Demirel
 
Apache Maven
Apache MavenApache Maven
Apache Maven
Dilaver Demirel
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
Dilaver Demirel
 
NodeJS ve MongoDB
NodeJS ve MongoDBNodeJS ve MongoDB
NodeJS ve MongoDB
Dilaver Demirel
 
NodeJS Nedir
NodeJS NedirNodeJS Nedir
NodeJS Nedir
Dilaver Demirel
 
Jpa
JpaJpa

More from Dilaver Demirel (15)

Git - Code Versiyon Yönetim Sistemi
Git - Code Versiyon Yönetim SistemiGit - Code Versiyon Yönetim Sistemi
Git - Code Versiyon Yönetim Sistemi
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Unit test
Unit testUnit test
Unit test
 
12factor apps
12factor apps12factor apps
12factor apps
 
Software/Yazılım Test
Software/Yazılım TestSoftware/Yazılım Test
Software/Yazılım Test
 
SDLC - Software Development Life Cycle
SDLC - Software Development Life CycleSDLC - Software Development Life Cycle
SDLC - Software Development Life Cycle
 
Yazılım Prensipleri ve Code Review Check List
Yazılım Prensipleri ve Code Review Check ListYazılım Prensipleri ve Code Review Check List
Yazılım Prensipleri ve Code Review Check List
 
Oracle Weblogic Server
Oracle Weblogic ServerOracle Weblogic Server
Oracle Weblogic Server
 
Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
 
Pentaho BI
Pentaho BIPentaho BI
Pentaho BI
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
NodeJS ve MongoDB
NodeJS ve MongoDBNodeJS ve MongoDB
NodeJS ve MongoDB
 
NodeJS Nedir
NodeJS NedirNodeJS Nedir
NodeJS Nedir
 
Jpa
JpaJpa
Jpa
 

JVM ve VisualVm

  • 1. JVM veVisualVM JVM’i anlayalım ve analiz edelim Dilaver Demirel - 20150913
  • 2. Başlıklar • JVM Nedir? • Threads (deamon,non-deamon) • Heap Nedir? • Stack Nedir? • Garbage Collection nedir? • Örnek Uygulama /VisualVM
  • 4. Threads (deamon,non-deamon) • Daemon thread JVM’nin kendi içerisinde garbage collection (çöp toplama) gibi amaçlar için kullanılır • Non-daemon thread ise bizim programımızda çalışan threadlerdir
  • 5. JVM’e yüklenen classların Meta datalarını Tutar. Perm gen Memorynin Bir parçasıdır. JVM Block Diagram Threadler çalışırken kullanılan class instancelerinin tutulduğu alan Threadlerlerin method invocationlarında Kullandıkları geçici memory alanı
  • 6. Heap Nedir? • Java Heap JVM tarafından oluşturulur ve çeşitli hafıza alanlarından oluşur • Eden – new operatörü ile oluşturulan tüm nesneler önce bu hafıza alanında oluşturulur. • Survivor – nesneler old heap hafıza alanına transfer edilmeden önce bir müddet survivor hafıza alanlarında kalır. Buradaki amaç kısa ömürlü olan nesnelerin Garbage Collector tarafından toplanmasına ve old heap alanına geçmelerini engellemektir. • Old – uzun ömürlü nesnelerin ölene kadar kaldıkları hazıfa alanıdır. • Permanent – sınıfların ve statik değerlerin yer aldığı hazıfa alanıdir. JVM’in ihtiyacı olan metadatayı tutar. Heap memorynin bir parçası değildir. Perm gen objeler full gc yapıldığında temizlenir.
  • 7. JVM Memory Parametreleri Switch Description -Xms Sets the initial heap size for when the JVM starts. -Xmx Sets the maximum heap size. -Xmn Sets the size of theYoung Generation. -XX:PermSize Sets the starting size of the Permanent Generation. -XX:MaxPermSize Sets the maximum size of the Permanent Generation
  • 8.
  • 9. Stack Nedir? • Metodlar , metodlara gönderdiğimiz parametreler , local primitive tipler ve local referanslar(object referance) bulunur • Eğer primitive değişken class içerisindeyse Heap memory de, metod içerisindeyse Stackmemory de tutulur
  • 10. Her threadin kendine ait stack alanı vardır. Bir method çağrıldığında oluşan geçici datalar bir stack frame içinde tutulur
  • 11. Garbage Collection • Farklı JVM implementasyonları için farklı teknikler kullanır, standart bir tanımı yoktur • Temel görevi kullanimi son bulmus, hiçbir nesne örnegi tarafindan referans gösterilmeyen, bellek bölgelerini tesipit edip o bölgelerdeki bellek alanini bosaltmaktir • Eğer kullanılmayan nesneler tespit edilip boşaltamazsa memory leak(bellek sızıntısı oluşur) • GC’nin ne zaman calisacagi JVM’in kontrolundedir
  • 13. Kaynaklar • http://www.artima.com/insidejvm/ed2/jvm2.html • http://www.artima.com/insidejvm/ed2/gc.html • http://serkansakinmaz.blogspot.com.tr/2013/08/java-da-stack-ve-heap-kavram.html • https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/ • http://bilgehanarslan.com/jvm-nedir/ • http://jvmmemory.com/ • http://www.kurumsaljava.com/2015/01/08/jvm-stack-nedir-ve-nasil-calisir/ • http://javapapers.com/core-java/java-jvm-run-time-data-areas/#Method_Area • http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html#t1s2 • http://www.journaldev.com/2856/java-jvm-memory-model-and-garbage-collection-monitoring-tuning