-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Alter RNG for TraceId and SpanId #808
Comments
Different RNG does not necessarily require a different crate -- the rand crate comes with several types of RNG. The first question is if we need a cryptographically secure RNG for this, which we do seem to be using here. If we think we don't need a secure RNG, we could try the |
Agreed as first change SmallRng might be alright. I'll do some initial testing. |
From my initial benchmarks looks like minor but not insignificant improvement. ~9% improvement ran a few times to attempt normalizing it. |
@hdost, curious if you're still planning to move forward with this change? |
Yes I can rebase put out a patch. |
Represents a minimum a 11%-22% improvement in relevant benchmarks. Fixes open-telemetry#808
Represents a minimum a 3-8% improvement in relevant benchmarks. Fixes open-telemetry#808
Finally got back to this, and when running the stress test for the SmallRng we're seeing about a 6% improvement at the best, to negligible at worst. Using Existing Rng
Using SmallRng
|
SmallRng provides 0-6% improvement in Traces. Relates open-telemetry#808
Base on doing some cursory benchmarking I was seeing that in
main
roughtly 28% of the time spent onSpan::start()
is 20% in trace_id generation and 8% in span_id generation,I originally dug into this because of #800 out of interest in how much time sampling versus non sampling took.
I can run some additional benchmarks to ensure consistency. However, I am currently thinking something like https://crates.io/crates/oorandom would be a faster default. It's
#[no_std]
and also#[forbid(unsafe_code)]
Finally it's a PCG so statistically it should be ok.
The text was updated successfully, but these errors were encountered: