SlideShare a Scribd company logo
Modern Engineer’s
troubleshooting tools, techniques
& tricks
Ram Lakshmanan
Architect – GCeasy.io & fastThread.io
Confoo - 2018
Problems
1. Functional
2. Non-Functional
What types of non-functional Problems you have
faced?
Have you experienced sudden CPU spikes?
• This Problem happened in major B2B Travel app
jstack -l <pid> > /tmp/threadDump.txt
jcmd <pid> Thread.print > /tmp/threadDump.txt
Jstack (since Java 5) kill -3 jVisualVM
JMC Windows (Ctrl + Break) ThreadMXBean
APM Tools Jcmd (since Java 7)
1. 2. 3.
4. 5. 6.
7. 8.
How to capture thread dumps? – 8 options
https://blog.fastthread.io/2016/06/06/how-to-take-thread-dumps-7-options/
1. Infinite looping
while (aCondition()) {
doSomething();
}
1
Diagnose sudden CPU spikes?
2
Thread Mill Pattern
https://blog.fastthread.io/2016/03/16/thread-dump-analysis-pattern-thread-mill/
Other Patterns
• ATHLETE
• ATHEROSCLEROSIS
• TRAFFIC JAM
• ALL ROADS LEAD TO ROME
• LEPRECHAUN TRAP
• SEVERAL SCAVENGERS
• STOCK TICKER
• More Patterns - https://blog.fastthread.io/category/thread-dump-
patterns/
Have you experienced unresponsive DB/NoSQL?
• Demo - Real Problem happened in a major Banking application.
RSI Pattern
https://blog.fastthread.io/2016/02/22/thread-dump-analysis-pattern-repetitive-strain-injury-rsi/
Thread dump analyzers
• fastThread.io
• IBM Thread and Monitor Dump Analyzer
• Samurai
• TDA
2. Consecutive Full GCs
2
Diagnose sudden CPU spikes
1. Infinite looping
while (aCondition()) {
doSomething();
}
2. Consecutive Full GCs
Diagnose sudden CPU spikes
1. Infinite looping
while (aCondition()) {
doSomething();
}
Welcome to the world of Garbage
Collection
Garbage Collection is automatic. But not free.
How to enable Garbage Collection Log?
Till Java 8:
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<file-path>
From Java 9:
-Xlog:gc*:file=<file-path>
Demo - healthy application’s GC Log
• http://gceasy.io/my-gc-
report.jsp?p=c2hhcmVkLzIwMTgvMDMvOC8tLTAuZmlyc3RHQy5sb2cu
emlwLS0xOC0xMC00
Demo - sick application’s GC Log
• http://gceasy.io/diamondgc-report.jsp?oTxnId_value=97fff4aa-b22f-
424e-b112-fab579369ccb
How to reduce long GC Pause?
• 7 strategies.
<<Will be discussed in detail in tomorrow’s 2pm session “Become a Garbage
Collection Hero”>>
• First & foremost strategy: Reduce memory consumption
Welcome to the world of Heap dump
analysis
Demo - Let’s analyze Heap Dump
Have you experienced
OutOfMemoryError?
Types of OutOfMemoryErrors?
1. Java Heap Space
2. GC overhead limit exceeded
3. Requested array size exceeds VM limit
4. Permgen space
5. Metaspace
6. Unable to create new native thread
7. Kill process or sacrifice child
8. Reason stack_trace_with_native_method
OutOfMemoryError: Unable to create new native
thread?
Java Heap
Physical memory4 GB (-Xms, -Xmx)
8 GB
Java Heap
Physical memory4 GB (-Xms, -Xmx)
8 GB
Process-1 Process-2
OutOfMemo
ryError
Key point: Threads are created outside heap
threads
Solution:
1. Fix thread leak
2. Increase the Thread Limits Set at
Operating System(ulimit –u)
3. Reduce Java Heap Size
4. Kills other processes
5. Increase physical memory size
6. Reduce thread stack size (-Xss).
Note: can cause StackOverflowError
jmap -dump:live,file=<file-path> <pid>
jmap System Property jVisualVM
JMX IBM Administrative Consol Program
1. 2. 3.
4. 5. 6.
7.
How to capture Heap dumps? – 7 options
https://blog.fastthread.io/2016/06/06/how-to-take-thread-dumps-7-options/
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=<file-path>
jcmd <pid> GC.heap_dump <file-path>
Jcmd (since Java 7)
Heap Dump analyzers
• HeapHero.io
• Eclipse MAT
• jHat
Small gift for you!
Beautiful 1 page document on OutOfMemoryErrors:
https://bloggceasy.files.wordpress.com/2015/05/outofmemoryerror2.pdf
Thank you!!
On-site Training – for Developers
QA Engineers, DevOps
ram@tier1app.comhttps://www.linkedin.com/in/ramlakshman
Services Tools
Intelligent Thread dump Analyzer
Universal Garbage Collection log analyzer
Powerful Heap dump Analyzer

More Related Content

What's hot

JDK not so hidden treasures
JDK not so hidden treasuresJDK not so hidden treasures
JDK not so hidden treasures
Andrzej Grzesik
 
