[pbs-devel] [PATCH proxmox-backup-qemu 3/3] access: use bigger cache and LRU chunk reader

Stefan Reiter s.reiter at proxmox.com
Wed Apr 28 18:06:55 CEST 2021


Values chosen by fair dice roll, seems to be a good sweet spot on my
machine where any less causes performance degradation but any more
doesn't really make it go any faster.

Keep in mind that those values are per drive in an actual restore, but
also allocated via mmap on a disk-backed path, so can be swapped out of
memory easily.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 src/restore.rs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/restore.rs b/src/restore.rs
index 0790d7f..b43c383 100644
--- a/src/restore.rs
+++ b/src/restore.rs
@@ -218,16 +218,21 @@ impl RestoreTask {
 
         let index = client.download_fixed_index(&manifest, &archive_name).await?;
         let archive_size = index.index_bytes();
-        let most_used = index.find_most_used_chunks(8);
+        let most_used = index.find_most_used_chunks(16); // 64 MB most used cache
 
         let file_info = manifest.lookup_file_info(&archive_name)?;
 
-        let chunk_reader = RemoteChunkReader::new(
+        let chunk_reader = RemoteChunkReader::new_lru_cached(
             Arc::clone(&client),
             self.crypt_config.clone(),
             file_info.chunk_crypt_mode(),
             most_used,
-        );
+            64, // 256 MB LRU cache
+            index
+                .chunk_info(0)
+                .map(|info| info.size() as usize)
+                .unwrap_or(4 * 1024 * 1024),
+        )?;
 
         let reader = AsyncIndexReader::new(index, chunk_reader);
 
-- 
2.20.1






More information about the pbs-devel mailing list