-
Notifications
You must be signed in to change notification settings - Fork 80
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
Unreasonably high memory consumption during restore #1067
Comments
Thanks for opening this issue @buengese |
Here the base output.
Additionally this is from the log file at info logging level tough it doesn't seem to contain any particularly useful info.
OOM message from the Kernel log:
Worth noting that this an lxc container so cgroups are involved. Why I don't think that should cause any weird behaviour it is something worth keeping in mind. |
Ok, trying to investigate what could use that much memory during the actual restore... Can you please give some further information:
Thanks a lot! |
Actually you have a (data) pack size of around 500 MiB - the rustic "standard" would be around 100MiB for your repository size. Thanks for the memory profiling. Yes, it seems the following is happening:
IIRC restic uses a streaming approach which of course doesn't need the "pack" space in memory.. I'll think about what we can improve here. But this might need an enhancement how rustic talks to the backend and maybe also needs to wait until we tackle concurrency in a right way... In meanwhile I can only suggest to you to decrease restore concurrency by self-compiling rustic after setting https://github.com/rustic-rs/rustic_core/blob/5ccf12c71fd6730e78f2679ea18c0e5be7cd84e4/crates/core/src/commands/restore.rs#L35 to a lower value. Sorry. |
An alternative would be to use lower packsizes. (but I don't know if you want to do this)
|
Yeah that makes perfect sense to me. Thank you for looking into this. That being said I think concurrency of 20 might just be to high of a default given the current approach that reads all data into memory. I know the default pack size for both restic and rustic is much lower but there are reasons (specifically limits regarding the maximum number of files per directory implemented by a number of cloud storage providers) to increase it. Maybe it would be possible to limit concurrency based on pack size for now. |
Actually we could limit the amount of data which is read from the backend at once, e.g. to something like 32MiB or 64MiB. That would not decrease performance (IMO) and keep memory usage for pack file data below MAX_READER_THREADS_NUM * LIMIT. |
Another optimization would be to remove index entries from memory just before starting the actual restore (all information for the restore is already contained in the restore plan) That would in your case remove most of the 1.2 GiB during the actual restore. Combined with a limit as written above I think memory usage would drop below 1.5 GiB. |
That does sound like an even better plan. |
@buengese Can you try if rustic-rs/rustic_core#165 works for you? The memory usage with that PR should be roughly 2GiB in your case.. |
Sorry for missing to answer here but I can confirm that works. |
reduce memory usage of the `restore` command by removing the data entries from the index before doing the actual restore. see #1067 TODO: - [x] remove Cargo changes once rustic-rs/rustic_core#166 is merged
I've recently tried out rustic on one of my existing repositories and noticed an unreasonable high memory usage compared to restic with rustic being killed by the OOM killer at more than 12gb of ram consumption. Original restic uses less than 2gb of ram during the entire restore.
The command being run is:
rustic -r /path/to/repo restore 8c15dc1a .
Rustic version: 0.7.0
The repo in question is around 4.5TB in size and contains 14991 files.
Edit: I'm just noticing that this might be more a rustic_core kind of issue...
The text was updated successfully, but these errors were encountered: