From 6b8d5df00c5eddf9c247f5e69a3b2d626470f5cb Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Mon, 28 Feb 2022 18:42:51 -0800 Subject: [PATCH] DOSE-1093 [Backport of DOSE-1092 to 6.0.13.0] object cache size should be tunable (#260) Default value remains 100, but this will allow easily increasing it for testing. --- cmd/zfs_object_agent/zettaobject/src/object_access.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zfs_object_agent/zettaobject/src/object_access.rs b/cmd/zfs_object_agent/zettaobject/src/object_access.rs index 1347da0eaf8e..c91c27618e2b 100644 --- a/cmd/zfs_object_agent/zettaobject/src/object_access.rs +++ b/cmd/zfs_object_agent/zettaobject/src/object_access.rs @@ -40,7 +40,7 @@ struct ObjectCache { lazy_static! { static ref CACHE: std::sync::Mutex = std::sync::Mutex::new(ObjectCache { - cache: LruCache::new(100), + cache: LruCache::new(*OBJECT_CACHE_SIZE), reading: HashMap::new(), }); static ref NON_RETRYABLE_ERRORS: Vec = vec![ @@ -58,6 +58,7 @@ lazy_static! { pub static ref OBJECT_CACHE_IS_BYPASSABLE: bool = get_tunable("object_cache_is_bypassable", false); pub static ref OBJECT_QUEUE_DEPTH_PER_TYPE: usize = get_tunable("object_queue_depth_per_type", 100); pub static ref PER_REQUEST_TIMEOUT: Duration = Duration::from_secs(get_tunable("per_request_timeout_secs", 2)); + static ref OBJECT_CACHE_SIZE: usize = get_tunable("object_cache_size", 100); } #[derive(Debug, Enum, Copy, Clone)]