-
Notifications
You must be signed in to change notification settings - Fork 4.1k
kvserver: replace circuit breaker cancel goroutine with per-Replica registry #74707
Copy link
Copy link
Closed
Closed
Copy link
Labels
C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Description
Touches #33007.
As of #71806, replica circuit breakers default to off since they use a simple
but inefficient mechanism to fail-fast requests that are inflight while the
breaker trips.
We want to improve on that by adding a registry of the cancel functions on Replica
and by letting the probe cancel everyone. This saves one goroutine per request and
should have a small perf impact once suitably optimized.
Prerequisite for #74705.
Describe the solution you'd like
type Replica struct {
// ...
breakerCancelsMu {
syncutil.Mutex
sl []func()
}
}
func (r *Replica) sendWithRangeID(...) {
ctx, cancel := ...
r.breakerCancelsMu.Lock()
r.breakerCancelsMu.sl = append(..., cancel)
r.breakerCancelsMu.Unlock()
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)