JDK, the not so hidden treasures
JDK, the not so hidden treasuresJDK, the not so hidden treasures
JDK, the not so hidden treasures
Andrzej Grzesik
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
Dror Bereznitsky
 
Java memory problem cases solutions
Java memory problem cases solutionsJava memory problem cases solutions
Java memory problem cases solutions
bluedavy lin
 
Accelerating Incident Response To Production Outages
Accelerating Incident Response To Production OutagesAccelerating Incident Response To Production Outages
Accelerating Incident Response To Production Outages
Tier1 app
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
Takahiro YAMADA
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
Dror Bereznitsky
 
Hunting Performance Problems in Node.js and beyond
Hunting Performance Problems in Node.js and beyondHunting Performance Problems in Node.js and beyond
Hunting Performance Problems in Node.js and beyond
Daniel Khan
 
Accelerating molecular dynamics simple tweaks to instant clusters
Accelerating molecular dynamics simple tweaks to instant clustersAccelerating molecular dynamics simple tweaks to instant clusters
Accelerating molecular dynamics simple tweaks to instant clusters
Shahir Shamsir
 

What's hot (9)

JDK not so hidden treasures
JDK not so hidden treasuresJDK not so hidden treasures
JDK not so hidden treasures
 
JDK, the not so hidden treasures
JDK, the not so hidden treasuresJDK, the not so hidden treasures
JDK, the not so hidden treasures
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
 
Java memory problem cases solutions
Java memory problem cases solutionsJava memory problem cases solutions
Java memory problem cases solutions
 
Accelerating Incident Response To Production Outages
Accelerating Incident Response To Production OutagesAccelerating Incident Response To Production Outages
Accelerating Incident Response To Production Outages
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
 
Hunting Performance Problems in Node.js and beyond
Hunting Performance Problems in Node.js and beyondHunting Performance Problems in Node.js and beyond
Hunting Performance Problems in Node.js and beyond
 
Accelerating molecular dynamics simple tweaks to instant clusters
Accelerating molecular dynamics simple tweaks to instant clustersAccelerating molecular dynamics simple tweaks to instant clusters
Accelerating molecular dynamics simple tweaks to instant clusters
 

Similar to Modern Engineer’s Troubleshooting Tools, Techniques & Tricks at Confoo 2018

Shooting the troubles: Crashes, Slowdowns, CPU Spikes
Shooting the troubles: Crashes, Slowdowns, CPU SpikesShooting the troubles: Crashes, Slowdowns, CPU Spikes
Shooting the troubles: Crashes, Slowdowns, CPU Spikes
Tier1 app
 
Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumps
Tier1 App
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
Mohammed Fazuluddin
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumps
Tier1app
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machineelliando dias
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
Tier1 app
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
SAP HANA Cloud Platform
 
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
Haribabu Nandyal Padmanaban
 
jvm goes to big data
jvm goes to big datajvm goes to big data
jvm goes to big data
srisatish ambati
 
Js on-microcontrollers
Js on-microcontrollersJs on-microcontrollers
Js on-microcontrollers
Seo-Young Hwang
 
millions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptx
Tier1 app
 
7 jvm-arguments-v1
7 jvm-arguments-v17 jvm-arguments-v1
7 jvm-arguments-v1
Tier1 app
 
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
 
Inside the JVM
Inside the JVMInside the JVM
Inside the JVM
Jim Jagielski
 
Tips for better CI on Android
Tips for better CI on AndroidTips for better CI on Android
Tips for better CI on Android
Tomoaki Imai
 
Tomcatx troubleshooting-production
Tomcatx troubleshooting-productionTomcatx troubleshooting-production
Tomcatx troubleshooting-productionVladimir Khokhryakov
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination ExtRohit Kelapure
 
OSCON2012TroubleShootJava
OSCON2012TroubleShootJavaOSCON2012TroubleShootJava
OSCON2012TroubleShootJavaWilliam Au
 

Similar to Modern Engineer’s Troubleshooting Tools, Techniques & Tricks at Confoo 2018 (20)

Shooting the troubles: Crashes, Slowdowns, CPU Spikes
Shooting the troubles: Crashes, Slowdowns, CPU SpikesShooting the troubles: Crashes, Slowdowns, CPU Spikes
Shooting the troubles: Crashes, Slowdowns, CPU Spikes
 
Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumps
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumps
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 
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
 
jvm goes to big data
jvm goes to big datajvm goes to big data
jvm goes to big data
 
Js on-microcontrollers
Js on-microcontrollersJs on-microcontrollers
Js on-microcontrollers
 
millions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptx
 
7 jvm-arguments-v1
7 jvm-arguments-v17 jvm-arguments-v1
7 jvm-arguments-v1
 
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...
 
Inside the JVM
Inside the JVMInside the JVM
Inside the JVM
 
Tips for better CI on Android
Tips for better CI on AndroidTips for better CI on Android
Tips for better CI on Android
 
Tomcatx troubleshooting-production
Tomcatx troubleshooting-productionTomcatx troubleshooting-production
Tomcatx troubleshooting-production
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination Ext
 
