mirror of https://github.com/status-im/consul.git
Adds a max raft multiplier and tweaks documentation.
This commit is contained in:
parent
2822334bce
commit
17b70c7efd
|
@ -942,6 +942,11 @@ func DecodeConfig(r io.Reader) (*Config, error) {
|
|||
result.AdvertiseAddrs.RPC = addr
|
||||
}
|
||||
|
||||
// Enforce the max Raft multiplier.
|
||||
if result.Performance.RaftMultiplier > consul.MaxRaftMultiplier {
|
||||
return nil, fmt.Errorf("Performance.RaftMultiplier must be <= %d", consul.MaxRaftMultiplier)
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -966,6 +966,12 @@ func TestDecodeConfig_Performance(t *testing.T) {
|
|||
if config.Performance.RaftMultiplier != 3 {
|
||||
t.Fatalf("bad: multiplier isn't set: %#v", config)
|
||||
}
|
||||
|
||||
input = `{"performance": { "raft_multiplier": 11 }}`
|
||||
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||
if err == nil || !strings.Contains(err.Error(), "Performance.RaftMultiplier must be <=") {
|
||||
t.Fatalf("bad: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeConfig_Services(t *testing.T) {
|
||||
|
|
|
@ -18,9 +18,14 @@ const (
|
|||
DefaultLANSerfPort = 8301
|
||||
DefaultWANSerfPort = 8302
|
||||
|
||||
// See docs/guides/performance.html for information on how this value
|
||||
// was obtained.
|
||||
// DefaultRaftMultiplier is used as a baseline Raft configuration that
|
||||
// will be reliable on a very basic server. See docs/guides/performance.html
|
||||
// for information on how this value was obtained.
|
||||
DefaultRaftMultiplier uint = 5
|
||||
|
||||
// MaxRaftMultiplier is a fairly arbitrary upper bound that limits the
|
||||
// amount of performance detuning that's possible.
|
||||
MaxRaftMultiplier uint = 10
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -581,18 +581,19 @@ Consul will not enable TLS for the HTTP API unless the `https` port has been ass
|
|||
Consul. See the [Server Performance](/docs/guides/performance.html) guide for more details. The
|
||||
following parameters are available:
|
||||
* <a name="raft_multiplier"></a><a href="#raft_multiplier">`raft_multiplier`</a> - An integer
|
||||
multiplier used by Consul servers to scale key Raft timing parameters. Tuning this affects
|
||||
the time it takes Consul to detect leader failures and to perform leader elections, at the
|
||||
expense of requiring more network and CPU resources for better performance.<br><br>A value
|
||||
of 0, the default, means that Consul will use a lower-performance timing that's suitable for
|
||||
[minimal Consul servers](/docs/guides/performance.html#minumum), currently equivalent to
|
||||
setting this to a value of 5 (this default may be changed in future versions of Consul,
|
||||
depending if the target minimum server profile changes). Above 0, higher values imply lower
|
||||
levels of performance. Setting this to a value of 1 will configure Raft to its
|
||||
highest-performance mode, equivalent to the default timing of Consul prior to 0.7, and is
|
||||
recommended for [production Consul servers](/docs/guides/performance.html#production). See
|
||||
the note on [last contact](/docs/guides/performance.html#last-contact) timing for more
|
||||
details on tuning this parameter.
|
||||
multiplier used by Consul servers to scale key Raft timing parameters. Omitting this value
|
||||
or setting it to 0 uses default timing described below. Lower values are used to tighten
|
||||
timing and increase sensitivity while higher values relax timings and reduce sensitivity.
|
||||
Tuning this affects the time it takes Consul to detect leader failures and to perform
|
||||
leader elections, at the expense of requiring more network and CPU resources for better
|
||||
performance.<br><br>By default, Consul will use a lower-performance timing that's suitable
|
||||
for [minimal Consul servers](/docs/guides/performance.html#minumum), currently equivalent
|
||||
to setting this to a value of 5 (this default may be changed in future versions of Consul,
|
||||
depending if the target minimum server profile changes). Setting this to a value of 1 will
|
||||
configure Raft to its highest-performance mode, equivalent to the default timing of Consul
|
||||
prior to 0.7, and is recommended for [production Consul servers](/docs/guides/performance.html#production).
|
||||
See the note on [last contact](/docs/guides/performance.html#last-contact) timing for more
|
||||
details on tuning this parameter. The maximum allowed value is 10.
|
||||
|
||||
* <a name="ports"></a><a href="#ports">`ports`</a> This is a nested object that allows setting
|
||||
the bind ports for the following keys:
|
||||
|
|
Loading…
Reference in New Issue