Operations 18 min read

Comprehensive Guide to Java Online Fault Diagnosis: CPU, Memory, Disk, GC, and Network Troubleshooting

This guide details a systematic approach to diagnosing Java service failures by sequentially checking CPU, disk, memory, and network issues, using tools like ps, top, jstack, jstat, iostat, jmap, and netstat to pinpoint root causes and apply appropriate fixes.

Java Captain
Java Captain
Java Captain
Comprehensive Guide to Java Online Fault Diagnosis: CPU, Memory, Disk, GC, and Network Troubleshooting

Online fault diagnosis for Java services typically involves checking CPU, disk, memory, and network issues in sequence.

CPU problems are identified using ps, top -H -p PID, converting thread IDs to hex, and analyzing stack traces with jstack to locate high‑CPU threads.

Frequent GC can be monitored with jstat -gc PID and GC logs; adjust heap sizes or GC parameters as needed.

Disk issues are examined using df -hl, iostat -d -k -x, and iotop to find heavy I/O processes, then tracing file descriptors via readlink and cat /proc/PID/io.

Memory analysis covers heap OOM, Metaspace OOM, and stack overflow, using jmap -histo:live PID, enabling -XX:+HeapDumpOnOutOfMemoryError, and analyzing dumps with MAT or jcmd native memory tracking.

Off‑heap memory leaks are tracked with pmap -x PID, gdb dumps, and NMT via -XX:NativeMemoryTracking=summary.

Network problems such as timeouts, TCP queue overflow, RST packets, TIME_WAIT and CLOSE_WAIT states are diagnosed with netstat, ss, tcpdump, and kernel parameters like net.ipv4.tcp_tw_reuse and net.ipv4.tcp_tw_recycle.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javaperformancenetworktroubleshootingCPUMemorygc
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.