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

dump: Parallelize loading large files #4796

Merged
merged 5 commits into from
May 14, 2024

Conversation

MichaelEischer
Copy link
Member

@MichaelEischer MichaelEischer commented May 5, 2024

What does this PR change? What problem does it solve?

Improve dump performance for large files by loading their blobs concurrently using repo.Connections() goroutines.

The largest part of the code changes in here is actually a modification of the bloblru cache. There's now a new GetOrCompute method that ensures that if multiple goroutines try to get the same blob that is not yet in the cache, that the blob will only be downloaded once.

I've initially tried to use a sync.Pool to reuse byte slices, however, that turned out to be rather complicated to get right when using the bloblru cache. A byte slice may only be reused if no other goroutine can have a reference to it. With the current interface this is next to impossible to guarantee.

Was the change previously discussed in an issue or on the forum?

Basic variant as discussed in #3406 .

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • [ ] I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@MichaelEischer MichaelEischer mentioned this pull request May 5, 2024
8 tasks
Copy link
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

LGTM

@MichaelEischer MichaelEischer merged commit 7ed560a into restic:master May 14, 2024
13 checks passed
@MichaelEischer MichaelEischer deleted the parallel-dump-load branch May 14, 2024 20:35
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

1 participant