Skip to content

Commit

Permalink
producer_state_mgr: limit number of evictions per tick
Browse files Browse the repository at this point in the history
.. to avoid reactor stalls.
  • Loading branch information
bharathv committed May 21, 2024
1 parent 79aa8db commit 8db9579
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/v/cluster/producer_state_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ void producer_state_manager::do_evict_excess_producers() {
}
vlog(clusterlog.debug, "producer eviction tick");
auto it = _lru_producers.begin();
while (it != _lru_producers.end() && can_evict_producer(*it)) {
// to avoid reactor stalls.
static constexpr auto max_evictions_per_tick = 10000;
int evicted_so_far = 0;
while (evicted_so_far++ < max_evictions_per_tick
&& it != _lru_producers.end() && can_evict_producer(*it)) {
auto it_copy = it;
++it;
auto& state = *it_copy;
Expand Down

0 comments on commit 8db9579

Please sign in to comment.