consul: Add RPCHoldTimeout as tunable hold period

This commit is contained in:
Armon Dadgar 2016-07-10 13:23:43 -04:00
parent 64e3033d3c
commit 26ca78936c
1 changed files with 10 additions and 0 deletions

View File

@ -224,6 +224,13 @@ type Config struct {
// are willing to apply in one period. After this limit we will issue a // are willing to apply in one period. After this limit we will issue a
// warning and discard the remaining updates. // warning and discard the remaining updates.
CoordinateUpdateMaxBatches int CoordinateUpdateMaxBatches int
// RPCHoldTimeout is how long an RPC can be "held" before it is errored.
// This is used to paper over a loss of leadership by instead holding RPCs,
// so that the caller experiences a slow response rather than an error.
// This period is meant to be long enough for a leader election to take
// place, and a small jitter is applied to avoid a thundering herd.
RPCHoldTimeout time.Duration
} }
// CheckVersion is used to check if the ProtocolVersion is valid // CheckVersion is used to check if the ProtocolVersion is valid
@ -286,6 +293,9 @@ func DefaultConfig() *Config {
CoordinateUpdatePeriod: 5 * time.Second, CoordinateUpdatePeriod: 5 * time.Second,
CoordinateUpdateBatchSize: 128, CoordinateUpdateBatchSize: 128,
CoordinateUpdateMaxBatches: 5, CoordinateUpdateMaxBatches: 5,
// Hold an RPC for up to 5 seconds by default
RPCHoldTimeout: 5 * time.Second,
} }
// Increase our reap interval to 3 days instead of 24h. // Increase our reap interval to 3 days instead of 24h.