Skip to content

Conversation

joe-redpanda
Copy link
Contributor

The goal of this PR is to add limits on the maximum number of local snapshots that may be loaded at a given time to a configurable value.

This is accomplished by adding a new configuration value for this, alongside a theadlocal static semaphore to persisted_stm which will gate local snapshot loads.

There are additionally some boundary check fixes for adjustable_semaphore.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.2.x
  • v25.1.x
  • v24.3.x

Release Notes

Seastar's underlying semaphore backs its count with ssize_t, but allows
initialization from size_t. A naiive default for "unlimited capacity"
would be size_t::max.

This commit adds a limit check to adjustable_semaphore to ensure this
signed integer is not overflowed
adds raft_max_load_local_snapshots_per_shard to configuration. This
parameter will allow a user to limit the number of snapshots that can be
loaded from disk concurrently per shard.

This parameters is bounded between [1, uint32_t::max()]
This commit implements the limiting of the loading of snapshots per
shard by adding a threadlocal static semaphore which will track the
numeber of in-flight snapshot load operations against the configured
limit.

Configuration will be applied at the beginning of each snapshot load.
@joe-redpanda
Copy link
Contributor Author

This is a draft for the moment while I figure out how to test this.

@@ -514,6 +514,14 @@ configuration::configuration()
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
0,
{.min = 0, .max = 100_MiB})
, raft_max_load_local_snapshots_per_shard(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a "maximum recoveries per shard" config

Are we double dipping on our configuration options?

@@ -514,6 +514,14 @@ configuration::configuration()
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
0,
{.min = 0, .max = 100_MiB})
, raft_max_load_local_snapshots_per_shard(
*this,
"raft_max_load_local_snapshots_per_shard",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix description

@joe-redpanda
Copy link
Contributor Author

/dt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant