How to Diagnose Java Applications on Rainbond with Arthas: A Step‑by‑Step Guide
This guide explains how to integrate the Arthas Java diagnostic tool with the Rainbond cloud‑native platform, covering plugin installation, tunnel setup, Web Console access, environment configuration, command usage, and flame‑graph generation for effective Java application troubleshooting.
Arthas is an online monitoring and diagnosis tool that provides a global view of application load, memory, GC, thread status, and allows diagnosing business issues without modifying code, such as inspecting method arguments, exceptions, execution time, and class loading information.
Arthas offers an interactive command line with Tab auto‑completion and a Web Console for users without server access.
Arthas Integration on Rainbond
1. Plugin Integration Install the Arthas plugin from the Rainbond open‑source app store; the component automatically downloads
arthas-agent.jarand starts with the
javaagentoption.
2. Arthas Tunnel Integration For many microservices, use Arthas Tunnel Server/Client to manage multiple agents remotely. The agent registers to the tunnel via WebSocket, and the tunnel can be installed from the Rainbond app store.
3. Arthas Web Console For Spring Boot applications, expose port 8563 in the component to access the Web Console directly.
Diagnosing a Spring Boot Application on Rainbond
Deploy the Ruoyi SpringBoot example via the Rainbond app store, then install and enable the Arthas‑Agent plugin for the
ruoyi-admincomponent. Configure environment variables:
JAVA_OPTS = -javaagent:/arthas/arthas-agent.jar
ARTHAS_APP_NAME = ruoyi-admin
ARTHAS_AGENT_ID = ruoyi-admin
Add port 8563 and expose it to access the Web Console.
Diagnosing a Spring Cloud Application on Rainbond
Deploy the SpringCloud‑Pig example, install the Arthas‑Tunnel component, and enable the Arthas‑Agent plugin for each microservice. Set the same environment variables (JAVA_OPTS, ARTHAS_APP_NAME, ARTHAS_AGENT_ID) and link all services to the tunnel.
Use the tunnel’s 8080 domain to reach the Web Console, then specify the tunnel’s 7777 port and the target agent ID to connect.
Getting Started with Arthas Commands
Arthas provides commands such as
dashboard,
getstatic,
heapdump,
jvm,
logger,
mbean,
memory,
ognl,
perfcounter,
sysenv,
sysprop,
thread,
vmoption, and
vmtool. Detailed documentation is available online.
Generating Flame Graphs
Use the
profilercommand to sample CPU usage and produce a flame graph. Example:
<code>$ profiler start
Started [cpu] profiling
</code>Stop profiling and export the result:
<code>$ profiler stop --format html
OK
profiler output file: /app/arthas-output/20220907-214802.html
</code>Open the generated HTML file via the component’s exposed port (e.g.,
http://domain/arthas-output) to view the flame graph.
Conclusion
Arthas is a powerful Java diagnostic tool. Rainbond abstracts Kubernetes complexities and, through its plugin mechanism, simplifies Arthas deployment and usage, allowing users to focus on business logic rather than low‑level Kubernetes operations.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
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.