Skip to content

Commit

Permalink
config: added a property controlling max size of readers cache
Browse files Browse the repository at this point in the history
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 <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Mar 7, 2024
1 parent 4278057 commit 4399ba4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/v/config/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/v/config/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct configuration final : public config_store {
bounded_property<uint16_t> log_segment_size_jitter_percent;
bounded_property<uint64_t> compacted_log_segment_size;
property<std::chrono::milliseconds> readers_cache_eviction_timeout_ms;
bounded_property<size_t> readers_cache_target_max_size;

bounded_property<std::optional<std::chrono::milliseconds>> log_segment_ms;
bounded_property<std::chrono::milliseconds> log_segment_ms_min;
bounded_property<std::chrono::milliseconds> log_segment_ms_max;
Expand Down

0 comments on commit 4399ba4

Please sign in to comment.