跳到主要内容

使用 arthas 对 fe 进行 profile

介绍

在 doris 3.1.0及以上版本中,在fe部署目录${DORIS_FE_HOME}/arthas中存放了 Arthas 工具(4.0.5版本),可以使用 Arthas 来打印火焰图、跟踪函数调用路径、输出函数调用时间、观察函数的入参和返回值等等,方便我们定位 fe 的各种运行时问题。 具体 Arthas 的使用方法可以参考:Arthas官方文档

备注

注:目前仅支持 Linux 和 MacOS 系统,暂未支持 Windows 系统

打印火焰图的案例如下:

  1. 运行${DORIS_FE_HOME}/arthas/as.sh脚本,选择DorisFE进程

    bash ./as.sh
    Arthas script version: 4.0.5
    Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
    * [1]: 75123 com.intellij.idea.Main
    [2]: 77285 org.apache.doris.DorisFE
    [3]: 76901 DorisBE
    [4]: 6776 org.jetbrains.jps.cmdline.Launcher
    [5]: 76265 DorisBE
    [6]: 80527 org.jetbrains.jps.cmdline.Launcher
    2
  2. 开始 profile

    [arthas@77285]$ profiler start
    Profiling started
  3. 结束 profile,生成火焰图文件为 20250627-115104.html

    [arthas@77285]$ profiler stop --format html
    OK
    profiler output file: <DORIS_FE_HOME>/arthas-output/20250627-115104.html

在低版本 fe 中使用Arthas

对于3.1之前的版本,需要手动下载 Arthas:

wget https://github.com/alibaba/arthas/releases/download/arthas-all-4.0.5/arthas-bin.zip
unzip arthas-bin.zip -o ${DORIS_FE_HOME}/arthas