SlideShare a Scribd company logo
1 of 23
JVM PROBLEM
DIAGNOSTICS
Danijel Mitar, King ICT
Aleksander Radovan, King ICT
Contents
■ Top performance problems
– Database
– Memory
■ JVM monitoring
■ Demo: GC algorithms & heap dump analysis
■ JVM tuning flags
■ Performance testing tools
Top performance problems
■ Database
– N + 1 problem
– Caching
– Connection pools
■ Memory
– STW (Stop-The-World) garbage collections
– Memory leaks
N + 1 problem
■ Symptoms:
– Increased load on database, slower response times
■ Troubleshooting:
– Counters for the number of database calls and number of executed transactions
– Correlation between those numbers
■ Avoiding problem:
– Eager vs lazy?
– SQLJOIN (HQL fetch join)
Caching
■ Symptoms:
– Increased CPU overhead and disk I/O rate
■ Troubleshooting:
– Memory monitoring
– Hit ratio vs miss ratio
■ Avoiding problem:
– Thorough planning
– Proper cache configuration
– Eventual consistency
Connection pools
■ Symptoms:
– Increased response times
– Low/high resource utilization
■ Troubleshooting:
– Waiting for getConnection() call (underutilized)
– Waiting for execute() call (over-utilized)
■ Avoiding problem:
– Tune SQL queries
– Estimate relative balance between various queries
– Load test against database and tune for optimal performance
– Load test application
Stop-The-World garbage collections
■ Major garbage collection
■ Freeze all threads  mark-sweep collection  compaction
– Very effective
– Very slow (10 x minor collection)
■ CPU & heap memory spikes
■ Abnormal response times
Eden space
Tenure space
Loaded classes (classloader)
S0 S1
Young
generation
Tenured
generation
Permanent
generation
Survivor spaces
Minor GCs
FullGCs
Die young or live forever.
Turtle theory,Young generation theory of garbage collection
GC Algorithms – Serial, Parallel & CMS
GC Algorithms – Garbage First
Memory leaks
■ Symptoms:
– Increased memory usage leading to out of memory
– Very difficult to differentiate between simple out of memory and memory leak
■ Troubleshooting:
– Unbounded growth: Collections classes
– Heap dump analysis
■ Avoiding problem:
– Good session management
– Carefull usage of Collections classes
– Memory profiler
JVM monitoring
■ jcmd & jmap
– Command line tools
– Very useful for quick analysis
■ JVisualVM
– GUI tool for monitoring heap, CPU and threads
– Visual GC plugin
■ Heap dump analysis
– jhat
– MAT - Memory AnalyzerTool (Eclipse)
– VisualVM launcher (IntelliJ IDEA)
JVM tuning flags
Flag What it does When to use it
-server Chooses the server
compiler.
For long-running applications
that need fast performance.
-client Chooses the client
compiler.
For applications where startup
is the most important factor.
-XX:+TieredCompilation Uses tiered compilation (both
client and server).
For applications where you
want the best possible
performance and have enough
available native memory for the
extra compiled code.
JVM tuning flags
Flag What it does When to use it
-XX:+UseSerialGC Uses a simple, single-threaded
GC algorithm.
For small (100 MB) heaps.
-XX:+UseParallelOldGC Uses multiple threads to collect
the old generation while
application threads are
stopped.
When your application can
tolerate occasional long pauses
and you want to maximize
throughput while minimizing
CPU usage.
-XX:+UseParallelGC Uses multiple threads to collect
the young generation while
application threads are
stopped.
Use in conjunction with
UseParallelOldGC.
JVM tuning flags
Flag What it does When to use it
-XX:+UseConcMarkSweepGC Uses background thread(s) to
remove garbage from the old
generation with minimal
pauses.
When you have available CPU for
the background thread, you do not
want long GC pauses, and you have
a relatively small heap.
-XX:+UseParNewGC Uses multiple threads to collect the
young generation while application
threads are stopped.
Use in conjunction with Use
ConcMarkSweepGC.
-XX:+UseG1GC Uses multiple threads to collect the
young generation while application
threads are stopped, and
background thread(s) to remove
garbage from the old generation
with minimal pauses.
When you have available CPU for
the background thread, you do not
want long GC pauses, and you do
not have a small heap.
In development for Java 9: Shenandoah GC
Performance testing tools
■ JMeter
■ Gatling
■ The Grinder
■ Faban
We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil.
Donald Knuth
QUESTIONS?
Resources
Oaks, S. (2014). Java Performance:The Definitive Guide. Sebastopol, Kalifornija: O’Reilly Media, Inc.
Oransa, O. (2014). Java EE 7 PerformanceTuning and Optimization, Birmingham: Packt Publishing Ltd.
http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.mat.ui.help/welcome.html
http://www.vogella.com/tutorials/EclipseMemoryAnalyzer/article.html
http://infoq.com/articles/Diagnosing-Common-Java-Database-Performance-Hotspots
https://www.pluralsight.com/courses/understanding-java-vm-memory-management
http://www.zabbix.com/documentation.php
http://blog.king-ict.hr/dmitar

