SlideShare a Scribd company logo
Java Performance Debugging
Few Questions to Consider
•   What is expected throughput
•   What is expected latency
•   Maximum No. of concurrent users/tasks
•   Expected Throughput/latency at max users
•   Worst case latency
•   Tolerable GC latency
Bottlenecks
•   Memory
•   CPU
•   Disk I/O
•   Network I/O
Memory (RAM)
•   -Xmx too low
•   Process leaking memory (et tu java!)
•   Insufficient DirectBuffers
•   Insufficient PermGen space
•   Page thrashing
Memory (Contd.)
• Run –XX:+HeapDumpOnOutOfMemoryError.
  Check .hprof files in working directory or –
  XX:HeapDumpPath

• jmap –histo<pid>
Memory (contd.)



• High si/so coinciding with low ‘free’ memory
  implies page thrashing
Other OutOfMemory Errors
• Incorrect PermGen size –XXMaxPermSize
  –   java.lang.OutOfMemoryError: PermGen space

  – jstat -gc<pid>
  – Can monitory ‘PU’ vs ‘PGCMX’ from jstat -
    gccapacity
• Incorrect Direct Buffer limit -
  XX:MaxDirectMemorySize
  –   java.lang.OutOfMemoryError: Direct buffer memory
CPU
• Check Garbage collector stats
  – Jstat –gc<pid>
• Investigate using – JMX, TOP
  – Using TOP get the thread ID
  – Thread Dump using ‘kill -3’ or ‘jstack’
  – Search Hex thread id in thread dump
Disk I/O
• Iostat %iowait<interval><samples>

• High %iowait indicates I/O bottleneck

• If java process is causing high I/O, check the
  thread dump
Java Heap Structure
Garbage Collector Choice
• Serial GC (Never use this!)
  – -XX:+UseSerialGC
• Parallel GC (High Throughput) – Use in non-
  interactive jobs which can tolerate pause of 1-
  2 sec
  – -XX:+UseParallelGC –XX:+UseParallelOldGC
• CMS (Low Latency) – Good for webapps and
  interactive processes
  – -XX:+UseConcMarkSweepGC

More Related Content

PPT
Php perf
PDF
Odoo Online platform: architecture and challenges
PDF
java-monitoring-troubleshooting
PDF
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
PDF
XtraDB 5.6 and 5.7: Key Performance Algorithms
PDF
XtraDB 5.7: key performance algorithms
PDF
Postgresql database administration volume 1
PDF
Tsung info
Php perf
Odoo Online platform: architecture and challenges
java-monitoring-troubleshooting
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
XtraDB 5.6 and 5.7: Key Performance Algorithms
XtraDB 5.7: key performance algorithms
Postgresql database administration volume 1
Tsung info

What's hot (20)

PDF
Hypertable Nosql
PPTX
MongoDB Memory Management Demystified
PDF
Odoo Performance Limits
PDF
Managing PostgreSQL with PgCenter
PDF
Make the prompt great again
PDF
Pgcenter overview
PPTX
Nvvp streams-3
ODP
Easy distributed load test with Tsung
PDF
Tsung Intro presentation 2013
PDF
Troubleshooting PostgreSQL with pgCenter
PDF
PostgreSQL na EXT4, XFS, BTRFS a ZFS / FOSDEM PgDay 2016
PDF
ゼロから始めるファミコンエミュレータ生活 PHPerKaigi2019
PDF
My talk from PgConf.Russia 2016
PDF
Troubleshooting PostgreSQL Streaming Replication
PDF
Hello, Worldまで3ヶ月 Golangでファミコンエミュレータ実装 #gocon fukuoka 2019
PDF
Elephant Roads: a tour of Postgres forks
PDF
Introduction to using MongoDB with Ruby
PDF
Go performance tooling
PDF
Patroni - HA PostgreSQL made easy
TXT
Hypertable Nosql
MongoDB Memory Management Demystified
Odoo Performance Limits
Managing PostgreSQL with PgCenter
Make the prompt great again
Pgcenter overview
Nvvp streams-3
Easy distributed load test with Tsung
Tsung Intro presentation 2013
Troubleshooting PostgreSQL with pgCenter
PostgreSQL na EXT4, XFS, BTRFS a ZFS / FOSDEM PgDay 2016
ゼロから始めるファミコンエミュレータ生活 PHPerKaigi2019
My talk from PgConf.Russia 2016
Troubleshooting PostgreSQL Streaming Replication
Hello, Worldまで3ヶ月 Golangでファミコンエミュレータ実装 #gocon fukuoka 2019
Elephant Roads: a tour of Postgres forks
Introduction to using MongoDB with Ruby
Go performance tooling
Patroni - HA PostgreSQL made easy
Ad

Viewers also liked (20)

