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

Use Arc to store reference to LoggerProvider from Logger #1446

Closed
wants to merge 3 commits into from

Conversation

bIgBV
Copy link
Contributor

@bIgBV bIgBV commented Dec 18, 2023

Fixes #
Design discussion issue (if applicable) #1209

Changes

Switch from using a Weak reference to LoggerProvider from within the Logger to using an Arc.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Copy link

linux-foundation-easycla bot commented Dec 18, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@bIgBV
Copy link
Contributor Author

bIgBV commented Dec 18, 2023

I wanted to get draft PR out, but I still want to validate that the change doesn't cause any subtle breakage.

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f31c4dd) 60.8% compared to head (2ff86bd) 60.8%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1446   +/-   ##
=====================================
  Coverage   60.8%   60.8%           
=====================================
  Files        146     146           
  Lines      19230   19230           
=====================================
  Hits       11702   11702           
  Misses      7528    7528           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cijothomas
Copy link
Member

As discussed in the community meeting today, we'll first add test coverage, targeted towards shutdown scenarios to have more confidence in this. Also will try this for span as well, where the benefits are even higher.

@bIgBV
Copy link
Contributor Author

bIgBV commented Dec 30, 2023

Ran the stress tests on my WSL system and didn't get a huge boost:

On this branch:

Number of threads: 12
Throughput: 10,784,000 iterations/sec
Throughput: 10,968,400 iterations/sec
Throughput: 10,636,200 iterations/sec
Throughput: 10,826,800 iterations/sec
Throughput: 10,634,800 iterations/sec
Throughput: 10,761,200 iterations/sec
Throughput: 10,676,800 iterations/sec
Throughput: 10,725,600 iterations/sec
Throughput: 11,487,600 iterations/sec
Throughput: 11,224,600 iterations/sec
Throughput: 10,704,400 iterations/sec
Throughput: 10,658,600 iterations/sec
Throughput: 10,730,200 iterations/sec
Throughput: 11,040,200 iterations/sec
Throughput: 10,574,400 iterations/sec
Throughput: 10,751,400 iterations/sec
Throughput: 10,721,600 iterations/sec
Throughput: 10,847,800 iterations/sec
Throughput: 10,532,800 iterations/sec
Throughput: 10,906,000 iterations/sec
Throughput: 10,960,400 iterations/sec
Throughput: 11,012,400 iterations/sec
Throughput: 10,615,400 iterations/sec
Throughput: 10,689,400 iterations/sec
Throughput: 10,802,600 iterations/sec
Throughput: 10,684,000 iterations/sec
Throughput: 10,981,200 iterations/sec
Throughput: 10,748,800 iterations/sec
Throughput: 11,100,400 iterations/sec
Throughput: 10,765,000 iterations/sec
Throughput: 10,762,200 iterations/sec
Throughput: 10,770,200 iterations/sec
Throughput: 10,589,800 iterations/sec
Throughput: 10,953,200 iterations/sec
Throughput: 10,502,000 iterations/sec
Throughput: 10,806,400 iterations/sec
Throughput: 10,971,200 iterations/sec
Throughput: 10,783,200 iterations/sec
Throughput: 10,805,800 iterations/sec
Throughput: 10,761,200 iterations/sec
Throughput: 10,649,800 iterations/sec
Throughput: 10,718,600 iterations/sec
Throughput: 10,613,600 iterations/sec
Throughput: 10,501,600 iterations/sec
Throughput: 10,660,800 iterations/sec
Throughput: 10,661,000 iterations/sec
Throughput: 10,980,600 iterations/sec
Throughput: 10,955,800 iterations/sec
Throughput: 10,936,000 iterations/sec
Throughput: 10,927,600 iterations/sec

Avg: 10,797,272
Median: 10,761,700

On main:

Number of threads: 12
Throughput: 9,412,200 iterations/sec
Throughput: 8,960,600 iterations/sec
Throughput: 8,911,000 iterations/sec
Throughput: 8,826,800 iterations/sec
Throughput: 9,044,800 iterations/sec
Throughput: 9,105,000 iterations/sec
Throughput: 9,358,800 iterations/sec
Throughput: 9,207,400 iterations/sec
Throughput: 9,128,600 iterations/sec
Throughput: 9,042,000 iterations/sec
Throughput: 9,356,600 iterations/sec
Throughput: 9,074,600 iterations/sec
Throughput: 9,392,200 iterations/sec
Throughput: 9,186,400 iterations/sec
Throughput: 9,903,600 iterations/sec
Throughput: 9,424,800 iterations/sec
Throughput: 9,000,000 iterations/sec
Throughput: 9,317,200 iterations/sec
Throughput: 9,029,600 iterations/sec
Throughput: 9,364,800 iterations/sec
Throughput: 8,980,000 iterations/sec
Throughput: 9,043,600 iterations/sec
Throughput: 8,900,400 iterations/sec
Throughput: 9,235,800 iterations/sec
Throughput: 8,994,400 iterations/sec
Throughput: 9,101,800 iterations/sec
Throughput: 8,968,400 iterations/sec
Throughput: 9,124,600 iterations/sec
Throughput: 9,067,800 iterations/sec
Throughput: 8,962,800 iterations/sec
Throughput: 8,922,800 iterations/sec
Throughput: 8,915,000 iterations/sec
Throughput: 9,121,200 iterations/sec
Throughput: 8,973,400 iterations/sec
Throughput: 9,315,800 iterations/sec
Throughput: 9,107,600 iterations/sec
Throughput: 9,565,800 iterations/sec
Throughput: 9,081,800 iterations/sec
Throughput: 8,814,200 iterations/sec
Throughput: 8,894,800 iterations/sec
Throughput: 9,355,400 iterations/sec
Throughput: 9,143,000 iterations/sec
Throughput: 9,100,200 iterations/sec
Throughput: 9,227,800 iterations/sec
Throughput: 9,019,600 iterations/sec
Throughput: 9,529,800 iterations/sec
Throughput: 9,417,600 iterations/sec
Throughput: 8,983,600 iterations/sec
Throughput: 9,064,200 iterations/sec
Throughput: 9,095,400 iterations/sec
Throughput: 9,360,200 iterations/sec
Throughput: 8,971,400 iterations/sec
Throughput: 9,077,000 iterations/sec
Throughput: 9,086,400 iterations/sec
Throughput: 9,015,200 iterations/sec
Throughput: 9,390,600 iterations/sec
Throughput: 7,884,000 iterations/sec

Avg: 9,120,357.894
Median: 9,086,400

The interesting thing is, I ran smaller tests on my m2 macbook pro and the difference was much larger. I'll put those numbers up later today.

@bIgBV bIgBV marked this pull request as ready for review December 30, 2023 20:27
@bIgBV bIgBV requested a review from a team December 30, 2023 20:27
@TommyCpp TommyCpp mentioned this pull request Dec 30, 2023
4 tasks
@bIgBV
Copy link
Contributor Author

bIgBV commented Dec 31, 2023

From my m2 MBP

on the current branch:

Number of threads: 10
Throughput: 6,000,000 iterations/sec
Throughput: 6,033,000 iterations/sec
Throughput: 6,015,800 iterations/sec
Throughput: 6,009,400 iterations/sec
Throughput: 6,028,200 iterations/sec
Throughput: 6,013,400 iterations/sec
Throughput: 6,011,400 iterations/sec
Throughput: 5,993,200 iterations/sec
Throughput: 6,003,600 iterations/sec
Throughput: 5,994,000 iterations/sec
Throughput: 6,005,600 iterations/sec
Throughput: 5,977,000 iterations/sec
Throughput: 6,007,800 iterations/sec
Throughput: 6,015,600 iterations/sec

vs main

Number of threads: 10
Throughput: 3,491,000 iterations/sec
Throughput: 3,481,000 iterations/sec
Throughput: 3,494,200 iterations/sec
Throughput: 3,485,600 iterations/sec
Throughput: 3,511,600 iterations/sec
Throughput: 3,530,200 iterations/sec
Throughput: 3,520,600 iterations/sec
Throughput: 3,592,800 iterations/sec
Throughput: 3,540,400 iterations/sec
Throughput: 3,522,000 iterations/sec
Throughput: 3,724,400 iterations/sec
Throughput: 3,668,800 iterations/sec
Throughput: 3,526,800 iterations/sec
Throughput: 3,520,200 iterations/sec
Throughput: 3,648,200 iterations/sec
Throughput: 3,576,200 iterations/sec
Throughput: 3,646,600 iterations/sec
Throughput: 3,585,400 iterations/sec
Throughput: 3,541,800 iterations/sec
Throughput: 3,514,400 iterations/sec
Throughput: 3,520,600 iterations/sec
Throughput: 3,582,800 iterations/sec
Throughput: 3,574,200 iterations/sec

@bIgBV
Copy link
Contributor Author

bIgBV commented Dec 31, 2023

Looks like the git history is messed up, will fix it tomorrow.

@lalitb
Copy link
Member

lalitb commented Jan 4, 2024

Ran the stress tests on my WSL system and didn't get a huge boost:

@bIgBV It could be the compiler optimizations for Mac and WSL that we are seeing the difference. Can you confirm if you tested this in release mode:

<path-to-otel-rust>/stress$ cargo run --bin logs --release

@bIgBV
Copy link
Contributor Author

bIgBV commented Jan 9, 2024

@lalitb I can confirm that the stress test was done in release mode on both systems.

@bIgBV
Copy link
Contributor Author

bIgBV commented Jan 11, 2024

Closing this PR in favor of #1455

@bIgBV bIgBV closed this Jan 11, 2024
@bIgBV bIgBV deleted the bvoleti/use-arc-in-tracer branch January 11, 2024 02:39
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.

3 participants