|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
|
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
<title>Arthas3.0的新特性 — Arthas 3.0.6-SNAPSHOT 文档</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="_static/favicon.ico"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
|
<link rel="stylesheet" href="_static/overrides.css" type="text/css" />
|
|
|
<link rel="index" title="索引" href="genindex.html" />
|
|
|
<link rel="search" title="搜索" href="search.html" />
|
|
|
<script src="_static/center_page.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="_static/js/modernizr.min.js"></script>
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body class="wy-body-for-nav">
|
|
|
|
|
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
|
<div class="wy-side-scroll">
|
|
|
<div class="wy-side-nav-search">
|
|
|
|
|
|
|
|
|
|
|
|
<a href="index.html" class="icon icon-home"> Arthas
|
|
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="version">
|
|
|
3.0.6-SNAPSHOT
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="search">
|
|
|
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
|
<input type="hidden" name="area" value="default" />
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://alibaba.github.io/arthas/en/">English Docs</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">安装</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">快速入门</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">进阶使用</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="commands.html">命令列表</a></li>
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">用户案例</a></li>
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md">参与贡献</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release Notes</a></li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="contact-us.html">QQ群/钉钉群</a></li>
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
</nav>
|
|
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
|
|
|
<nav class="wy-nav-top" aria-label="top navigation">
|
|
|
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
|
<a href="index.html">Arthas</a>
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
|
|
|
|
<div class="rst-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
|
|
|
|
<ul class="wy-breadcrumbs">
|
|
|
|
|
|
<li><a href="index.html">Docs</a> »</li>
|
|
|
|
|
|
<li>Arthas3.0的新特性</li>
|
|
|
|
|
|
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/arthas3.md" class="fa fa-github"> Edit on GitHub</a>
|
|
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
<hr/>
|
|
|
</div>
|
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
|
<div itemprop="articleBody">
|
|
|
|
|
|
<div class="section" id="arthas3-0">
|
|
|
<span id="arthas3-0"></span><h1>Arthas3.0的新特性<a class="headerlink" href="#arthas3-0" title="永久链接至标题">¶</a></h1>
|
|
|
<div class="section" id="">
|
|
|
<span id="id1"></span><h2>在线诊断功能<a class="headerlink" href="#" title="永久链接至标题">¶</a></h2>
|
|
|
<p>Arthas3.0中最重要的特性,不需要登陆机器就可以对应用进行诊断,体验和本地诊断完全一致</p>
|
|
|
<div class="section" id="">
|
|
|
<span id="id2"></span><h3>使用步骤<a class="headerlink" href="#" title="永久链接至标题">¶</a></h3>
|
|
|
<p>TODO</p>
|
|
|
</div>
|
|
|
<div class="section" id="">
|
|
|
<span id="id3"></span><h3>动图演示<a class="headerlink" href="#" title="永久链接至标题">¶</a></h3>
|
|
|
<p>TODO</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="">
|
|
|
<span id="id4"></span><h2>管道支持<a class="headerlink" href="#" title="永久链接至标题">¶</a></h2>
|
|
|
<p>Arthas 3.0开始支持管道, 率先提供了<code class="docutils literal notranslate"><span class="pre">grep</span></code>,<code class="docutils literal notranslate"><span class="pre">wc</span></code>,<code class="docutils literal notranslate"><span class="pre">plaintext</span></code>的支持。</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="groovy">
|
|
|
<span id="groovy"></span><h1>去groovy依赖<a class="headerlink" href="#groovy" title="永久链接至标题">¶</a></h1>
|
|
|
<p>groovy表达式在arthas2.0中大量使用,例如watch表达式</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add <span class="s2">"params + ' ' + returnObj"</span> params.size<span class="o">()==</span><span class="m">2</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>其中<code class="docutils literal notranslate"><span class="pre">"params</span> <span class="pre">+</span> <span class="pre">'</span> <span class="pre">'</span> <span class="pre">+</span> <span class="pre">returnObj"</span></code>以及<code class="docutils literal notranslate"><span class="pre">params.size()==2</span></code>背后其实都使用了groovy来进行表达式求值,如果反复大量的运行这些表达式,groovy会创建大量的classloader,打满perm区从而触发FGC。</p>
|
|
|
<p>为了避免这个问题,Arthas 3.0中使用了ognl这个更加轻量的表达式求值库来代替groovy,彻底解决了groovy引起的FGC风险。但由于这个替换,导致原来使用groovy脚本编写的自定义脚本失效。这个问题留待后续解决。</p>
|
|
|
<p>在3.0中,watch命令的表达式部分的书写有了一些改变,详见<a class="reference external" href="https://alibaba.github.io/arthas/watch">这里</a></p>
|
|
|
<div class="section" id="rt">
|
|
|
<span id="rt"></span><h2>提升rt统计精度<a class="headerlink" href="#rt" title="永久链接至标题">¶</a></h2>
|
|
|
<p>Arthas 2.0中,统计rt都是以<code class="docutils literal notranslate"><span class="pre">ms</span></code>为单位,对于某些比较小的方法调用,耗时在毫秒以下的都会被认为是0ms,造成trace总时间和各方法的时间相加不一致等问题(虽然这里面确实会有误差,主要Arthas自身的开销)。Arthas 3.0中所有rt的单位统一改为使用<code class="docutils literal notranslate"><span class="pre">ns</span></code>来统计,精准捕获你的方法耗时,让0ms这样无意义的统计数据不再出现!</p>
|
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ tt -l
|
|
|
INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
1000 2017-02-24 10:56:46 808.743525 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
1001 2017-02-24 10:56:55 805.799155 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
1002 2017-02-24 10:57:04 808.026935 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
1003 2017-02-24 10:57:22 805.036963 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
1004 2017-02-24 10:57:24 803.581886 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
1005 2017-02-24 10:57:39 814.657657 true false 0x3bd5e918 TestTraceServlet doGet
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="watch-stack-trace">
|
|
|
<span id="watch-stack-trace"></span><h2>watch/stack/trace命令支持按耗时过滤<a class="headerlink" href="#watch-stack-trace" title="永久链接至标题">¶</a></h2>
|
|
|
<p>我们在trace的时候,经常会出现某个方法间隙性的rt飙高,但是我们只想知道rt高的时候,是哪里慢了,对于正常rt的方法我们并不关心,Arthas 3.0支持了按<code class="docutils literal notranslate"><span class="pre">#cost</span></code>(方法执行耗时,单位为<code class="docutils literal notranslate"><span class="pre">ms</span></code>)进行过滤,只输出符合条件的trace路径,目前,这三个命令的相关文档已经做了更新,增加了该用法的示例。</p>
|
|
|
</div>
|
|
|
<div class="section" id="syspropsystemproperty">
|
|
|
<span id="syspropsystemproperty"></span><h2>sysprop命令操作SystemProperty<a class="headerlink" href="#syspropsystemproperty" title="永久链接至标题">¶</a></h2>
|
|
|
<p>sysprop命令支持查看所有的系统属性,以及针对特定属性进行查看和修改。</p>
|
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sysprop
|
|
|
...
|
|
|
os.arch x86_64
|
|
|
java.ext.dirs /Users/wangtao/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.
|
|
|
8.0_51.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library
|
|
|
/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
|
|
|
user.dir /Users/wangtao/work/ali-tomcat-home/ant-develop/output/build
|
|
|
catalina.vendor alibaba
|
|
|
line.separator
|
|
|
|
|
|
java.vm.name Java HotSpot(TM) 64-Bit Server VM
|
|
|
file.encoding UTF-8
|
|
|
org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUA true
|
|
|
LS_IN_VALUE
|
|
|
com.taobao.tomcat.info Apache Tomcat/7.0.70.1548
|
|
|
java.specification.version 1.8
|
|
|
$ sysprop java.version
|
|
|
java.version=1.8.0_51
|
|
|
$ sysprop production.mode true
|
|
|
Successfully changed the system property.
|
|
|
production.mode=true
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="thread">
|
|
|
<span id="thread"></span><h2>thread命令支持指定采样时间<a class="headerlink" href="#thread" title="永久链接至标题">¶</a></h2>
|
|
|
<p>thread命令计算线程cpu占用的逻辑,默认是采样100ms内各个线程的cpu使用情况并计算cpu消耗占比。有时候100ms的时间间隔太短,看不出问题所在,Arthas3.0中thread命令支持设置采样间隔(以<code class="docutils literal notranslate"><span class="pre">ms</span></code>为单位),可以观察任意时间段内的cpu消耗占比情况。</p>
|
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ thread -i 1000
|
|
|
Threads Total: 74, NEW: 0, RUNNABLE: 17, BLOCKED: 0, WAITING: 15, TIMED_WAITING: 42, TERMINATED: 0
|
|
|
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON
|
|
|
78 com.taobao.config.client.timer main 5 TIMED_WAITING 22 0:0 false true
|
|
|
92 Abandoned connection cleanup thread main 5 TIMED_WAITING 15 0:2 false true
|
|
|
361 as-command-execute-daemon system 10 RUNNABLE 14 0:0 false true
|
|
|
67 HSF-Remoting-Timer-10-thread-1 main 10 TIMED_WAITING 12 0:2 false true
|
|
|
113 JamScheduleThread system 9 TIMED_WAITING 2 0:0 false true
|
|
|
14 Thread-3 main 5 RUNNABLE 2 0:0 false false
|
|
|
81 com.taobao.remoting.TimerThread main 5 TIMED_WAITING 2 0:0 false true
|
|
|
104 http-bio-7001-AsyncTimeout main 5 TIMED_WAITING 2 0:0 false true
|
|
|
123 nioEventLoopGroup-2-1 system 10 RUNNABLE 2 0:0 false false
|
|
|
127 nioEventLoopGroup-3-2 system 10 RUNNABLE 2 0:0 false false
|
|
|
345 nioEventLoopGroup-3-3 system 10 RUNNABLE 2 0:0 false false
|
|
|
358 nioEventLoopGroup-3-4 system 10 RUNNABLE 2 0:0 false false
|
|
|
27 qos-boss-1-1 main 5 RUNNABLE 2 0:0 false true
|
|
|
22 EagleEye-AsyncAppender-Thread-BizLog main 5 TIMED_WAITING 1 0:0 false true
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="trace">
|
|
|
<span id="trace"></span><h2>trace命令自动高亮显示最耗时方法调用<a class="headerlink" href="#trace" title="永久链接至标题">¶</a></h2>
|
|
|
<p>trace命令现在会自动显示</p>
|
|
|
<p>![Untitled2](TODO /Untitled2.gif)</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<footer>
|
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
<div role="contentinfo">
|
|
|
<p>
|
|
|
© Copyright 2018, Alibaba Middleware Group, and contributors.
|
|
|
|
|
|
</p>
|
|
|
</div>
|
|
|
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
var DOCUMENTATION_OPTIONS = {
|
|
|
URL_ROOT:'./',
|
|
|
VERSION:'3.0.6-SNAPSHOT',
|
|
|
LANGUAGE:'zh_CN',
|
|
|
COLLAPSE_INDEX:false,
|
|
|
FILE_SUFFIX:'.html',
|
|
|
HAS_SOURCE: true,
|
|
|
SOURCELINK_SUFFIX: '.txt'
|
|
|
};
|
|
|
</script>
|
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
|
<script type="text/javascript" src="_static/translations.js"></script>
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="_static/js/theme.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
jQuery(function () {
|
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
|
});
|
|
|
</script>
|
|
|
<div class="github-fork-ribbon-wrapper right">
|
|
|
<div class="github-fork-ribbon">
|
|
|
<a href="https://github.com/alibaba/arthas">Fork me at GitHub</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript" src="_static/add_badges.js"></script>
|
|
|
|
|
|
<script>
|
|
|
var _hmt = _hmt || [];
|
|
|
(function() {
|
|
|
var hm = document.createElement("script");
|
|
|
hm.src = "https://hm.baidu.com/hm.js?d5c5e25b100f0eb51a4c35c8a86ea9b4";
|
|
|
var s = document.getElementsByTagName("script")[0];
|
|
|
s.parentNode.insertBefore(hm, s);
|
|
|
})();
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
</html> |