More Related Content

What's hot

Sun jdk 1.6 gc english version
Sun jdk 1.6 gc english versionSun jdk 1.6 gc english version
Sun jdk 1.6 gc english versionbluedavy lin
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage CollectorDaya Atapattu
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Dinakar Guniguntala
 
Jvm operation casual talks
Jvm operation casual talksJvm operation casual talks
Jvm operation casual talksYusaku Watanabe
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...ScyllaDB
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...ScyllaDB
 
IBM FlashSystem 840 eng
IBM FlashSystem 840 engIBM FlashSystem 840 eng
IBM FlashSystem 840 engOleg Korol
 
AWS CSA Associate 01-07
AWS CSA Associate 01-07AWS CSA Associate 01-07
AWS CSA Associate 01-07Heitor Vital
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleScyllaDB
 
Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)Scott Mansfield
 
P99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageP99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageScyllaDB
 
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)Cyrille Le Clerc
 
M|18 Where and How to Optimize for Performance
M|18 Where and How to Optimize for PerformanceM|18 Where and How to Optimize for Performance
M|18 Where and How to Optimize for PerformanceMariaDB plc
 
#NetflixEverywhere Global Architecture
#NetflixEverywhere Global Architecture#NetflixEverywhere Global Architecture
#NetflixEverywhere Global ArchitectureC4Media
 

What's hot (18)

Sun jdk 1.6 gc english version
Sun jdk 1.6 gc english versionSun jdk 1.6 gc english version
Sun jdk 1.6 gc english version
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage Collector
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !
 
Jvm operation casual talks
Jvm operation casual talksJvm operation casual talks
Jvm operation casual talks
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
 
IBM FlashSystem 840 eng
IBM FlashSystem 840 engIBM FlashSystem 840 eng
IBM FlashSystem 840 eng
 
EVCache & Moneta (GoSF)
EVCache & Moneta (GoSF)EVCache & Moneta (GoSF)
EVCache & Moneta (GoSF)
 
Memcache d
Memcache dMemcache d
Memcache d
 
AWS CSA Associate 01-07
AWS CSA Associate 01-07AWS CSA Associate 01-07
AWS CSA Associate 01-07
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at Scale
 
Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)
 
P99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageP99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent Storage
 
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
 
M|18 Where and How to Optimize for Performance
M|18 Where and How to Optimize for PerformanceM|18 Where and How to Optimize for Performance
M|18 Where and How to Optimize for Performance
 
Java Memory Management Tricks
Java Memory Management Tricks Java Memory Management Tricks
Java Memory Management Tricks
 
#NetflixEverywhere Global Architecture
#NetflixEverywhere Global Architecture#NetflixEverywhere Global Architecture
#NetflixEverywhere Global Architecture
 
Running MySQL in AWS
Running MySQL in AWSRunning MySQL in AWS
Running MySQL in AWS
 

Viewers also liked

Slide Design Project
Slide Design ProjectSlide Design Project
Slide Design ProjectEllie Arave
 
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed Mohamed Mousa
 
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)mastaneh zohri
 
Aplicacion de la Norma Covenin 3.049-93
Aplicacion de la Norma Covenin 3.049-93Aplicacion de la Norma Covenin 3.049-93
Aplicacion de la Norma Covenin 3.049-93Jorge Mendoza
 
PP LF Steering Committee Meeting.062416
PP LF Steering Committee Meeting.062416PP LF Steering Committee Meeting.062416
PP LF Steering Committee Meeting.062416David Whitaker, AICP
 
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...Pedro Martinez-Clark, M.D.
 
Book review
Book reviewBook review
Book reviewFa Saif
 
II Guerra Mundial
II Guerra MundialII Guerra Mundial
II Guerra Mundialheroldd
 
Componentes de un cursos
Componentes de un cursosComponentes de un cursos
Componentes de un cursosAngel Cuá
 
