From 4399ba422df04c1ac1cb2fc7fa4c5f9d352bda4d Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Mon, 4 Mar 2024 09:39:06 +0100 Subject: [PATCH] config: added a property controlling max size of readers cache Added property which allows controlling maximum number of readers kept in cache per ntp. The value was previously unbounded which may lead to a situation in which readers cache grew and caused out of memory error. Signed-off-by: Michal Maslanka --- src/v/config/configuration.cc | 9 +++++++++ src/v/config/configuration.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/v/config/configuration.cc b/src/v/config/configuration.cc index bfb95e5755479..9d8c55b597506 100644 --- a/src/v/config/configuration.cc +++ b/src/v/config/configuration.cc @@ -86,6 +86,15 @@ configuration::configuration() "Duration after which inactive readers will be evicted from cache", {.visibility = visibility::tunable}, 30s) + , readers_cache_target_max_size( + *this, + "readers_cache_target_max_size", + "Maximum desired number of readers cached per ntp. This a soft limit, a " + "number of readers in cache may temporary increase as cleanup is done in " + "background", + {.needs_restart = needs_restart::no, .visibility = visibility::tunable}, + 200, + {.min = 0, .max = 10000}) , log_segment_ms( *this, "log_segment_ms", diff --git a/src/v/config/configuration.h b/src/v/config/configuration.h index 8db5ea287d65b..7e4e21c2f1a0e 100644 --- a/src/v/config/configuration.h +++ b/src/v/config/configuration.h @@ -51,6 +51,8 @@ struct configuration final : public config_store { bounded_property log_segment_size_jitter_percent; bounded_property compacted_log_segment_size; property readers_cache_eviction_timeout_ms; + bounded_property readers_cache_target_max_size; + bounded_property> log_segment_ms; bounded_property log_segment_ms_min; bounded_property log_segment_ms_max;