OSCON2012TroubleShootJava
OSCON2012TroubleShootJavaOSCON2012TroubleShootJava
OSCON2012TroubleShootJava
 

Recently uploaded

Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
Howard Spence
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Matjaž Lipuš
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
Faculty of Medicine And Health Sciences
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
Access Innovations, Inc.
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
IP ServerOne
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
OWASP Beja
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
Vladimir Samoylov
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Orkestra
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 

Recently uploaded (13)

Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 

Modern Engineer’s Troubleshooting Tools, Techniques & Tricks at Confoo 2018

  • 1. Modern Engineer’s troubleshooting tools, techniques & tricks Ram Lakshmanan Architect – GCeasy.io & fastThread.io Confoo - 2018
  • 3. What types of non-functional Problems you have faced?
  • 4. Have you experienced sudden CPU spikes? • This Problem happened in major B2B Travel app
  • 5. jstack -l <pid> > /tmp/threadDump.txt jcmd <pid> Thread.print > /tmp/threadDump.txt Jstack (since Java 5) kill -3 jVisualVM JMC Windows (Ctrl + Break) ThreadMXBean APM Tools Jcmd (since Java 7) 1. 2. 3. 4. 5. 6. 7. 8. How to capture thread dumps? – 8 options https://blog.fastthread.io/2016/06/06/how-to-take-thread-dumps-7-options/
  • 6. 1. Infinite looping while (aCondition()) { doSomething(); } 1 Diagnose sudden CPU spikes? 2
  • 8. Other Patterns • ATHLETE • ATHEROSCLEROSIS • TRAFFIC JAM • ALL ROADS LEAD TO ROME • LEPRECHAUN TRAP • SEVERAL SCAVENGERS • STOCK TICKER • More Patterns - https://blog.fastthread.io/category/thread-dump- patterns/
  • 9. Have you experienced unresponsive DB/NoSQL? • Demo - Real Problem happened in a major Banking application.
  • 11. Thread dump analyzers • fastThread.io • IBM Thread and Monitor Dump Analyzer • Samurai • TDA
  • 12. 2. Consecutive Full GCs 2 Diagnose sudden CPU spikes 1. Infinite looping while (aCondition()) { doSomething(); }
  • 13. 2. Consecutive Full GCs Diagnose sudden CPU spikes 1. Infinite looping while (aCondition()) { doSomething(); }
  • 14. Welcome to the world of Garbage Collection Garbage Collection is automatic. But not free.
  • 15. How to enable Garbage Collection Log? Till Java 8: -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<file-path> From Java 9: -Xlog:gc*:file=<file-path>
  • 16. Demo - healthy application’s GC Log • http://gceasy.io/my-gc- report.jsp?p=c2hhcmVkLzIwMTgvMDMvOC8tLTAuZmlyc3RHQy5sb2cu emlwLS0xOC0xMC00
  • 17. Demo - sick application’s GC Log • http://gceasy.io/diamondgc-report.jsp?oTxnId_value=97fff4aa-b22f- 424e-b112-fab579369ccb
  • 18. How to reduce long GC Pause? • 7 strategies. <<Will be discussed in detail in tomorrow’s 2pm session “Become a Garbage Collection Hero”>> • First & foremost strategy: Reduce memory consumption
  • 19. Welcome to the world of Heap dump analysis
  • 20. Demo - Let’s analyze Heap Dump
  • 22. Types of OutOfMemoryErrors? 1. Java Heap Space 2. GC overhead limit exceeded 3. Requested array size exceeds VM limit 4. Permgen space 5. Metaspace 6. Unable to create new native thread 7. Kill process or sacrifice child 8. Reason stack_trace_with_native_method
  • 23. OutOfMemoryError: Unable to create new native thread? Java Heap Physical memory4 GB (-Xms, -Xmx) 8 GB Java Heap Physical memory4 GB (-Xms, -Xmx) 8 GB Process-1 Process-2 OutOfMemo ryError Key point: Threads are created outside heap threads Solution: 1. Fix thread leak 2. Increase the Thread Limits Set at Operating System(ulimit –u) 3. Reduce Java Heap Size 4. Kills other processes 5. Increase physical memory size 6. Reduce thread stack size (-Xss). Note: can cause StackOverflowError
  • 24. jmap -dump:live,file=<file-path> <pid> jmap System Property jVisualVM JMX IBM Administrative Consol Program 1. 2. 3. 4. 5. 6. 7. How to capture Heap dumps? – 7 options https://blog.fastthread.io/2016/06/06/how-to-take-thread-dumps-7-options/ -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<file-path> jcmd <pid> GC.heap_dump <file-path> Jcmd (since Java 7)
  • 25. Heap Dump analyzers • HeapHero.io • Eclipse MAT • jHat
  • 26. Small gift for you! Beautiful 1 page document on OutOfMemoryErrors: https://bloggceasy.files.wordpress.com/2015/05/outofmemoryerror2.pdf
  • 27. Thank you!! On-site Training – for Developers QA Engineers, DevOps ram@tier1app.comhttps://www.linkedin.com/in/ramlakshman Services Tools Intelligent Thread dump Analyzer Universal Garbage Collection log analyzer Powerful Heap dump Analyzer