Skip to content

Commit 0200f51

Browse files
committed
PS-10254 [DOCS] - Incorrect options for jeprof --show_bytes in Jemalloc memory allocation profiling 8.4
modified: docs/jemalloc-profiling.md
1 parent 45a181e commit 0200f51

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/jemalloc-profiling.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ The following is an example of the required commands:
1919

2020
```text
2121
./configure --enable-stats --enable-prof && make && make install
22-
MALLOC_CONF=prof:true
23-
LD_PRELOAD=/usr/lib/libjemalloc.so
22+
export MALLOC_CONF=prof:true
23+
export LD_PRELOAD=/usr/lib/libjemalloc.so
2424
```
2525

2626
<!-- note:
@@ -83,7 +83,7 @@ mysql> SELECT * FROM malloc_stats ORDER BY TYPE DESC LIMIT 3;
8383
+--------+-------------+-------------+-------------+-------------+
8484
| small | 23578872 | 586156 | 0 | 2649417 |
8585
| large | 367382528 | 2218 | 0 | 6355 |
86-
| huge | 0 | 0 | 0 | |
86+
| huge | 0 | 0 | 0 | 0 |
8787
+--------+-------------+-------------+-------------+-------------+
8888
3 rows in set (0.00 sec)
8989
```
@@ -92,7 +92,7 @@ mysql> SELECT * FROM malloc_stats ORDER BY TYPE DESC LIMIT 3;
9292

9393
The profiling samples the `malloc()` calls and stores the sampled stack traces in a separate location in memory. These samples can be dumped into the filesystem. A dump returns a detailed view of the state of the memory.
9494

95-
The process is global; therefore, only a single concurrent run is available and only the most recent runs are stored on disk.
95+
The process is global; therefore, only a single concurrent run is available. Each dump creates a new file with a unique timestamp, and previous dumps are retained unless manually deleted.
9696

9797
Use the following command to create a profile dump file:
9898

@@ -102,17 +102,35 @@ flush memory profile;
102102

103103
The generated memory profile dumps are written to the /tmp directory.
104104

105-
You can analyze the dump files with `jeprof` program, which must be installed on the host system in the appropriate path. This program is a perl script that post-processes the dump files in their raw format. The program has no connection to the `jemalloc` library and the version numbers are not required to match.
105+
You can analyze the dump files with `jeprof` program, which must be installed on the host system and available in the system PATH. This program is a C program that post-processes the dump files in their raw format. While jeprof can work with dumps from different jemalloc versions, compatibility issues may occur with significantly different versions.
106106

107107
To verify the dump, run the following command:
108108

109109
```shell
110110
ls /tmp/jeprof_mysqld*
111-
/tmp/jeprof_mysqld.1.0.170013202213
112-
jeprof --show_bytes /tmp/jeprof_mysqld.1.0.170013202213 jeprof.*.heap
113111
```
114112

115-
You can also access the memory profile to plot a graph of the memory use. This ability requires that `jeprof` and `dot` are in the /tmp path. For the graph to display useful information, the binary file must contain symbol information.
113+
??? example "Expected output"
114+
115+
```{.text .no-copy}
116+
/tmp/jeprof_mysqld.1.0.170013202213
117+
```
118+
119+
Then analyze the profile:
120+
121+
```shell
122+
jeprof --show_bytes /usr/sbin/mysqld /tmp/jeprof_mysqld.1.0.170013202213
123+
```
124+
125+
You can also access the memory profile to plot a graph of the memory use. This ability requires that `jeprof` and `dot` are available in the system PATH. For the graph to display useful information, the binary file must contain debug symbol information.
126+
127+
!!! warning "Important considerations"
128+
129+
* Ensure the MySQL process has write permissions to `/tmp`
130+
131+
* Profile dumps can be large; monitor available disk space
132+
133+
* Profiling has performance overhead and should be used judiciously
116134

117135
Run the following command:
118136

0 commit comments

Comments
 (0)