Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 21, 2026·3 min de lectura

Alibaba Arthas — Java Application Diagnostic Tool

A guide to Arthas, the open-source Java diagnostic tool that lets you troubleshoot production issues in real time without restarting or modifying code.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 64/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Community
Entrada
Arthas Guide
Comando con revisión previa
npx -y tokrepo@latest install ade75a56-3d7c-11f1-9bc6-00163e2b0d79 --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

Introduction

Arthas is an open-source Java diagnostic tool developed by Alibaba. It allows developers to troubleshoot production JVM applications in real time — inspecting class loading, decompiling code, tracing method calls, and profiling performance — all without restarting the application or adding logging.

What Arthas Does

  • Attaches to any running JVM process and opens an interactive diagnostic shell
  • Decompiles loaded classes on the fly to verify deployed code matches expectations
  • Traces method invocations with timing, arguments, return values, and exceptions
  • Monitors JVM metrics including threads, memory, GC, and CPU in a live dashboard
  • Allows hot-swapping of class bytecode for emergency production fixes

Architecture Overview

Arthas uses a Java Agent that attaches to the target JVM via the Attach API. Once connected, it instruments bytecode using ASM to intercept method calls without modifying source. The agent runs a Netty-based server that accepts commands from the Arthas CLI client or a web console, executes them in the target JVM context, and returns results over the tunnel.

Self-Hosting & Configuration

  • Download arthas-boot.jar or install via package managers (brew, sdkman)
  • Run java -jar arthas-boot.jar to list JVM processes and select one to attach
  • Access the web console at http://localhost:3658 for browser-based diagnostics
  • Configure tunnel server for remote diagnosis of distributed applications
  • Integrate with Spring Boot Starter for embedded diagnostic endpoints

Key Features

  • Zero-intrusion diagnostics: no code changes, restarts, or additional JVM flags needed
  • Real-time class decompilation to verify what bytecode is actually running
  • OGNL expression support for evaluating arbitrary expressions in the target JVM
  • Flame graph profiling via async-profiler integration for CPU and allocation analysis
  • Web console and HTTP API for remote troubleshooting across environments

Comparison with Similar Tools

  • JVisualVM — GUI-based JVM monitor; Arthas provides CLI-first deep diagnostics without requiring a display server
  • JProfiler — Commercial profiler with rich UI; Arthas is free, lighter, and designed for production attachment
  • BTrace — Bytecode tracing tool; Arthas offers a more user-friendly command interface and broader feature set
  • async-profiler — CPU/allocation profiler; Arthas wraps it and adds method tracing, class inspection, and OGNL evaluation
  • jcmd/jstack — JDK built-in tools; Arthas provides an interactive shell combining all their capabilities plus method-level tracing

FAQ

Q: Is it safe to attach Arthas to a production JVM? A: Yes. Arthas instruments only the methods you explicitly target, and the overhead is negligible for typical diagnostic commands. Detach when done to remove all instrumentation.

Q: Does Arthas work with GraalVM native images? A: Arthas requires a standard HotSpot or OpenJ9 JVM with the Attach API. GraalVM native images do not support dynamic agent attachment.

Q: Can I use Arthas in containers? A: Yes. Mount arthas-boot.jar into the container or include it in the image. Use the tunnel server for Kubernetes pods that lack direct shell access.

Q: What Java versions does Arthas support? A: Arthas supports Java 6 through Java 21+, covering both LTS and recent non-LTS releases.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados