Skip to content

chore(observability): add tokio runtime with custom thread naming#18623

Merged
yongkangc merged 5 commits intomainfrom
yk/engine_wk_pool
Sep 23, 2025
Merged

chore(observability): add tokio runtime with custom thread naming#18623
yongkangc merged 5 commits intomainfrom
yk/engine_wk_pool

Conversation

@yongkangc
Copy link
Member

@yongkangc yongkangc commented Sep 23, 2025

Closes: #18624 - All threads looked identical - impossible to debug or profile

  • better observability of tokio threads for profiling, similar to how we doing it on rayon i.e reth-rayon-36

Changes:

  • All major thread pools now have descriptive names for easy identification:
    • Main CLI runtime: reth-cli-tokio-{id} (e.g., reth-cli-tokio-0, reth-cli-tokio-1)
    • Workload executor: reth-wkpool-tokio-{id} (e.g., reth-wkpool-tokio-0, reth-wkpool-tokio-1)
    • Trie operations: reth-trie-tokio-{id} (e.g., reth-trie-tokio-0, reth-trie-tokio-1)
    • CPU blocking tasks: reth-blocking-rayon-{id} (e.g., reth-blocking-rayon-0, reth-blocking-rayon-1)
    • Global CPU pool: reth-rayon-{id} (e.g., reth-rayon-0, reth-rayon-1)

- better observability, similar to how we doin it on rayon

- The fetch_add happens only while each worker thread is being spawned, so it runs a handful of times during startup—not per task. here, with one call per thread creation, it’s essentially free compared with the cost of launching the thread itself.
@yongkangc yongkangc requested a review from mattsse as a code owner September 23, 2025 04:21
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Sep 23, 2025
@yongkangc yongkangc self-assigned this Sep 23, 2025
@yongkangc yongkangc moved this from Backlog to In Review in Reth Tracker Sep 23, 2025
@yongkangc yongkangc added the A-cli Related to the reth CLI label Sep 23, 2025
… tokio runtime

- Introduced an AtomicUsize to track and name threads in the tokio runtime, enhancing observability during thread creation.
- The thread naming function utilizes fetch_add to ensure unique identifiers for each worker thread, improving clarity in logs.
@yongkangc yongkangc added the A-observability Related to tracing, metrics, logs and other observability tools label Sep 23, 2025
- Updated the thread naming function to format thread names for better observability, aligning with the custom naming approach used in the tokio runtime.
- Introduced atomic operations to ensure unique thread identifiers during creation, improving clarity in logs.
@yongkangc yongkangc changed the title feat(cli): add tokio runtime with custom thread naming chore(observability): add tokio runtime with custom thread naming Sep 23, 2025
Copy link
Member

@mediocregopher mediocregopher left a comment

Choose a reason for hiding this comment

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

💯

@github-project-automation github-project-automation bot moved this from In Review to In Progress in Reth Tracker Sep 23, 2025
@yongkangc yongkangc added this pull request to the merge queue Sep 23, 2025
Merged via the queue into main with commit 2ec3671 Sep 23, 2025
46 checks passed
@yongkangc yongkangc deleted the yk/engine_wk_pool branch September 23, 2025 09:20
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Sep 23, 2025
@jenpaff jenpaff moved this from Done to Completed in Reth Tracker Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Related to the reth CLI A-observability Related to tracing, metrics, logs and other observability tools

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

improve naming of tokio threads

2 participants