You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/04/10 22:51:18 UTC

(datafusion-comet) branch asf-site updated: Publish built docs triggered by 204d7e4562728ae967768634e8d00a7fa30b7b87

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

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new bbc19ce7d Publish built docs triggered by 204d7e4562728ae967768634e8d00a7fa30b7b87
bbc19ce7d is described below

commit bbc19ce7db5e40485303fb3d92ea01aba69599fd
Author: github-actions[bot] <gi...@users.noreply.github.com>
AuthorDate: Fri Apr 10 22:51:13 2026 +0000

    Publish built docs triggered by 204d7e4562728ae967768634e8d00a7fa30b7b87
---
 _images/tracing.png                       | Bin 95661 -> 408422 bytes
 _sources/contributor-guide/tracing.md.txt |  75 +++++++++++++++++++++++++-----
 _static/images/tracing.png                | Bin 95661 -> 408422 bytes
 contributor-guide/index.html              |   1 +
 contributor-guide/tracing.html            |  69 +++++++++++++++++++++------
 searchindex.js                            |   2 +-
 6 files changed, 121 insertions(+), 26 deletions(-)

diff --git a/_images/tracing.png b/_images/tracing.png
index 78897512f..46224945f 100644
Binary files a/_images/tracing.png and b/_images/tracing.png differ
diff --git a/_sources/contributor-guide/tracing.md.txt b/_sources/contributor-guide/tracing.md.txt
index b9b4fe0dc..88a291f42 100644
--- a/_sources/contributor-guide/tracing.md.txt
+++ b/_sources/contributor-guide/tracing.md.txt
@@ -40,25 +40,76 @@ Example output:
 { "name": "decodeShuffleBlock", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109228835 },
 { "name": "decodeShuffleBlock", "cat": "PERF", "ph": "B", "pid": 1, "tid": 5, "ts": 10109245928 },
 { "name": "decodeShuffleBlock", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109248843 },
