andygrove commented on issue #1894:
URL: 
https://github.com/apache/datafusion-comet/issues/1894#issuecomment-4178475112

   Here are a few approaches depending on what you're trying to measure:
   
   ### Measuring Comet's off-heap memory usage
   
   **Option 1: Tracing with jemalloc (recommended for overall native memory)**
   
   Build Comet with jemalloc enabled:
   ```
   make release COMET_FEATURES="jemalloc"
   ```
   
   Then enable tracing:
   ```
   spark.comet.tracing.enabled=true
   ```
   
   This generates a `comet-event-trace.json` file (Chrome Trace Event Format) 
that includes:
   - `jemalloc_allocated` — total native memory allocated by the executor 
process
   - `task_memory_comet_NNN` — off-heap memory allocated by Comet for query 
execution
   - `comet_shuffle_NNN` — off-heap memory allocated for columnar shuffle
   
   You can view this in `chrome://tracing` or 
[Perfetto](https://ui.perfetto.dev/).
   
   **Option 2: Debug memory logging**
   
   Set `spark.comet.debug.memory=true` to log all memory pool reservation 
grow/shrink operations. This gives fine-grained visibility into DataFusion 
memory pool usage.
   
   ### Profiling native threads
   
   For CPU profiling of native code, 
[cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) works well for 
benchmarks. For profiling within a Spark job, async-profiler (which you're 
already using) is the right tool — it can capture both JVM and native frames in 
the same flamegraph.
   
   For more details, see our contributor guides:
   - 
[Tracing](https://datafusion.apache.org/comet/contributor-guide/tracing.html)
   - [Profiling Native 
Code](https://datafusion.apache.org/comet/contributor-guide/profiling_native_code.html)
   - 
[Debugging](https://datafusion.apache.org/comet/contributor-guide/debugging.html)


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to