fix: download without buffering volumes in RAM #92
Reference in New Issue
Block a user
Delete Branch "eCommons/backup-bot-two:fix-download-oom"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
backup downloaddumps every volume withsubprocess.run(capture_output=True)and keeps all dumps in memory at the same time before writing/tmp/backup.tar.gz. For apps with large volumes, this exhausts the host's RAM.This PR fixes the download function to fetch each path with
restic restoreinto a temp directory, pack it into a<volume>.tarfile, and compress everything into the final backup.tar.gz. By usingrestic restoreinstead of streamingrestic dump, memory usage stays low and it's also much faster: restore downloads with parallel workers, while dump fetches blobs sequentially. Measured against an S3 repo: restore ~22MiB/s vs dump ~0.8MiB/s.The final archive layout is unchanged. Verified by diffing old vs new output for the same snapshot: names, inner tar listings (permissions, sizes, mtimes) and extracted contents are identical.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.