PragmaTwice commented on code in PR #305:
URL: https://github.com/apache/kvrocks-website/pull/305#discussion_r2129128588


##########
docs/how-to-profile-memory.md:
##########
@@ -0,0 +1,39 @@
+# How to profile memory
+
+To make the memory profiling easier, Kvrocks provides the command `KPROFILE` 
to active/deactive and dump the memory profiling data. But it's only supported 
when building with the Jemalloc memory allocator(built by default).
+
+## Prerequisites
+
+Before profiling, you need to run Kvrocks server with the following 
environment variable set:
+
+```bash
+export MALLOC_CONF="prof:true,background_thread:true"
+./kvrocks -c kvrocks.conf
+```
+
+or
+
+```bash
+MALLOC_CONF="prof:true,background_thread:true" ./kvrocks -c kvrocks.conf
+```
+
+Docker users don't need to set this environment variable, as the Dockerfile 
already sets it.
+
+## Use KPROFILE command
+
+Once Kvrocks is running with the above environment variable set, you can use 
the `KPROFILE` command to control the profiling:
+
+```bash
+# Enable memory profiling
+$ redis-cli> KPROFILE MEMORY ENABLE
+
+# Dump memory profiling data to a file in the specified directory,
+# the profiling filename will be starting with `jeprof-` prefix

Review Comment:
   ```suggestion
   # the profiling filename will be prefixed with `jeprof-`
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to