origin
Recently I saw a very popular title, "open source XX years, star XXX, how I insist."
See this title, suddenly found Arthas since open source in September 2018, just a year, just in the autumn season do the next summary and review.
Arthas
Alibaba is open-source Java diagnostic tools by developers alike.
- Github: github.com/alibaba/art…
- Documentation: alibaba.github.io/arthas
Recalling Arthas number Star history, it has maintained rapid growth, has been a breakthrough 16K.
Thanks to the support of users, not only pressure but also motivation. In the past year, open source, Arthas released a version of Release 7, we have been insisting three points?:
- Continually improve usability
- Easy to use command continues to increase
- Gain strength from the open source community, back to the community
Continually improve usability
Arthas has been the ease of use in the first place, after open source, we made the following improvements:
- Development arthas boot, support for Windows / Linux / Mac unified experience
- Silky completion, reference jshell experience
- Efficient history matching command,
Up/Down
direct - Improved category search matching functionality, better support for lambda and inner classes
- Perfect redirect mechanism
- Support JDK 9/10/11
- Support Docker
- Support rpm / deb packages installed
Although we ease under a lot of effort, but found that many times the user entry more difficult, therefore, we refer to k8s of Interactive Tutorial, launched an online tutorial of Arthas:
By basic tutorial, you can step entry in the interactive terminal where you can deep understanding of the case Arthas troubleshooting through advanced course.
In addition, for the convenience of users large-scale deployment, we realized the tunnel server and user data Reporting:
- Increase tunnel server, unified management Agent Connectivity
- Increase user data return function, easy to do security management and control
Easy to use command continues to increase
Arthas known diagnostic tool is a Java application, so we have to be worthy of the slogan. After the open-source, Arthas continued to increase more than 10 commands.
- ognl command arbitrary code execution
- mc line memory compilers
- redefine the command line heat update code
- a key logger command to view the application in all logger configuration
- sysprop View Update System Properties
- sysenv viewing environment variable
- vmoption view the updated VM option
- View logger logger configuration, update level
- JMX information mbean View
- heapdump heap memory snapshots
The following highlights the two functions.
jad / mc / redefine the code train hot update line
To Arthas online tutorials in the UserController
example:
-
Use jad to decompile the code
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java 复制代码
-
Use vim compiled code
When the user id is less than 1, it returns to normal, nothrow:
@GetMapping("/user/{id}") public User findUserById(@PathVariable Integer id) { logger.info("id: {}" , id); if (id != null && id < 1) { return new User(id, "name" + id); // throw new IllegalArgumentException("id < 1"); } else { return new User(id, "name" + id); } } 复制代码
-
Use
mc
command to compile the modifiedUserController.java
$ mc /tmp/UserController.java -d /tmp Memory compiler output: /tmp/com/example/demo/arthas/user/UserController.class Affect(row-cnt:1) cost in 346 ms 复制代码
-
Use
redefine
the command, because the heat can update code$ redefine /tmp/com/example/demo/arthas/user/UserController.class redefine success, size: 1 复制代码
By the logger command to view the configuration, modify level
Website stressful times (such as double 11), there is a mitigation measure is to modify the application log level ERROR. So there are two problems:
- Logging system may have multiple complex applications, which then logs the system configuration takes effect?
- How online level dynamically modify the logger?
By logger
command, you can view detailed configuration information in the logger applications, such as FileAppender
file output, AsyncAppender
whether blocking
.
[arthas@2062]$ logger
name ROOT
class ch.qos.logback.classic.Logger
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
classLoaderHash 2a139a55
level INFO
effectiveLevel INFO
additivity true
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
appenders name CONSOLE
class ch.qos.logback.core.ConsoleAppender
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
classLoaderHash 2a139a55
target System.out
name APPLICATION
class ch.qos.logback.core.rolling.RollingFileAppender
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
classLoaderHash 2a139a55
file app.log
name ASYNC
class ch.qos.logback.classic.AsyncAppender
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
classLoaderHash 2a139a55
blocking false
appenderRef [APPLICATION]
复制代码
You can also modify the line level logger:
[arthas@2062]$ logger --name ROOT --level debug
update logger level success.
复制代码
Gain strength from the open source community, back to the community
Thanks to 67 Contributors
Since Arthas open source, a total of 67 Contributors, thanks improve their contributions:
Community submitted a series of improvements, some of the points listed below (not complete):
- Most of the English translation of the document
- trace command supports line numbers
- Packaging format support rpm / deb
- Improved command-line prompt is
arthas@pid
- Improved support for the windows
- Increase
mbean
command - Improved webconsole experience
In addition, there are 83 companies / organizations to register their use of information, more users are welcome to register:
洐 Health Project
Based on Arthas, also produced a number of Xing student program, here are two of them:
- Bistoury: Where CAPE source projects integrated Arthas
- arthas-mvel: Use a fork MVEL script
User Case Studies
The majority of users in the use of Arthas troubleshooting process, share a lot of the investigation process and experience are welcome to share.
Open source feedback
Arthas itself uses a lot of code open source projects, open source process, we give netty, ognl, cfr and so contributed to improve the code back upstream.
postscript
In doing Arthas brochures, Arthas slogan is:
"Roses hand, durable fragrance even worse."
Arthas future hope to be able to help more users to solve problems, but also hope that the majority of the developers made more improvements and suggestions on Arthas.
Finally, lucky draw, you can forward posts, comments, stories and Arthas's own background in public numbers, or make a suggestion to Arthas, Arthas prize is a sweater?:
No public
Welcome to Watch column horizontal cloud break Ridge, focus on Java, Spring Boot, Arthas, Dubbo.