Troubleshooting Production Issues with Alibaba’s Arthas

What Arthas all Features

Let’s look at some of the major, key features of the current version of Arthas, which as of writing this article is version 3.1.1. Arthas can do the following:

  • 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

Arthas can be run on most of the major operating systems, including Linux, MacOS, and Windows. You’ll just need to make sure that Java Virtual Machine 6 or later is installed on your system before you begin to set up Arthas. Generally speaking, Arthas consists of a single runnable Jar file, which is named arthas-boot, which is Arthas’s runner.

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

Using Arthas and Arthas Commands

From the Arthas help command (-h), we can see there are plenty of options possible to address or enable some specific features of the diagnostic tool. Here are some interesting ones that may be often used:

  • --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

After Arthas is up and running, you can click Enter to jump into Arthas. Next, you can use the command line interface associated with Arthas to enter some additional commands into your Arthas server. Here, in the examples I give in this article, it’s the local machine so as a result I’m not going to specify --target-ip.

$ 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

You can also use the following commands:

- 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

One of the most popular ways for interacting with Arthas is through the terminal command as what we’ve been doing through this article. However, another way to interact with Arthas, of course, is by using its Web Console in your browser window.


In this article, you have got to leanr more about Arthas as well as how you can install and start up Arthas. You also learned how you can running some commands to diagnose our JVM threads through Arthas’s command line interface.

Original Source



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: