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

feat: Upload concurrency and backpressure control for shared cache #584

Merged
merged 10 commits into from
Nov 30, 2021

Conversation

flub
Copy link
Contributor

@flub flub commented Nov 26, 2021

  • Fixup tests
  • Atomic writes for filesystem
  • Move concurrency controls to config
  • Figure out sane defaults

@flub flub requested a review from a team November 26, 2021 17:53
flub and others added 4 commits November 27, 2021 14:10
Because store is not async and only sends a message the original
caller has no idea if it ever finishes.  This adds a oneshot channel
to send back a completion message.  It makes testing possible.

This also changes the tests to not return Result anymore, the errors
are still useless with them.  With .unwrap() the test failures at
least point to where the error came from.
We should be testing that we're not uploading to GCS twice.
Floris Bruynooghe added 2 commits November 29, 2021 14:22
Plus give them sensible defaults for our prod.  Config examples in the
tests.
@flub
Copy link
Contributor Author

flub commented Nov 29, 2021

PTAL, updated the config to allow setting concurrency control and queue size. Defaults based on some guesstimating of our prod infrastructure.

Copy link
Contributor

@relaxolotl relaxolotl left a comment

Choose a reason for hiding this comment

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

mostly nitpicky comments, but this otherwise looks good.

any general ideas on how much the upload worker would add to symbolicator's current resource consumption?

crates/symbolicator/src/cache.rs Outdated Show resolved Hide resolved
crates/symbolicator/src/cache.rs Outdated Show resolved Hide resolved
crates/symbolicator/src/services/shared_cache.rs Outdated Show resolved Hide resolved
Comment on lines +229 to +230
let temp_file = NamedTempFile::new_in(&temp_dir)?;
let dup_file = temp_file.reopen()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

i see that this pattern was also used in the original shared cache PR. what is the purpose of this? is it to convert NamedTempFile into a File?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to get a tokio::fs::File without re-opening from the path (which is unsafe) we need to get a duplicate filedescriptor which points to the same file. tokio::fs::File consumes the std::fs::File so the reference returned by NamedTempFile::as_file() is not sufficient and we actually need to dup the filedescriptor, the nicest way is to do NamedTempFile::reopen (it is also possible from std::fs::File::try_clone on the &File)

crates/symbolicator/src/cache.rs Show resolved Hide resolved
Floris Bruynooghe and others added 2 commits November 30, 2021 12:11
Co-authored-by: relaxolotl <5597345+relaxolotl@users.noreply.github.com>
@flub flub enabled auto-merge (squash) November 30, 2021 11:23
@flub flub merged commit c2ec40a into master Nov 30, 2021
@flub flub deleted the shared-cache/upload-concurrency branch November 30, 2021 11:27
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