PDF
Creating High Performance Big Data Applications with the Java Persistence API
PPT
Optimizing Java Performance
PDF
High Performance With Java
PDF
Performance van Java 8 en verder - Jeroen Borgers
PDF
High Performance Web Design
PDF
Java Performance
PDF
Java Performance & Profiling
PDF
WSO2 Identity Server
PPTX
Microservices for performance - GOTO Chicago 2016
PPT
Java Performance, Threading and Concurrent Data Structures
PPTX
High performance java ee with j cache and cdi
PDF
SSO with the WSO2 Identity Server
PPT
Practical Steps For Building High Performance Teams
PDF
High-performance Team Development
PPT
Leading High Performance Teams
PPTX
WSO2 Identity Server 5.3.0 - Product Release Webinar
PDF
High Performance Java EE with JCache and CDI
PPTX
SAML Smackdown
PPTX
High Performance Flow Matching Architecture for Openflow Data Plane
PDF
SAML Protocol Overview
Creating High Performance Big Data Applications with the Java Persistence API
Optimizing Java Performance
High Performance With Java
Performance van Java 8 en verder - Jeroen Borgers
High Performance Web Design
Java Performance
Java Performance & Profiling
WSO2 Identity Server
Microservices for performance - GOTO Chicago 2016
Java Performance, Threading and Concurrent Data Structures
High performance java ee with j cache and cdi
SSO with the WSO2 Identity Server
Practical Steps For Building High Performance Teams
High-performance Team Development
Leading High Performance Teams
WSO2 Identity Server 5.3.0 - Product Release Webinar
High Performance Java EE with JCache and CDI
SAML Smackdown
High Performance Flow Matching Architecture for Openflow Data Plane
SAML Protocol Overview
Ad

Similar to Java performance (20)

PPT
ApacheCon2010: Cache & Concurrency Considerations in Cassandra (& limits of JVM)
PPT
jvm goes to big data
PDF
(Fios#02) 2. elk 포렌식 분석
PDF
Performance
PPTX
Considerations when deploying Java on Kubernetes
PDF
Mastering java in containers - MadridJUG
PPT
Heap & thread dump
PPTX
Java 어플리케이션 성능튜닝 Part1
PDF
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
ODP
Shootout at the PAAS Corral
PDF
OSCON2012TroubleShootJava
PPTX
Modern Engineer’s Troubleshooting Tools, Techniques & Tricks at Confoo 2018
PPTX
Multithreading Fundamentals
PPTX
#GeodeSummit - Off-Heap Storage Current and Future Design
PDF
Bringing Concurrency to Ruby - RubyConf India 2014
PPTX
Hadoop World 2011: Hadoop Troubleshooting 101 - Kate Ting - Cloudera
PDF
Presto At Treasure Data
PDF
Flink Forward Berlin 2017: Robert Metzger - Keep it going - How to reliably a...
PPTX
Tuning Elasticsearch Indexing Pipeline for Logs
PDF
Caching your rails application
ApacheCon2010: Cache & Concurrency Considerations in Cassandra (& limits of JVM)
jvm goes to big data
(Fios#02) 2. elk 포렌식 분석
Performance
Considerations when deploying Java on Kubernetes
Mastering java in containers - MadridJUG
Heap & thread dump
Java 어플리케이션 성능튜닝 Part1
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
Shootout at the PAAS Corral
OSCON2012TroubleShootJava
Modern Engineer’s Troubleshooting Tools, Techniques & Tricks at Confoo 2018
Multithreading Fundamentals
#GeodeSummit - Off-Heap Storage Current and Future Design
Bringing Concurrency to Ruby - RubyConf India 2014
Hadoop World 2011: Hadoop Troubleshooting 101 - Kate Ting - Cloudera
Presto At Treasure Data
Flink Forward Berlin 2017: Robert Metzger - Keep it going - How to reliably a...
Tuning Elasticsearch Indexing Pipeline for Logs
Caching your rails application

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation theory and applications.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation theory and applications.pdf
Programs and apps: productivity, graphics, security and other tools
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf

Java performance

  • 2. Few Questions to Consider • What is expected throughput • What is expected latency • Maximum No. of concurrent users/tasks • Expected Throughput/latency at max users • Worst case latency • Tolerable GC latency
  • 3. Bottlenecks • Memory • CPU • Disk I/O • Network I/O
  • 4. Memory (RAM) • -Xmx too low • Process leaking memory (et tu java!) • Insufficient DirectBuffers • Insufficient PermGen space • Page thrashing
  • 5. Memory (Contd.) • Run –XX:+HeapDumpOnOutOfMemoryError. Check .hprof files in working directory or – XX:HeapDumpPath • jmap –histo<pid>
  • 6. Memory (contd.) • High si/so coinciding with low ‘free’ memory implies page thrashing
  • 7. Other OutOfMemory Errors • Incorrect PermGen size –XXMaxPermSize – java.lang.OutOfMemoryError: PermGen space – jstat -gc<pid> – Can monitory ‘PU’ vs ‘PGCMX’ from jstat - gccapacity • Incorrect Direct Buffer limit - XX:MaxDirectMemorySize – java.lang.OutOfMemoryError: Direct buffer memory
  • 8. CPU • Check Garbage collector stats – Jstat –gc<pid> • Investigate using – JMX, TOP – Using TOP get the thread ID – Thread Dump using ‘kill -3’ or ‘jstack’ – Search Hex thread id in thread dump
  • 9. Disk I/O • Iostat %iowait<interval><samples> • High %iowait indicates I/O bottleneck • If java process is causing high I/O, check the thread dump
  • 11. Garbage Collector Choice • Serial GC (Never use this!) – -XX:+UseSerialGC • Parallel GC (High Throughput) – Use in non- interactive jobs which can tolerate pause of 1- 2 sec – -XX:+UseParallelGC –XX:+UseParallelOldGC • CMS (Low Latency) – Good for webapps and interactive processes – -XX:+UseConcMarkSweepGC