CV-Tanveer-Geologist
CV-Tanveer-GeologistCV-Tanveer-Geologist
CV-Tanveer-GeologistTanveer Ali
 
Ellie Arave Final Project
Ellie Arave Final ProjectEllie Arave Final Project
Ellie Arave Final ProjectEllie Arave
 
Saquilá cuá, angel. actividad no. 4
Saquilá cuá, angel.  actividad no. 4Saquilá cuá, angel.  actividad no. 4
Saquilá cuá, angel. actividad no. 4Angel Cuá
 

Viewers also liked (20)

POT
POTPOT
POT
 
Slide Design Project
Slide Design ProjectSlide Design Project
Slide Design Project
 
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed
CURRICULUM VIATE_Senior interior designer Mohamed Fathy Mousa Ahmed
 
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)
JLS-064-077-MASTANEH-ABNORMAL-PATIENTS(1)
 
Aplicacion de la Norma Covenin 3.049-93
Aplicacion de la Norma Covenin 3.049-93Aplicacion de la Norma Covenin 3.049-93
Aplicacion de la Norma Covenin 3.049-93
 
Estados financieros
Estados financierosEstados financieros
Estados financieros
 
PP LF Steering Committee Meeting.062416
PP LF Steering Committee Meeting.062416PP LF Steering Committee Meeting.062416
PP LF Steering Committee Meeting.062416
 
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...
Transcaval Retrograde Transcatheter Aortic Valve Replacement for Patients Wit...
 
Book review
Book reviewBook review
Book review
 
II Guerra Mundial
II Guerra MundialII Guerra Mundial
II Guerra Mundial
 
Final Portfolio
Final PortfolioFinal Portfolio
Final Portfolio
 
Componentes de un cursos
Componentes de un cursosComponentes de un cursos
Componentes de un cursos
 
'Training Certs-1
'Training Certs-1'Training Certs-1
'Training Certs-1
 
ACS-NANO-2011
ACS-NANO-2011ACS-NANO-2011
ACS-NANO-2011
 
Carnaval en perú f
Carnaval en perú fCarnaval en perú f
Carnaval en perú f
 
CV-Tanveer-Geologist
CV-Tanveer-GeologistCV-Tanveer-Geologist
CV-Tanveer-Geologist
 
Pedro Martinez-Clark_01-16 CV
Pedro Martinez-Clark_01-16 CVPedro Martinez-Clark_01-16 CV
Pedro Martinez-Clark_01-16 CV
 
Ellie Arave Final Project
Ellie Arave Final ProjectEllie Arave Final Project
Ellie Arave Final Project
 
Science
ScienceScience
Science
 
Saquilá cuá, angel. actividad no. 4
Saquilá cuá, angel.  actividad no. 4Saquilá cuá, angel.  actividad no. 4
Saquilá cuá, angel. actividad no. 4
 

Similar to Jvm problem diagnostics

JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance TuningJeremy Leisy
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020Jelastic Multi-Cloud PaaS
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsIsuru Perera
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...InfinIT - Innovationsnetværket for it
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...srisatish ambati
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
7 jvm-arguments-Confoo
7 jvm-arguments-Confoo7 jvm-arguments-Confoo
7 jvm-arguments-ConfooTier1 app
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...Jelastic Multi-Cloud PaaS
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageJelastic Multi-Cloud PaaS
 
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
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9DanHeidinga
 
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
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVMSimon Ritter
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time JavaDeniz Oguz
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...Chester Chen
 
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
 

Similar to Jvm problem diagnostics (20)

JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
7 jvm-arguments-Confoo
7 jvm-arguments-Confoo7 jvm-arguments-Confoo
7 jvm-arguments-Confoo
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
 
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
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
 
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
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time Java
 
Js on-microcontrollers
Js on-microcontrollersJs on-microcontrollers
Js on-microcontrollers
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
 
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
 

Recently uploaded

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 

