Skip to content
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

Local span perf improvements #505

Merged
merged 3 commits into from Mar 31, 2021
Merged

Local span perf improvements #505

merged 3 commits into from Mar 31, 2021

Conversation

jtescher
Copy link
Member

Currently span data recording performance is capped because all changes are synchronized behind a mutex. This patch changes the span API to take mutable references instead, and only requires the use of mutexes when setting values through a shared reference to the active span in the context API.

results: 19-47% performance improvement
start-end-span/always-sample
                        time:   [321.64 ns 323.85 ns 326.40 ns]
                        change: [-48.064% -47.628% -47.169%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
start-end-span/never-sample
                        time:   [219.28 ns 220.25 ns 221.29 ns]
                        change: [-34.537% -33.419% -32.409%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  8 (8.00%) high mild
  2 (2.00%) high severe

start-end-span-4-attrs/always-sample
                        time:   [895.10 ns 904.83 ns 916.50 ns]
                        change: [-31.319% -30.690% -30.038%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
start-end-span-4-attrs/never-sample
                        time:   [249.18 ns 250.59 ns 252.33 ns]
                        change: [-30.774% -29.948% -29.168%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  8 (8.00%) high mild
  5 (5.00%) high severe

start-end-span-8-attrs/always-sample
                        time:   [1.5984 us 1.6098 us 1.6226 us]
                        change: [-27.169% -25.705% -24.416%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
start-end-span-8-attrs/never-sample
                        time:   [287.27 ns 288.77 ns 290.62 ns]
                        change: [-24.716% -23.535% -22.466%] (p = 0.00 < 0.05)
                        Performance has improved.

start-end-span-all-attr-types/always-sample
                        time:   [1.2813 us 1.2911 us 1.3018 us]
                        change: [-25.382% -24.399% -23.483%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe
start-end-span-all-attr-types/never-sample
                        time:   [263.15 ns 264.19 ns 265.32 ns]
                        change: [-31.910% -30.959% -30.085%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) high mild
  5 (5.00%) high severe

start-end-span-all-attr-types-2x/always-sample
                        time:   [2.2835 us 2.2974 us 2.3119 us]
                        change: [-20.158% -19.254% -18.254%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
start-end-span-all-attr-types-2x/never-sample
                        time:   [312.36 ns 313.86 ns 315.61 ns]
                        change: [-27.570% -26.865% -26.059%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe

Currently span data recording performance is capped because all changes
are synchronized behind a mutex. This patch changes the span API to take
mutable references instead, and only requires the use of mutexes when
setting values through a shared reference to the active span in the
context API.
@jtescher jtescher requested a review from a team as a code owner March 30, 2021 03:21
Copy link
Member

@frigus02 frigus02 left a comment

Choose a reason for hiding this comment

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

This looks like a good improvement. Nice work!

opentelemetry/src/sdk/trace/tracer.rs Show resolved Hide resolved
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Nice improvement!

opentelemetry/src/sdk/export/trace/mod.rs Outdated Show resolved Hide resolved
@jtescher jtescher merged commit e169d8d into main Mar 31, 2021
@jtescher jtescher deleted the local-span-perf branch March 31, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants