Skip to content

feat: concurrent storage put #1304

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

Merged
merged 11 commits into from
Aug 30, 2022
Merged

feat: concurrent storage put #1304

merged 11 commits into from
Aug 30, 2022

Conversation

kolesnikovae
Copy link
Collaborator

@kolesnikovae kolesnikovae commented Jul 25, 2022

  • Make storage.Put to work concurrently
  • Make sure cache GetOrCreate is thread-safe
  • Add storage queue params
  • Document new params
  • Build tags for long ad-hoc tests – It may make sense to introduce a build tag for long tests (ad-hoc). As for now I adjusted the stress test so that it would run <1m.
  • Check if RW mutexes are good in out case – Experiments don't show improvements (See sync: RWMutex scales poorly with CPU count golang/go#17973)

The change introduces two configuration options for the storage queue:

  • storage-queue-workers
  • storage-queue-size

On migration, especially if the deployment is large, storage throughput will potentially increase significantly, as there will be less dropped profiles, which poses some risks. We can set default parameters so that effectively writes happen serially (just one worker) to workaround this.

We decided to disable concurrent writes by default, so that the change does not affect existing deployments on update. However, users still may tweak parameters if required.

/cc @petethepig

@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2022

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
webapp/public/assets/app.js 418.12 KB (0%) 8.4 s (0%) 3.3 s (+18.72% 🔺) 11.7 s
webapp/public/assets/app.css 15.4 KB (0%) 308 ms (0%) 0 ms (+100% 🔺) 308 ms
webapp/public/assets/styles.css 9.46 KB (0%) 190 ms (0%) 0 ms (+100% 🔺) 190 ms
packages/pyroscope-flamegraph/dist/index.js 91.63 KB (0%) 1.9 s (0%) 1.7 s (+43.1% 🔺) 3.5 s
packages/pyroscope-flamegraph/dist/index.node.js 91.46 KB (0%) 1.9 s (0%) 529 ms (-4.77% 🔽) 2.4 s
packages/pyroscope-flamegraph/dist/index.css 7.05 KB (0%) 141 ms (0%) 0 ms (+100% 🔺) 141 ms

@codecov
Copy link

codecov bot commented Jul 25, 2022

Codecov Report

Merging #1304 (9e6aa9c) into main (1269f20) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1304   +/-   ##
=======================================
  Coverage   68.51%   68.51%           
=======================================
  Files         129      129           
  Lines        4248     4248           
  Branches     1138     1138           
=======================================
  Hits         2910     2910           
  Misses       1333     1333           
  Partials        5        5           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@kolesnikovae kolesnikovae force-pushed the feat/cuncurrent_writes branch from 3b4b0c2 to 2bdaba9 Compare July 25, 2022 14:15
@kolesnikovae kolesnikovae force-pushed the feat/cuncurrent_writes branch from 2bdaba9 to f80f87d Compare July 25, 2022 14:17
@kolesnikovae kolesnikovae marked this pull request as ready for review July 25, 2022 14:48
@kolesnikovae kolesnikovae requested a review from petethepig July 25, 2022 14:49
@kolesnikovae
Copy link
Collaborator Author

@petethepig I have updated the PR so that it won't affect existing deployments: storage queue will have one worker by default, thus effectively doing writes synchronously. Please, give it a look

@petethepig petethepig merged commit ec5f8b6 into main Aug 30, 2022
@petethepig petethepig deleted the feat/cuncurrent_writes branch August 30, 2022 10:10
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.

2 participants