Skip to content

Commit

Permalink
Merge pull request #345 from Danil-Grigorev/leader-elect-slow-down
Browse files Browse the repository at this point in the history
BUG 1858400: [Performance] Lease refresh period for machine-api-controllers is too high, causes heavy writes to etcd at idle
  • Loading branch information
openshift-merge-robot authored Aug 24, 2020
2 parents e3a8dfc + 7ccf749 commit fbec5ac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
)

// The default durations for the leader electrion operations.
var (
leaseDuration = 120 * time.Second
renewDealine = 110 * time.Second
retryPeriod = 20 * time.Second
)

func main() {
printVersion := flag.Bool(
"version",
Expand Down Expand Up @@ -70,7 +77,7 @@ func main() {

leaderElectLeaseDuration := flag.Duration(
"leader-elect-lease-duration",
90*time.Second,
leaseDuration,
"The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled.",
)

Expand Down Expand Up @@ -105,6 +112,9 @@ func main() {
HealthProbeBindAddress: *healthAddr,
SyncPeriod: &syncPeriod,
MetricsBindAddress: *metricsAddress,
// Slow the default retry and renew election rate to reduce etcd writes at idle: BZ 1858400
RetryPeriod: &retryPeriod,
RenewDeadline: &renewDealine,
}

if *watchNamespace != "" {
Expand Down

0 comments on commit fbec5ac

Please sign in to comment.