Recently uploaded (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

Jvm problem diagnostics

  • 1. JVM PROBLEM DIAGNOSTICS Danijel Mitar, King ICT Aleksander Radovan, King ICT
  • 2. Contents ■ Top performance problems – Database – Memory ■ JVM monitoring ■ Demo: GC algorithms & heap dump analysis ■ JVM tuning flags ■ Performance testing tools
  • 3. Top performance problems ■ Database – N + 1 problem – Caching – Connection pools ■ Memory – STW (Stop-The-World) garbage collections – Memory leaks
  • 4. N + 1 problem ■ Symptoms: – Increased load on database, slower response times ■ Troubleshooting: – Counters for the number of database calls and number of executed transactions – Correlation between those numbers ■ Avoiding problem: – Eager vs lazy? – SQLJOIN (HQL fetch join)
  • 5. Caching ■ Symptoms: – Increased CPU overhead and disk I/O rate ■ Troubleshooting: – Memory monitoring – Hit ratio vs miss ratio ■ Avoiding problem: – Thorough planning – Proper cache configuration – Eventual consistency
  • 6. Connection pools ■ Symptoms: – Increased response times – Low/high resource utilization ■ Troubleshooting: – Waiting for getConnection() call (underutilized) – Waiting for execute() call (over-utilized) ■ Avoiding problem: – Tune SQL queries – Estimate relative balance between various queries – Load test against database and tune for optimal performance – Load test application
  • 7. Stop-The-World garbage collections ■ Major garbage collection ■ Freeze all threads  mark-sweep collection  compaction – Very effective – Very slow (10 x minor collection) ■ CPU & heap memory spikes ■ Abnormal response times
  • 8. Eden space Tenure space Loaded classes (classloader) S0 S1 Young generation Tenured generation Permanent generation Survivor spaces Minor GCs FullGCs
  • 9.
  • 10. Die young or live forever. Turtle theory,Young generation theory of garbage collection
  • 11. GC Algorithms – Serial, Parallel & CMS
  • 12. GC Algorithms – Garbage First
  • 13.
  • 14. Memory leaks ■ Symptoms: – Increased memory usage leading to out of memory – Very difficult to differentiate between simple out of memory and memory leak ■ Troubleshooting: – Unbounded growth: Collections classes – Heap dump analysis ■ Avoiding problem: – Good session management – Carefull usage of Collections classes – Memory profiler
  • 15. JVM monitoring ■ jcmd & jmap – Command line tools – Very useful for quick analysis ■ JVisualVM – GUI tool for monitoring heap, CPU and threads – Visual GC plugin ■ Heap dump analysis – jhat – MAT - Memory AnalyzerTool (Eclipse) – VisualVM launcher (IntelliJ IDEA)
  • 16.
  • 17. JVM tuning flags Flag What it does When to use it -server Chooses the server compiler. For long-running applications that need fast performance. -client Chooses the client compiler. For applications where startup is the most important factor. -XX:+TieredCompilation Uses tiered compilation (both client and server). For applications where you want the best possible performance and have enough available native memory for the extra compiled code.
  • 18. JVM tuning flags Flag What it does When to use it -XX:+UseSerialGC Uses a simple, single-threaded GC algorithm. For small (100 MB) heaps. -XX:+UseParallelOldGC Uses multiple threads to collect the old generation while application threads are stopped. When your application can tolerate occasional long pauses and you want to maximize throughput while minimizing CPU usage. -XX:+UseParallelGC Uses multiple threads to collect the young generation while application threads are stopped. Use in conjunction with UseParallelOldGC.
  • 19. JVM tuning flags Flag What it does When to use it -XX:+UseConcMarkSweepGC Uses background thread(s) to remove garbage from the old generation with minimal pauses. When you have available CPU for the background thread, you do not want long GC pauses, and you have a relatively small heap. -XX:+UseParNewGC Uses multiple threads to collect the young generation while application threads are stopped. Use in conjunction with Use ConcMarkSweepGC. -XX:+UseG1GC Uses multiple threads to collect the young generation while application threads are stopped, and background thread(s) to remove garbage from the old generation with minimal pauses. When you have available CPU for the background thread, you do not want long GC pauses, and you do not have a small heap. In development for Java 9: Shenandoah GC
  • 20. Performance testing tools ■ JMeter ■ Gatling ■ The Grinder ■ Faban
  • 21. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Donald Knuth
  • 23. Resources Oaks, S. (2014). Java Performance:The Definitive Guide. Sebastopol, Kalifornija: O’Reilly Media, Inc. Oransa, O. (2014). Java EE 7 PerformanceTuning and Optimization, Birmingham: Packt Publishing Ltd. http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.mat.ui.help/welcome.html http://www.vogella.com/tutorials/EclipseMemoryAnalyzer/article.html http://infoq.com/articles/Diagnosing-Common-Java-Database-Performance-Hotspots https://www.pluralsight.com/courses/understanding-java-vm-memory-management http://www.zabbix.com/documentation.php http://blog.king-ict.hr/dmitar