Essential Linux and JVM Tools for Troubleshooting and Performance Analysis
This article compiles a comprehensive set of Linux commands, JVM utilities, and Java debugging tools—including tail, grep, awk, find, tsar, btrace, greys, JProfiler, jps, jstack, jmap, jstat, and IntelliJ plugins—to help engineers quickly diagnose, monitor, and resolve production issues while optimizing performance.
The author shares a personal notebook of frequently used Linux and Java troubleshooting tools, aiming to help readers quickly locate useful commands and utilities for daily problem solving.
Linux command snippets include common patterns such as tail -300f shopbase.log for real‑time log tailing, various grep usages for file and directory searches, multiple awk one‑liners for field extraction and record counting, and powerful find examples for locating files by name, type, size, permissions, and timestamps. A custom pgm command demonstrates batch log queries, while tsar (the company’s own metrics collector) shows how to view recent, live, or historical system metrics.
Advanced troubleshooting utilities are introduced next. btrace is highlighted as a production‑grade bytecode‑injection tool for tracing method calls (e.g., monitoring ArrayList.add when the list size exceeds 500) and printing stack traces. greys offers similar capabilities such as class detail inspection ( sc -df xxx) and method‑level timing ( trace class method). The article also mentions javOSize for on‑the‑fly class bytecode modification, JProfiler, eclipse MAT, zprofiler, and CHLSDB for heap analysis.
JVM command toolbox covers the classic jps one‑liner ( sudo -u admin /opt/taobao/java/bin/jps -mlvV), jstack (both normal and native stacks), jinfo for JVM flags, jmap for heap snapshots and histograms, jstat for GC utilization ( jstat -gcutil 2815 1000), and jdb for remote debugging ( sudo -u admin /opt/taobao/java/bin/jdb -attach 8000). The CHLSDB command line is also shown.
VM options and class‑loader diagnostics include enabling class‑loading traces ( -XX:+TraceClassLoading), automatic heap dumps on OOM (
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/admin/logs/java.hprof), and using greys:sc or the Alibaba‑provided HTTP endpoints to locate the origin JAR of a class.
Jar‑conflict resolution is addressed with Maven dependency tree commands ( mvn dependency:tree, mvn dependency:tree -Dverbose -Dincludes=groupId:artifactId) and class‑loader inspection utilities.
IntelliJ IDEA plugins such as Key Promoter (helps memorize shortcuts) and Maven Helper (visualizes dependency graphs) are recommended.
Additional useful tools include gpref (referenced article), dmesg for kernel OOM‑killer logs, and a formula for converting dmesg timestamps to real dates.
Finally, the article points to a Guava RateLimiter example for precise QPS control, linking to an external tutorial.
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.
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.
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.
