Diagnosing Java Runtime Problems: CPU, Memory, Disk, and Network Tips
This guide walks through systematic troubleshooting of Java runtime issues—including CPU spikes, frequent garbage collection, memory leaks, disk bottlenecks, and network anomalies—by using Linux tools such as top, jstack, jstat, iostat, vmstat, and netstat, with concrete command examples and analysis steps.
Network Troubleshooting
Distinguish connection timeout ( connectionTimeout) from read/write timeout ( readTimeout / writeTimeout). Keep client‑side timeouts shorter than server limits.
TCP Queue Overflow
Monitor SYN and accept queues:
netstat -s | egrep "listen|LISTEN" ss -lnt“overflowed” counts full accept queues; “sockets dropped” counts SYN‑queue overflow.
RST Packets
RST indicates abrupt termination. Common causes:
Port not listening – server returns RST immediately.
Application aborts – explicit close() replaced by RST via SO_LINGER.
Stale packets arriving after the connection has been closed.
Capture RST traffic:
tcpdump -i <iface> tcp -w capture.capTIME_WAIT and CLOSE_WAIT
Count socket states:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' ss -ant | awk '{++S[$1]} END {for(a in S) print a, S[a]}'Mitigate excessive TIME_WAIT with kernel parameters:
net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1Reduce tcp_max_tw_buckets to limit total sockets. High CLOSE_WAIT usually means an application thread is stuck after receiving FIN; use jstack to locate the blocked I/O calls.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
