From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by tuning option
Date: Thu, 3 Apr 2025 14:27:30 +0200 [thread overview]
Message-ID: <20250403122732.369087-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250403122732.369087-1-c.ebner@proxmox.com>
Allow to control the capacity of the cache used to track recently
touched chunks via the configured value in the datastore tuning
options. Log the configured value to the task log, if an explicit
value is set, allowing the user to confirm the setting and debug.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
pbs-datastore/src/datastore.rs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 008449e51..aa9a033b4 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1113,6 +1113,7 @@ impl DataStore {
&self,
status: &mut GarbageCollectionStatus,
worker: &dyn WorkerTaskContext,
+ cache_capacity: usize,
) -> Result<(), Error> {
// Iterate twice over the datastore to fetch index files, even if this comes with an
// additional runtime cost:
@@ -1128,7 +1129,7 @@ impl DataStore {
let mut unprocessed_index_list = self.list_index_files()?;
let index_count = unprocessed_index_list.len();
- let mut chunk_lru_cache = LruCache::new(1024 * 1024);
+ let mut chunk_lru_cache = LruCache::new(cache_capacity);
let mut processed_index_files = 0;
let mut last_percentage: usize = 0;
@@ -1237,9 +1238,20 @@ impl DataStore {
..Default::default()
};
+ let tuning: DatastoreTuning = serde_json::from_value(
+ DatastoreTuning::API_SCHEMA
+ .parse_property_string(gc_store_config.tuning.as_deref().unwrap_or(""))?,
+ )?;
+ let gc_cache_capacity = if let Some(capacity) = tuning.gc_cache_capacity {
+ info!("Using cache capacity of {capacity} (multiples of 1024 chunk digests).");
+ capacity * 1024
+ } else {
+ 1024 * 1024
+ };
+
info!("Start GC phase1 (mark used chunks)");
- self.mark_used_chunks(&mut gc_status, worker)
+ self.mark_used_chunks(&mut gc_status, worker, gc_cache_capacity)
.context("marking used chunks failed")?;
info!("Start GC phase2 (sweep unused chunks)");
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-04-03 12:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 12:27 [pbs-devel] [PATCH proxmox] pbs api types: add garbage collection cache capacity " Christian Ebner
2025-04-03 12:27 ` Christian Ebner [this message]
2025-04-03 12:27 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: expose GC cache capacity in datastore tuning parameters Christian Ebner
2025-04-03 12:27 ` [pbs-devel] [PATCH proxmox-backup 4/4] docs: add description for gc-cache-capacity tuning parameter Christian Ebner
2025-04-04 11:58 ` Lukas Wagner
2025-04-04 12:13 ` Christian Ebner
2025-04-04 12:20 ` Thomas Lamprecht
2025-04-04 12:28 ` Lukas Wagner
2025-04-04 12:37 ` Christian Ebner
2025-04-04 11:59 ` [pbs-devel] [PATCH proxmox] pbs api types: add garbage collection cache capacity tuning option Lukas Wagner
2025-04-04 13:08 ` [pbs-devel] superseded: " Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250403122732.369087-2-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal