Troubleshooting Production Issues with Alibaba’s Arthas

What Arthas all Features

  • Check whether the class is loaded
  • Decompile classes to ensure the code is working as expected
  • View class loader statistics and the method invocation information (including the relevant parameters, return object, and thrown exceptions)
  • Check the stack trace of specified method invocation
  • Trace the method invocation to track slow invocation
  • Monitor the method invocation statistics (such as the queries per second, response time, and success rate)
  • Monitor items such as system metrics, thread states, CPU usage, and garbage-collection statistics
  • Support telnet and the web socket for both local and remote debugging using a command line and browser interface
  • Support Javaa Development Kit 6+
  • Support Linux, MacOS, and Windows

Installing and Running Arthas

  • Run: java -jar arthas-boot.jar
  • Getting Help: java -jar arthas-boot.jar –h

Using Arthas and Arthas Commands

  • --target-ip: In case the targeted Java Virtual Machine is located at a specific IP address over the network, then the default is (which is the localhost).
  • --telnet-port: The targeted Java Virtual Machine listen telnet port. The default port is 3658.
  • --http-port: The targeted Java Virtual Machine listen HTTP port. The default port is 8563.
  • --use-version: This uses a special Arthas version
  • --use-http: This enforces use of HTTP for downloading items. By default, HTTPS is used.
  • --verbose: This is used to make the code more verbose so to print more debug information.

Using the Terminal Console

$ help
help Display Arthas Help
keymap Display all the available keymap for the specified connection.
sc Search all the classes loaded by JVM
sm Search the method of classes loaded by JVM
classloader Show classloader info
jad Decompile class
getstatic Show the static field of a class
monitor Monitor method execution statistics, e.g. total/success/failure count, average rt, fail rate, etc.
stack Display the stack trace for the specified class and method
thread Display thread info, thread stack
trace Trace the execution time of specified method invocation.
watch Display the input/output parameter, return object, and thrown exception of specified method invocation
tt Time Tunnel
jvm Display the target JVM information
ognl Execute ognl expression.
mc Memory compiler, compiles java files into bytecode and class files in memory.
redefine Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)
dashboard Overview of target jvm's thread, memory, gc, vm, tomcat info.
dump Dump class byte array from JVM
options View and change various Arthas options
cls Clear the screen
reset Reset all the enhanced classes
version Display Arthas version
shutdown Shutdown Arthas server and exit the console
session Display current session information
sysprop Display, and change the system properties.
sysenv Display the system env.
history Display command history
cat Concatenate and print files
pwd Return working directory name

Some Additional Examples

- sm java.lang.String
- sm -d java.lang.String toString
watch*Controller * '{params, returnObj, throwExp}'
  • *Controller matches with such things as the UserController, BillingController, AuthController, IndexController, so on.
  • The watch command supports the -e option, which means that only requests that throw an exception are detected.

Arthas Web Console


Original Source




Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS371g Summer 2021: Kyzer Polzin

Python3: Mutable, Immutable… everything is an object!

Using the Unity Animation System

When and why would you want to utilize URL encoding?

Why Documentation is the Next Big Thing

Git in control of your code — Part 1

Find area of container with most water in O(n) time and O(1) space

Semaphores in Swift

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:

More from Medium

How to deploy Scalar DB Server on Kubernetes

Virus scan MinIO buckets using ClamAV, Fission and Kafka

Getting started with Prometheus Federation in Docker

Service Mesh, Istio and Why Do We Need It