Skip to content

Conversation

@conradludgate
Copy link
Contributor

@conradludgate conradludgate commented Oct 31, 2025

Motivation

As discussed on discord:

My team isn't comfortable with the performance concerns of enabling tokio's tracing feature since we do actually use tracing in our application and such there is potentially a measurable cost of evaluating our EnvFilter every time in our performance critical services.

Solution

Using Userspace Statically Defined Tracing (USDT) we expose lightweight probes that can be attached to at runtime with tools like bpftrace or dtrace. This is inspired by https://github.com/oxidecomputer/usdt.

The new functionality is behind a new unstable feature flag. Currently it only exposes some basic task events and not yet any resource events.

See USDT in the wild:

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR labels Oct 31, 2025
fn task__terminate(task_id: u64) {}

fn task__waker__clone(task_id: u64) {}
fn task__waker__wake(task_id: u64) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea to represent waker as wake + drop and remove the need for wake_by_ref.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually wasn't sure if I liked that 😅

@conradludgate conradludgate force-pushed the tokio-usdt branch 2 times, most recently from 638f594 to 3eb3cde Compare October 31, 2025 15:10
@conradludgate
Copy link
Contributor Author

Musings regarding usdt performance: oxidecomputer/usdt#490

@conradludgate
Copy link
Contributor Author

I think I'm going to vendor the minimal subset of the code needed to support USDT on the platforms supported by the usdt crate. Removing any extra dependencies in the process.

I'd like to work with the oxide devs to improve this but currently usdt brings in a lot of unnecessary dependencies, and it also doesn't allow cross compilation. Lastly I want to rework the generated code to reduce any performance impact.

Because I will remove all dependencies, I'll move it back to a cfg tokio_usdt and remove the feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants