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

improve: use ringbuffer to send spans #167

Merged
merged 5 commits into from
Sep 19, 2023
Merged

Conversation

andylokandy
Copy link
Collaborator

Signed-off-by: Andy Lok andylokandy@hotmail.com

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 6227003789

  • 17 of 24 (70.83%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.4%) to 82.42%

Changes Missing Coverage Covered Lines Changed/Added Lines %
minitrace/src/util/spsc.rs 14 21 66.67%
Files with Coverage Reduction New Missed Lines %
minitrace/src/util/spsc.rs 1 66.67%
minitrace/src/local/local_span_stack.rs 2 93.02%
Totals Coverage Status
Change from base Build 5963933512: -0.4%
Covered Lines: 1655
Relevant Lines: 2008

💛 - Coveralls

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@andylokandy andylokandy merged commit 385a6c7 into tikv:master Sep 19, 2023
8 checks passed
@taqtiqa-mark
Copy link
Contributor

The commit messages are silent on what the bench results were in terms of improvement.

Can you share any data here?

@andylokandy
Copy link
Collaborator Author

@taqtiqa-mark Thanks for reminder.

The benchmark for lastest commit:

     Running benches/compare.rs (target/release/deps/compare-ea219fd34fcebaa0)
Gnuplot not found, using plotters backend
compare/Tokio Tracing/1 time:   [25.119 µs 25.251 µs 25.401 µs]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
compare/Rustracing/1    time:   [10.390 µs 10.450 µs 10.517 µs]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
compare/minitrace/1     time:   [11.644 µs 11.710 µs 11.777 µs]
compare/Tokio Tracing/10
                        time:   [134.02 µs 134.62 µs 135.37 µs]
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
compare/Rustracing/10   time:   [52.612 µs 52.919 µs 53.253 µs]
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
compare/minitrace/10    time:   [52.069 µs 52.338 µs 52.626 µs]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
Benchmarking compare/Tokio Tracing/100: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.3s, enable flat sampling, or reduce sample count to 60.
compare/Tokio Tracing/100
                        time:   [1.2430 ms 1.2492 ms 1.2559 ms]
Found 12 outliers among 100 measurements (12.00%)
  1 (1.00%) low mild
  4 (4.00%) high mild
  7 (7.00%) high severe
compare/Rustracing/100  time:   [487.06 µs 489.34 µs 491.74 µs]
Found 8 outliers among 100 measurements (8.00%)
  8 (8.00%) high mild
compare/minitrace/100   time:   [458.61 µs 460.41 µs 462.39 µs]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
compare/Tokio Tracing/1000
                        time:   [12.412 ms 12.473 ms 12.538 ms]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
compare/Rustracing/1000 time:   [4.8734 ms 4.8916 ms 4.9110 ms]
Found 10 outliers among 100 measurements (10.00%)
  8 (8.00%) high mild
  2 (2.00%) high severe
compare/minitrace/1000  time:   [4.7386 ms 4.7730 ms 4.8090 ms]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild

     Running benches/object_pool.rs (target/release/deps/object_pool-71ee5e07119c6c6e)
Gnuplot not found, using plotters backend
Vec::with_capacity/object-pool/1
                        time:   [10.360 ns 10.438 ns 10.514 ns]
Vec::with_capacity/alloc/1
                        time:   [12.776 ns 12.816 ns 12.858 ns]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
Vec::with_capacity/object-pool/10
                        time:   [10.180 ns 10.215 ns 10.257 ns]
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  4 (4.00%) high severe
Vec::with_capacity/alloc/10
                        time:   [13.360 ns 13.440 ns 13.530 ns]
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe
Vec::with_capacity/object-pool/100
                        time:   [10.081 ns 10.125 ns 10.179 ns]
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe
Vec::with_capacity/alloc/100
                        time:   [12.719 ns 12.754 ns 12.789 ns]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
Vec::with_capacity/object-pool/1000
                        time:   [10.080 ns 10.114 ns 10.157 ns]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
Vec::with_capacity/alloc/1000
                        time:   [3.8606 µs 3.8840 µs 3.9100 µs]
Found 28 outliers among 100 measurements (28.00%)
  7 (7.00%) low severe
  5 (5.00%) low mild
  9 (9.00%) high mild
  7 (7.00%) high severe
Vec::with_capacity/object-pool/10000
                        time:   [10.044 ns 10.089 ns 10.139 ns]
Found 12 outliers among 100 measurements (12.00%)
  2 (2.00%) high mild
  10 (10.00%) high severe
Vec::with_capacity/alloc/10000
                        time:   [5.5136 µs 5.5259 µs 5.5373 µs]
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
Vec::with_capacity/object-pool/100000
                        time:   [10.040 ns 10.084 ns 10.129 ns]
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe
Vec::with_capacity/alloc/100000
                        time:   [7.5572 µs 7.5984 µs 7.6426 µs]

     Running benches/spsc.rs (target/release/deps/spsc-1852d9b57e136832)
Gnuplot not found, using plotters backend
spsc channel/crossbeam/1
                        time:   [91.996 µs 92.566 µs 93.151 µs]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
spsc channel/ringbuffer/1
                        time:   [92.819 µs 93.461 µs 94.155 µs]
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe
spsc channel/minitrace/1
                        time:   [92.935 µs 93.440 µs 93.971 µs]
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
spsc channel/minitrace-legacy/1
                        time:   [95.084 µs 95.689 µs 96.324 µs]
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
  1 (1.00%) high severe
spsc channel/crossbeam/10
                        time:   [93.219 µs 93.818 µs 94.485 µs]
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low mild
  4 (4.00%) high mild
  1 (1.00%) high severe
spsc channel/ringbuffer/10
                        time:   [93.602 µs 94.275 µs 94.994 µs]
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
spsc channel/minitrace/10
                        time:   [92.664 µs 93.213 µs 93.764 µs]
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) low severe
  2 (2.00%) high mild
  1 (1.00%) high severe
spsc channel/minitrace-legacy/10
                        time:   [98.599 µs 99.188 µs 99.843 µs]
Found 5 outliers among 100 measurements (5.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  2 (2.00%) high severe
spsc channel/crossbeam/100
                        time:   [92.536 µs 92.988 µs 93.482 µs]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
spsc channel/ringbuffer/100
                        time:   [93.981 µs 94.624 µs 95.300 µs]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
spsc channel/minitrace/100
                        time:   [93.794 µs 94.310 µs 94.831 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
spsc channel/minitrace-legacy/100
                        time:   [110.67 µs 111.31 µs 112.01 µs]
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low severe
  1 (1.00%) high mild
  5 (5.00%) high severe
spsc channel/crossbeam/1000
                        time:   [97.030 µs 97.660 µs 98.354 µs]
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) low mild
  4 (4.00%) high mild
  1 (1.00%) high severe
spsc channel/ringbuffer/1000
                        time:   [95.950 µs 96.563 µs 97.202 µs]
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
spsc channel/minitrace/1000
                        time:   [96.789 µs 97.501 µs 98.285 µs]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
spsc channel/minitrace-legacy/1000
                        time:   [111.36 µs 112.05 µs 112.77 µs]
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) low mild
  7 (7.00%) high mild
  2 (2.00%) high severe
spsc channel/crossbeam/10000
                        time:   [141.84 µs 142.91 µs 144.17 µs]
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  3 (3.00%) high severe
spsc channel/ringbuffer/10000
                        time:   [120.02 µs 120.82 µs 121.68 µs]
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
spsc channel/minitrace/10000
                        time:   [120.76 µs 121.41 µs 122.11 µs]
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) low mild
  4 (4.00%) high mild
  1 (1.00%) high severe
spsc channel/minitrace-legacy/10000
                        time:   [185.67 µs 187.20 µs 188.88 µs]
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild

spsc channel send only/crossbeam/1
                        time:   [2.3719 µs 2.3828 µs 2.3945 µs]
spsc channel send only/ringbuffer/1
                        time:   [2.3612 µs 2.3732 µs 2.3875 µs]
Found 10 outliers among 100 measurements (10.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  7 (7.00%) high severe
spsc channel send only/minitrace/1
                        time:   [2.3247 µs 2.3336 µs 2.3426 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
spsc channel send only/minitrace-legacy/1
                        time:   [2.3323 µs 2.3436 µs 2.3546 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
spsc channel send only/crossbeam/10
                        time:   [2.4191 µs 2.4311 µs 2.4433 µs]
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
spsc channel send only/ringbuffer/10
                        time:   [2.3233 µs 2.3357 µs 2.3493 µs]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
spsc channel send only/minitrace/10
                        time:   [2.3324 µs 2.3416 µs 2.3500 µs]
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
spsc channel send only/minitrace-legacy/10
                        time:   [2.3321 µs 2.3417 µs 2.3516 µs]
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
spsc channel send only/crossbeam/100
                        time:   [2.6391 µs 2.6524 µs 2.6659 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
spsc channel send only/ringbuffer/100
                        time:   [2.4501 µs 2.4623 µs 2.4751 µs]
Found 14 outliers among 100 measurements (14.00%)
  4 (4.00%) low mild
  7 (7.00%) high mild
  3 (3.00%) high severe
spsc channel send only/minitrace/100
                        time:   [2.4902 µs 2.4993 µs 2.5084 µs]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
spsc channel send only/minitrace-legacy/100
                        time:   [2.6095 µs 2.6200 µs 2.6323 µs]
Found 13 outliers among 100 measurements (13.00%)
  6 (6.00%) high mild
  7 (7.00%) high severe
spsc channel send only/crossbeam/1000
                        time:   [5.6602 µs 5.6850 µs 5.7114 µs]
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe
spsc channel send only/ringbuffer/1000
                        time:   [3.1930 µs 3.1991 µs 3.2062 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
spsc channel send only/minitrace/1000
                        time:   [3.9981 µs 4.0142 µs 4.0321 µs]
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
spsc channel send only/minitrace-legacy/1000
                        time:   [5.3636 µs 5.3857 µs 5.4111 µs]
Found 9 outliers among 100 measurements (9.00%)
  8 (8.00%) high mild
  1 (1.00%) high severe
spsc channel send only/crossbeam/10000
                        time:   [35.152 µs 35.220 µs 35.295 µs]
Found 12 outliers among 100 measurements (12.00%)
  3 (3.00%) high mild
  9 (9.00%) high severe
spsc channel send only/ringbuffer/10000
                        time:   [10.821 µs 10.867 µs 10.916 µs]
Found 9 outliers among 100 measurements (9.00%)
  8 (8.00%) high mild
  1 (1.00%) high severe
spsc channel send only/minitrace/10000
                        time:   [18.879 µs 18.960 µs 19.060 µs]
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
spsc channel send only/minitrace-legacy/10000
                        time:   [32.857 µs 32.909 µs 32.960 µs]
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) low mild
  2 (2.00%) high mild

     Running benches/trace.rs (target/release/deps/trace-f3cf9d355a8dd735)
Gnuplot not found, using plotters backend
trace_wide_raw/1        time:   [6.8527 µs 6.8810 µs 6.9124 µs]
Found 6 outliers among 100 measurements (6.00%)
  6 (6.00%) high mild
trace_wide_raw/10       time:   [47.941 µs 48.158 µs 48.396 µs]
Found 12 outliers among 100 measurements (12.00%)
  3 (3.00%) low mild
  3 (3.00%) high mild
  6 (6.00%) high severe
trace_wide_raw/100      time:   [454.32 µs 455.83 µs 457.45 µs]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
trace_wide_raw/1000     time:   [4.5613 ms 4.5758 ms 4.5913 ms]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
trace_wide_raw/10000    time:   [46.417 ms 46.560 ms 46.715 ms]
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe

trace_wide/1            time:   [7.0159 µs 7.0527 µs 7.0920 µs]
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) low mild
  5 (5.00%) high mild
  1 (1.00%) high severe
trace_wide/10           time:   [48.297 µs 48.577 µs 48.853 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
trace_wide/100          time:   [457.97 µs 459.65 µs 461.45 µs]
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
trace_wide/1000         time:   [4.5952 ms 4.6177 ms 4.6411 ms]
trace_wide/10000        time:   [46.449 ms 46.679 ms 46.923 ms]
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild

trace_deep_raw/1        time:   [6.9301 µs 6.9833 µs 7.0356 µs]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
trace_deep_raw/10       time:   [47.949 µs 48.231 µs 48.514 µs]
Found 15 outliers among 100 measurements (15.00%)
  11 (11.00%) high mild
  4 (4.00%) high severe
trace_deep_raw/100      time:   [460.49 µs 462.08 µs 463.85 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
trace_deep_raw/1000     time:   [4.6269 ms 4.6557 ms 4.6877 ms]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe

trace_deep/1            time:   [11.591 µs 11.648 µs 11.710 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
trace_deep/10           time:   [47.437 µs 47.562 µs 47.722 µs]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
trace_deep/100          time:   [469.63 µs 472.45 µs 475.27 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
trace_deep/1000         time:   [4.5655 ms 4.5811 ms 4.5983 ms]
Found 13 outliers among 100 measurements (13.00%)
  9 (9.00%) high mild
  4 (4.00%) high severe

trace_future/1          time:   [6.9709 µs 7.0134 µs 7.0586 µs]
trace_future/10         time:   [47.765 µs 47.991 µs 48.246 µs]
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
trace_future/100        time:   [460.68 µs 464.18 µs 468.02 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
trace_future/1000       time:   [4.5754 ms 4.5922 ms 4.6099 ms]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
trace_future/10000      time:   [46.621 ms 46.827 ms 47.046 ms]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

     Running unittests src/lib.rs (target/release/deps/minitrace_datadog-d5e9d76c2f46efd8)

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

4 participants