Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions docs/source/contributor-guide/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ under the License.

# Tracing

Tracing can be enabled by setting `spark.comet.tracing.enabled=true`. Additionally, enabling the `jemalloc`
feature will enable tracing of native memory allocations.
Tracing can be enabled by setting `spark.comet.tracing.enabled=true`.

With this feature enabled, each Spark executor will write a JSON event log file in
Chrome's [Trace Event Format]. The file will be written to the executor's current working
directory with the filename `comet-event-trace.json`.

[Trace Event Format]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview?tab=t.0#heading=h.yr4qxyxotyw

Additionally, enabling the `jemalloc` feature will enable tracing of native memory allocations.

```shell
make release COMET_FEATURES="jemalloc"
```

With this feature enabled, each Spark executor will write a JSON event log file in
Chrome's [Trace Event Format].

[Trace Event Format]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview?tab=t.0#heading=h.yr4qxyxotyw

Example output:

```json
Expand All @@ -43,10 +45,20 @@ Example output:
{ "name": "CometExecIterator_getNextBatch", "cat": "PERF", "ph": "B", "pid": 1, "tid": 5, "ts": 10109479156 },
```

Traces can be viewed with [Trace Viewer].
Traces can be viewed with [Trace Viewer].

[Trace Viewer]: https://github.com/catapult-project/catapult/blob/main/tracing/README.md

Example trace visualization:

![tracing](../_static/images/tracing.png)

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is NNN is it a task number or thread number or query number?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread number

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread number

it might be beneficial for the user to mention it

| task_memory_spark_NNN | On-heap & Off-heap memory allocated by Spark |
| comet_shuffle_NNN | Off-heap memory allocated by Comet for columnar shuffle |
Loading