-{ "name": "execute_plan", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109350935 },
-{ "name": "CometExecIterator_getNextBatch", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109367116 },
-{ "name": "CometExecIterator_getNextBatch", "cat": "PERF", "ph": "B", "pid": 1, "tid": 5, "ts": 10109479156 },
+{ "name": "executePlan", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109350935 },
+{ "name": "getNextBatch[JVM] stage=2", "cat": "PERF", "ph": "E", "pid": 1, "tid": 5, "ts": 10109367116 },
+{ "name": "getNextBatch[JVM] stage=2", "cat": "PERF", "ph": "B", "pid": 1, "tid": 5, "ts": 10109479156 },
 ```
 
-Traces can be viewed with [Trace Viewer].
+Traces can be viewed with [Perfetto UI].
 
-[Trace Viewer]: https://github.com/catapult-project/catapult/blob/main/tracing/README.md
+[Perfetto UI]: https://ui.perfetto.dev
 
 Example trace visualization:
 
 ![tracing](../_static/images/tracing.png)
 
+## Analyzing Memory Usage
+
+The `analyze_trace` tool parses a trace log and compares jemalloc usage against the sum of per-thread
+Comet memory pool reservations. This is useful for detecting untracked native memory growth where jemalloc
+allocations exceed what the memory pools account for.
+
+Build and run:
+
+```shell
+cd native
+cargo run --bin analyze_trace -- /path/to/comet-event-trace.json
+```
+
+The tool reads counter events from the trace log. Because tracing logs metrics per thread, `jemalloc_allocated`
+is a process-wide value (the same global allocation reported from whichever thread logs it), while
+`thread_NNN_comet_memory_reserved` values are per-thread pool reservations that are summed to get the total
+tracked memory.
+
+Sample output:
+
+```
+=== Comet Trace Memory Analysis ===
+
+Counter events parsed: 193104
+Threads with memory pools: 8
+Peak jemalloc allocated:   3068.2 MB
+Peak pool total:           2864.6 MB
+Peak excess (jemalloc - pool): 364.6 MB
+
+WARNING: jemalloc exceeded pool reservation at 138 sampled points:
+
+     Time (us)        jemalloc      pool_total          excess
+--------------------------------------------------------------
+        179578        210.8 MB          0.1 MB        210.7 MB
+        429663        420.5 MB        145.1 MB        275.5 MB
+       1304969       2122.5 MB       1797.2 MB        325.2 MB
+      21974838        407.0 MB         42.3 MB        364.6 MB
+      33543599          5.5 MB          0.1 MB          5.3 MB
+
+--- Final per-thread pool reservations ---
+
+  thread_60_comet_memory_reserved: 0.0 MB
+  thread_95_comet_memory_reserved: 0.0 MB
+  thread_96_comet_memory_reserved: 0.0 MB
+  ...
+
+  Total: 0.0 MB
+```
+
+Some excess is expected (jemalloc metadata, fragmentation, non-pool allocations like Arrow IPC buffers).
+Large or growing excess may indicate memory that is not being tracked by the pool.
+
 ## Definition of Labels
 
-| Label                 | Meaning                                                        |
-| --------------------- | -------------------------------------------------------------- |
-| jvm_heapUsed          | JVM heap memory usage of live objects for the executor process |
-| jemalloc_allocated    | Native memory usage for the executor process                   |
-| task_memory_comet_NNN | Off-heap memory allocated by Comet for query execution         |
-| task_memory_spark_NNN | On-heap & Off-heap memory allocated by Spark                   |
-| comet_shuffle_NNN     | Off-heap memory allocated by Comet for columnar shuffle        |
+| Label                            | Meaning                                                                                                                  |
+| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
+| jvm_heap_used                    | JVM heap memory usage of live objects for the executor process                                                           |
+| jemalloc_allocated               | Native memory usage for the executor process (requires `jemalloc` feature)                                               |
+| thread_NNN_comet_memory_reserved | Memory reserved by Comet's DataFusion memory pool (summed across all contexts on the thread). NNN is the Rust thread ID. |
+| thread_NNN_comet_jvm_shuffle     | Off-heap memory allocated by Comet for columnar shuffle. NNN is the Rust thread ID.                                      |
diff --git a/_static/images/tracing.png b/_static/images/tracing.png
index 78897512f..46224945f 100644
Binary files a/_static/images/tracing.png and b/_static/images/tracing.png differ
diff --git a/contributor-guide/index.html b/contributor-guide/index.html
index 53e7ea64d..4e164f374 100644
--- a/contributor-guide/index.html
+++ b/contributor-guide/index.html
@@ -556,6 +556,7 @@ under the License.
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="tracing.html">Tracing</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="tracing.html#analyzing-memory-usage">Analyzing Memory Usage</a></li>
 <li class="toctree-l2"><a class="reference internal" href="tracing.html#definition-of-labels">Definition of Labels</a></li>
 </ul>
 </li>
diff --git a/contributor-guide/tracing.html b/contributor-guide/tracing.html
index 6a592950b..0666a41d3 100644
--- a/contributor-guide/tracing.html
+++ b/contributor-guide/tracing.html
@@ -472,14 +472,60 @@ directory with the filename <code class="docutils literal notranslate"><span cla
 <span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;decodeShuffleBlock&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span class="w">  [...]
 <span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;decodeShuffleBlock&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span class="w">  [...]
 <span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;decodeShuffleBlock&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span class="w">  [...]
-<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;execute_plan&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span class="w"> </span [...]
-<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;CometExecIterator_getNextBatch&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span [...]
-<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;CometExecIterator_getNextBatch&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span [...]
+<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;executePlan&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span class="w"> </span> [...]
+<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;getNextBatch[JVM] stage=2&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span clas [...]
+<span class="p">{</span><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;getNextBatch[JVM] stage=2&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;cat&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;PERF&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;ph&quot;</span><span class="p">:</span><span clas [...]
 </pre></div>
 </div>
-<p>Traces can be viewed with <a class="reference external" href="https://github.com/catapult-project/catapult/blob/main/tracing/README.md">Trace Viewer</a>.</p>
+<p>Traces can be viewed with <a class="reference external" href="https://ui.perfetto.dev">Perfetto UI</a>.</p>
 <p>Example trace visualization:</p>
 <p><img alt="tracing" src="../_images/tracing.png" /></p>
+<section id="analyzing-memory-usage">
+<h2>Analyzing Memory Usage<a class="headerlink" href="#analyzing-memory-usage" title="Link to this heading">#</a></h2>
+<p>The <code class="docutils literal notranslate"><span class="pre">analyze_trace</span></code> tool parses a trace log and compares jemalloc usage against the sum of per-thread
+Comet memory pool reservations. This is useful for detecting untracked native memory growth where jemalloc
+allocations exceed what the memory pools account for.</p>
+<p>Build and run:</p>
+<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>native
+cargo<span class="w"> </span>run<span class="w"> </span>--bin<span class="w"> </span>analyze_trace<span class="w"> </span>--<span class="w"> </span>/path/to/comet-event-trace.json
+</pre></div>
+</div>
+<p>The tool reads counter events from the trace log. Because tracing logs metrics per thread, <code class="docutils literal notranslate"><span class="pre">jemalloc_allocated</span></code>
+is a process-wide value (the same global allocation reported from whichever thread logs it), while
+<code class="docutils literal notranslate"><span class="pre">thread_NNN_comet_memory_reserved</span></code> values are per-thread pool reservations that are summed to get the total
+tracked memory.</p>
+<p>Sample output:</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">===</span> <span class="n">Comet</span> <span class="n">Trace</span> <span class="n">Memory</span> <span class="n">Analysis</span> <span class="o">===</span>
+
+<span class="n">Counter</span> <span class="n">events</span> <span class="n">parsed</span><span class="p">:</span> <span class="mi">193104</span>
+<span class="n">Threads</span> <span class="k">with</span> <span class="n">memory</span> <span class="n">pools</span><span class="p">:</span> <span class="mi">8</span>
+<span class="n">Peak</span> <span class="n">jemalloc</span> <span class="n">allocated</span><span class="p">:</span>   <span class="mf">3068.2</span> <span class="n">MB</span>
+<span class="n">Peak</span> <span class="n">pool</span> <span class="n">total</span><span class="p">:</span>           <span class="mf">2864.6</span> <span class="n">MB</span>
+<span class="n">Peak</span> <span class="n">excess</span> <span class="p">(</span><span class="n">jemalloc</span> <span class="o">-</span> <span class="n">pool</span><span class="p">):</span> <span class="mf">364.6</span> <span class="n">MB</span>
+
+<span class="n">WARNING</span><span class="p">:</span> <span class="n">jemalloc</span> <span class="n">exceeded</span> <span class="n">pool</span> <span class="n">reservation</span> <span class="n">at</span> <span class="mi">138</span> <span class="n">sampled</span> <span class="n">points</span><span class="p">:</span>
+
+     <span class="n">Time</span> <span class="p">(</span><span class="n">us</span><span class="p">)</span>        <span class="n">jemalloc</span>      <span class="n">pool_total</span>          <span class="n">excess</span>
+<span class="o">--------------------------------------------------------------</span>
+        <span class="mi">179578</span>        <span class="mf">210.8</span> <span class="n">MB</span>          <span class="mf">0.1</span> <span class="n">MB</span>        <span class="mf">210.7</span> <span class="n">MB</span>
+        <span class="mi">429663</span>        <span class="mf">420.5</span> <span class="n">MB</span>        <span class="mf">145.1</span> <span class="n">MB</span>        <span class="mf">275.5</span> <span class="n">MB</span>
+       <span class="mi">1304969</span>       <span class="mf">2122.5</span> <span class="n">MB</span>       <span class="mf">1797.2</span> <span class="n">MB</span>        <span class="mf">325.2</span> <span class="n">MB</span>
+      <span class="mi">21974838</span>        <span class="mf">407.0</span> <span class="n">MB</span>         <span class="mf">42.3</span> <span class="n">MB</span>        <span class="mf">364.6</span> <span class="n">MB</span>
+      <span class="mi">33543599</span>          <span class="mf">5.5</span> <span class="n">MB</span>          <span class="mf">0.1</span> <span class="n">MB</span>          <span class="mf">5.3</span> <span class="n">MB</span>
+
+<span class="o">---</span> <span class="n">Final</span> <span class="n">per</span><span class="o">-</span><span class="n">thread</span> <span class="n">pool</span> <span class="n">reservations</span> <span class="o">---</span>
+
+  <span class="n">thread_60_comet_memory_reserved</span><span class="p">:</span> <span class="mf">0.0</span> <span class="n">MB</span>
+  <span class="n">thread_95_comet_memory_reserved</span><span class="p">:</span> <span class="mf">0.0</span> <span class="n">MB</span>
+  <span class="n">thread_96_comet_memory_reserved</span><span class="p">:</span> <span class="mf">0.0</span> <span class="n">MB</span>
+  <span class="o">...</span>
+
+  <span class="n">Total</span><span class="p">:</span> <span class="mf">0.0</span> <span class="n">MB</span>
+</pre></div>
+</div>
+<p>Some excess is expected (jemalloc metadata, fragmentation, non-pool allocations like Arrow IPC buffers).
+Large or growing excess may indicate memory that is not being tracked by the pool.</p>
+</section>
 <section id="definition-of-labels">
 <h2>Definition of Labels<a class="headerlink" href="#definition-of-labels" title="Link to this heading">#</a></h2>
 <div class="pst-scrollable-table-container"><table class="table">
@@ -489,20 +535,17 @@ directory with the filename <code class="docutils literal notranslate"><span cla
 </tr>
 </thead>
 <tbody>
-<tr class="row-even"><td><p>jvm_heapUsed</p></td>
+<tr class="row-even"><td><p>jvm_heap_used</p></td>
 <td><p>JVM heap memory usage of live objects for the executor process</p></td>
 </tr>
 <tr class="row-odd"><td><p>jemalloc_allocated</p></td>
-<td><p>Native memory usage for the executor process</p></td>
-</tr>
-<tr class="row-even"><td><p>task_memory_comet_NNN</p></td>
-<td><p>Off-heap memory allocated by Comet for query execution</p></td>
+<td><p>Native memory usage for the executor process (requires <code class="docutils literal notranslate"><span class="pre">jemalloc</span></code> feature)</p></td>
 </tr>
-<tr class="row-odd"><td><p>task_memory_spark_NNN</p></td>
-<td><p>On-heap &amp; Off-heap memory allocated by Spark</p></td>
+<tr class="row-even"><td><p>thread_NNN_comet_memory_reserved</p></td>
+<td><p>Memory reserved by Comet’s DataFusion memory pool (summed across all contexts on the thread). NNN is the Rust thread ID.</p></td>
 </tr>
-<tr class="row-even"><td><p>comet_shuffle_NNN</p></td>
-<td><p>Off-heap memory allocated by Comet for columnar shuffle</p></td>
+<tr class="row-odd"><td><p>thread_NNN_comet_jvm_shuffle</p></td>
+<td><p>Off-heap memory allocated by Comet for columnar shuffle. NNN is the Rust thread ID.</p></td>
 </tr>
 </tbody>
 </table>
diff --git a/searchindex.js b/searchindex.js
index f9772b62b..84c318815 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"alltitles": {"1. Format Your Code": [[13, "format-your-code"]], "1. Install Comet": [[16, "install-comet"], [25, "install-comet"]], "1. Native Operators (nativeExecs map)": [[4, "native-operators-nativeexecs-map"]], "2. Build and Verify": [[13, "build-and-verify"]], "2. Clone Iceberg and Apply Diff": [[16, "clone-iceberg-and-apply-diff"]], "2. Clone Spark and Apply Diff": [[25, "clone-spark-and-apply-diff"]], "2. Sink Operators (sinks map)": [[4, "sink-operators-sinks-m [...]
\ No newline at end of file
+Search.setIndex({"alltitles": {"1. Format Your Code": [[13, "format-your-code"]], "1. Install Comet": [[16, "install-comet"], [25, "install-comet"]], "1. Native Operators (nativeExecs map)": [[4, "native-operators-nativeexecs-map"]], "2. Build and Verify": [[13, "build-and-verify"]], "2. Clone Iceberg and Apply Diff": [[16, "clone-iceberg-and-apply-diff"]], "2. Clone Spark and Apply Diff": [[25, "clone-spark-and-apply-diff"]], "2. Sink Operators (sinks map)": [[4, "sink-operators-sinks-m [...]
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org