This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 5af91029ca [doc] Fix jemalloc dump heap profile (#1010)
5af91029ca is described below

commit 5af91029ca14d06549d5732b236d37efd1bfc144
Author: Xinyi Zou <zouxiny...@gmail.com>
AuthorDate: Sat Aug 17 18:10:33 2024 +0800

    [doc] Fix jemalloc dump heap profile (#1010)
---
 community/developer-guide/debug-tool.md               | 17 +++++++++++++++--
 .../current/developer-guide/debug-tool.md             | 19 +++++++++++++++----
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/community/developer-guide/debug-tool.md 
b/community/developer-guide/debug-tool.md
index e3411f7195..079c7b53d0 100644
--- a/community/developer-guide/debug-tool.md
+++ b/community/developer-guide/debug-tool.md
@@ -220,7 +220,12 @@ The output of this command is the same as the output and 
view mode of heap profi
 
 ##### JEMALLOC
 
+For the analysis of the principle of Heap Profile, please refer to [Analysis 
of the Principle of Heap 
Profiling](https://cn.pingcap.com/blog/an-explanation-of-the-heap-profiling-principle/).
 It should be noted that Heap Profile records virtual memory
+
+It supports real-time and regular dumping of Heap Profile, and then uses 
`jeprof` to analyze Heap Profile.
+
 ###### 1. realtime heap dump
+
 Change `prof:false` of `JEMALLOC_CONF` in `be.conf` to `prof:true` and restart 
BE, then use the jemalloc heap dump http interface to generate a heap dump file 
on the corresponding BE machine.
 
 ```shell
@@ -234,6 +239,7 @@ The default sampling interval is 512K, usually only 10% of 
memory is recorded by
 If you are doing profiling, keep `prof:false` to avoid the performance penalty 
of heap dump.
 
 ###### 2. regular heap dump
+
 First, change `prof:false` of `JEMALLOC_CONF` in `be.conf` to `prof:true`. The 
default directory of the heap dump file is `${DORIS_HOME}/log`. The file name 
prefix is ​​`JEMALLOC_PROF_PRFIX` in `be.conf`, which is 
`jemalloc_heap_profile_` by default.
 
 > Before Doris 2.1.6, `JEMALLOC_PROF_PRFIX` is empty and needs to be changed 
 > to any value as the profile file name
@@ -257,10 +263,13 @@ Change `prof_leak` and `prof_final` in `JEMALLOC_CONF` in 
`be.conf` to `true` an
 Change `prof_accum` in `JEMALLOC_CONF` in `be.conf` to `true` and restart BE.
 Use `jeprof --alloc_space` to display the cumulative value of heap dump.
 
-##### 3. jemalloc heap dump profiling
+##### 3. `jeprof` parses Heap Profile
+
+Use `jeprof` to parse the Heap Profile of the above dump. If the process 
memory is too large, the parsing process may take several minutes, so please 
wait patiently. If the system does not have the `jeprof` command, you can 
package the `jeprof` binary in the `doris/tools` directory and upload it to the 
Heap Dump server.
 
 ```
-Addr2line version 2.35.2 or above is required, see QA 1 below.
+Addr2line version 2.35.2 or above is required, see QA-1 below
+Try to have Heap Dump and `jeprof` to parse Heap Profile on the same server, 
see QA-2 below
 ```
 
 1. Analyze a single heap dump file
@@ -321,6 +330,10 @@ hash -r
 
 Note that you cannot use addr2line 2.3.9, which may be incompatible and cause 
memory to keep growing.
 
+2. After running `jeprof`, many errors appear: `addr2line: DWARF error: 
invalid or unhandled FORM value: 0x25`. The parsed Heap stack is the memory 
address of the code, not the function name
+
+This is because the Heap Dump and the execution of `jeprof` to parse the Heap 
Profile are not on the same server, which causes `jeprof` to fail to parse the 
function name using the symbol table. Try to complete the Dump Heap and 
`jeprof` parsing operations on the same machine.
+
 #### LSAN
 
 
[LSAN](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer) 
is an address checking tool, GCC has been integrated. When we compile the code, 
we can enable this function by turning on the corresponding compilation 
options. When the program has a determinable memory leak, it prints the leak 
stack. Doris be has integrated this tool, only need to compile with the 
following command to generate be binary with memory leak detection version.
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/developer-guide/debug-tool.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/developer-guide/debug-tool.md
index 093766e5eb..a6f766d1b1 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/developer-guide/debug-tool.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/developer-guide/debug-tool.md
@@ -225,7 +225,10 @@ Total: 1296.4 MB
 
 有关 Heap Profile 的原理解析参考 [Heap Profiling 
原理解析](https://cn.pingcap.com/blog/an-explanation-of-the-heap-profiling-principle/),需要注意的是
 Heap Profile 记录的是虚拟内存
 
-###### 1. realtime heap dump
+支持实时和定期两种方式 Dump Heap Profile,然后使用 `jeprof` 解析 Heap Profile。
+
+###### 1. 实时 Heap Dump
+
 将 `be.conf` 中 `JEMALLOC_CONF` 的 `prof:false` 修改为 `prof:true` 
并重启BE,然后使用jemalloc heap dump http接口,在对应的BE机器上生成heap dump文件。
 
 ```shell
@@ -238,7 +241,8 @@ heap dump文件所在目录可以在 ``be.conf`` 中通过``jeprofile_dir``变
 
 如果你在做性能测试,保持 `prof:false` 来避免 heap dump 的性能损耗。
 
-###### 2. regular heap dump
+###### 2. 定期 Heap Dump
+
 首先将 `be.conf` 中 `JEMALLOC_CONF` 的 `prof:false` 修改为 `prof:true`,heap 
dump文件所在目录默认为 `${DORIS_HOME}/log`, 文件名前缀是 `be.conf` 中的 
`JEMALLOC_PROF_PRFIX`,默认是 `jemalloc_heap_profile_`。
 
 > 在 Doris 2.1.6 之前,`JEMALLOC_PROF_PRFIX` 为空,需要修改为任意值作为 profile 文件名
@@ -262,10 +266,13 @@ heap dump文件所在目录可以在 ``be.conf`` 中通过``jeprofile_dir``变
    将 `be.conf` 中 `JEMALLOC_CONF` 的 `prof_accum` 修改为 `true` 并重启BE。
    使用 `jeprof --alloc_space` 展示 heap dump 累计值。
 
-##### 3. heap dump profiling
+##### 3. `jeprof` 解析 Heap Profile
+
+使用 `jeprof` 解析上面 Dump 的 Heap Profile,如果进程内存太大,解析过程可能需要几分钟,请耐心等待。若系统没有 `jeprof` 
命令,可以将 `doris/tools` 目录下的 `jeprof` 这个二进制打包后上传到 Heap Dump 的服务器。
 
 ```
-需要 addr2line 版本为 2.35.2 及以上, 见下面的 QA 1.
+需要 addr2line 版本为 2.35.2 及以上, 见下面的 QA-1
+尽可能让 Heap Dump 和执行 `jeprof` 解析 Heap Profile 在同一台服务器上,见下面的 QA-2
 ```
 
 1. 分析单个heap dump文件
@@ -325,6 +332,10 @@ hash -r
 ```
 注意,不能使用 addr2line 2.3.9, 这可能不兼容,导致内存一直增长。
 
+2. 运行 `jeprof` 后出现很多错误: `addr2line: DWARF error: invalid or unhandled FORM 
value: 0x25`,解析后的 Heap 栈都是代码的内存地址,而不是函数名称
+
+这是因为 Heap Dump 和执行 `jeprof` 解析 Heap Profile 不在同一台服务器上,导致 `jeprof` 
使用符号表解析函数名称失败,尽可能在同一台机器上完成 Dump Heap 和 `jeprof` 解析的操作。
+
 #### LSAN
 
 
[LSAN](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer)是一个地址检查工具,GCC已经集成。在我们编译代码的时候开启相应的编译选项,就能够开启这个功能。当程序发生可以确定的内存泄露时,会将泄露堆栈打印。Doris
 BE已经集成了这个工具,只需要在编译的时候使用如下的命令进行编译就能够生成带有内存泄露检测版本的BE二进制


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to