* [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option
@ 2025-04-04 13:07 Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by " Christian Ebner
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christian Ebner @ 2025-04-04 13:07 UTC (permalink / raw)
To: pbs-devel
Allows to adjust the capacity for the LRU cache used to keep track of
recently touched chunks during phase 1 of garbage collection.
Values are provided as multiples of 1024 cache entries, the default
value of 1024 * 1024 was chosen as tradeoff between runtime
improvements and memory usage [0]. The maximum of 8192 * 1024 was
chosen based on the linear regression from [1], resulting in about
8 * 80 MiB = 640 MiB of memory requirement, while allowing to keep
chunks which can reference about 32 TiB of data in case of 4 MiB
fixed size chunks.
[0] https://git.proxmox.com/?p=proxmox-backup.git;a=commit;h=03143eee0a59cf319be0052e139f7e20e124d572
[1] https://lore.proxmox.com/pbs-devel/fa3800dd-e812-4c9a-9d3d-2d8673e05355@proxmox.com/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- use raw value for cache capacity, not multiples of 1024
pbs-api-types/src/datastore.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index ddd8d3c6..020d8aa7 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -223,12 +223,23 @@ pub enum DatastoreFSyncLevel {
Filesystem,
}
+pub const GC_CACHE_CAPACITY_SCHEMA: Schema =
+ IntegerSchema::new("Garbage collection chunk digest cache capacity")
+ .minimum(0)
+ .maximum(8192 * 1024)
+ .default(1024 * 1024)
+ .schema();
+
#[api(
properties: {
"chunk-order": {
type: ChunkOrder,
optional: true,
},
+ "gc-cache-capacity": {
+ schema: GC_CACHE_CAPACITY_SCHEMA,
+ optional: true,
+ },
},
)]
#[derive(Serialize, Deserialize, Default)]
@@ -240,6 +251,8 @@ pub struct DatastoreTuning {
pub chunk_order: Option<ChunkOrder>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_level: Option<DatastoreFSyncLevel>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub gc_cache_capacity: Option<usize>,
}
pub const DATASTORE_TUNING_STRING_SCHEMA: Schema = StringSchema::new("Datastore tuning options")
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH v2 proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by tuning option
2025-04-04 13:07 [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Christian Ebner
@ 2025-04-04 13:07 ` Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 3/4] ui: expose GC cache capacity in datastore tuning parameters Christian Ebner
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christian Ebner @ 2025-04-04 13:07 UTC (permalink / raw)
To: pbs-devel
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>
---
changes since version 1:
- use raw value for cache capacity, not multiples of 1024
- adapt log message accordingly
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 8719c2cdb..95fabea3f 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 chunk digest cache capacity of {capacity}.");
+ capacity
+ } 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH v2 proxmox-backup 3/4] ui: expose GC cache capacity in datastore tuning parameters.
2025-04-04 13:07 [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by " Christian Ebner
@ 2025-04-04 13:07 ` Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 4/4] docs: add description for gc-cache-capacity tuning parameter Christian Ebner
2025-04-05 17:30 ` [pbs-devel] applied-series: [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Christian Ebner @ 2025-04-04 13:07 UTC (permalink / raw)
To: pbs-devel
Displays and allows to edit the configured LRU cache capacity via the
datastore tuning parameters.
A step of 1024 is used in the number field for convenience when using
the buttons, more fine grained values can be set by typing.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- use raw value for cache capacity, not multiples of 1024
- drop qtip as it is now redundant
www/Utils.js | 4 ++++
www/datastore/OptionView.js | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/www/Utils.js b/www/Utils.js
index 2746ef0b5..1572f6e56 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -846,6 +846,10 @@ Ext.define('PBS.Utils', {
sync = PBS.Utils.tuningOptions['sync-level'][sync ?? '__default__'];
options.push(`${gettext('Sync Level')}: ${sync}`);
+ let gc_cache_capacity = tuning['gc-cache-capacity'];
+ delete tuning['gc-cache-capacity'];
+ options.push(`${gettext('GC cache capacity')}: ${gc_cache_capacity ?? Proxmox.Utils.defaultText}`);
+
for (const [k, v] of Object.entries(tuning)) {
options.push(`${k}: ${v}`);
}
diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js
index e1f38af6f..1c001bbac 100644
--- a/www/datastore/OptionView.js
+++ b/www/datastore/OptionView.js
@@ -271,6 +271,16 @@ Ext.define('PBS.Datastore.Options', {
deleteEmpty: true,
value: '__default__',
},
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'gc-cache-capacity',
+ fieldLabel: gettext('GC cache capacity'),
+ emptyText: Proxmox.Utils.defaultText,
+ minValue: 0,
+ maxValue: 8388608,
+ deleteEmpty: true,
+ step: 1024,
+ },
],
},
},
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH v2 proxmox-backup 4/4] docs: add description for gc-cache-capacity tuning parameter
2025-04-04 13:07 [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by " Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 3/4] ui: expose GC cache capacity in datastore tuning parameters Christian Ebner
@ 2025-04-04 13:07 ` Christian Ebner
2025-04-05 17:30 ` [pbs-devel] applied-series: [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Christian Ebner @ 2025-04-04 13:07 UTC (permalink / raw)
To: pbs-devel
Adds a bullet point to the listed datastore tuning parameters,
describing its functionality, implications and typical values.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- drop mentions of multiples of 1024, as raw values are used now
docs/storage.rst | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/docs/storage.rst b/docs/storage.rst
index 490302955..c69df8b26 100644
--- a/docs/storage.rst
+++ b/docs/storage.rst
@@ -435,9 +435,16 @@ There are some tuning related options for the datastore that are more advanced:
This can be set with:
-.. code-block:: console
+ .. code-block:: console
+
+ # proxmox-backup-manager datastore update <storename> --tuning 'sync-level=filesystem'
- # proxmox-backup-manager datastore update <storename> --tuning 'sync-level=filesystem'
+* ``gc-cache-capacity``: Datastore GC least recently used cache capacity:
+ Allows to control the cache capacity used to keep track of chunks for which
+ the access time has already been updated during phase 1 of garbage collection.
+ This avoids multiple updates and increases GC runtime performance. Higher
+ values can reduce GC runtime at the cost of increase memory usage, setting the
+ value to 0 disables caching.
If you want to set multiple tuning options simultaneously, you can separate them
with a comma, like this:
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] applied-series: [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option
2025-04-04 13:07 [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Christian Ebner
` (2 preceding siblings ...)
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 4/4] docs: add description for gc-cache-capacity tuning parameter Christian Ebner
@ 2025-04-05 17:30 ` Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2025-04-05 17:30 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Christian Ebner
Am 04.04.25 um 15:07 schrieb Christian Ebner:
> Allows to adjust the capacity for the LRU cache used to keep track of
> recently touched chunks during phase 1 of garbage collection.
>
> Values are provided as multiples of 1024 cache entries, the default
> value of 1024 * 1024 was chosen as tradeoff between runtime
> improvements and memory usage [0]. The maximum of 8192 * 1024 was
> chosen based on the linear regression from [1], resulting in about
> 8 * 80 MiB = 640 MiB of memory requirement, while allowing to keep
> chunks which can reference about 32 TiB of data in case of 4 MiB
> fixed size chunks.
>
> [0] https://git.proxmox.com/?p=proxmox-backup.git;a=commit;h=03143eee0a59cf319be0052e139f7e20e124d572
> [1] https://lore.proxmox.com/pbs-devel/fa3800dd-e812-4c9a-9d3d-2d8673e05355@proxmox.com/
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> changes since version 1:
> - use raw value for cache capacity, not multiples of 1024
>
> pbs-api-types/src/datastore.rs | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
>
applied, resolved merge conflict from the GC atime series, thanks!
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-05 17:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-04 13:07 [pbs-devel] [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 2/4] garbage collection: set phase1 LRU cache capacity by " Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 3/4] ui: expose GC cache capacity in datastore tuning parameters Christian Ebner
2025-04-04 13:07 ` [pbs-devel] [PATCH v2 proxmox-backup 4/4] docs: add description for gc-cache-capacity tuning parameter Christian Ebner
2025-04-05 17:30 ` [pbs-devel] applied-series: [PATCH v2 proxmox] pbs api types: add garbage collection cache capacity tuning option Thomas Lamprecht
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