From 7c0ae91d78bd830d114e1a9615b80cca7a1d677c Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 6 Dec 2016 16:43:08 -0800 Subject: [PATCH] Documentation: add more FAQ questions --- Documentation/faq.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Documentation/faq.md b/Documentation/faq.md index c3a2c7c50..e9e4794ac 100644 --- a/Documentation/faq.md +++ b/Documentation/faq.md @@ -8,10 +8,50 @@ `advertise-urls` specifies the addresses etcd clients or other etcd members should use to contact the etcd server. The advertise addresses must be reachable from the remote machines. Do not advertise addresses like `localhost` or `0.0.0.0` for a production setup since these addresses are unreachable from remote machines. +### Deployment + +#### Why an odd number of cluster members? + +An etcd cluster needs a majority of nodes, a quorum, to agree on updates to the cluster state. For a cluster with n members, quorum is (n/2)+1. For any odd-sized cluster, adding one node will always increase the number of nodes necessary for quorum. Although adding a node to an odd-sized cluster appears better since there are more machines, the fault tolerance is worse since exactly the same number of nodes may fail without losing quorum but there are more nodes that can fail. If the cluster is in a state where it can't tolerate any more failures, adding a node before removing nodes is dangerous because if the new node fails to register with the cluster (e.g., the address is misconfigured), quorum will be permanently lost. + +#### What is maximum cluster size? + +Theoretically, there is no hard limit. However, an etcd cluster probably should have no more than seven nodes. [Google Chubby lock service][chubby], similar to etcd and widely deployed within Google for many years, suggests running five nodes. A 5-member etcd cluster can tolerate two member failures, which is enough in most cases. Although larger clusters provide better fault tolerance, the write performance suffers because data must be replicated across more machines. + +#### What is failure tolerance? + +An etcd cluster operates so long as a member quorum can be established. If quorum is lost through transient network failures (e.g., partitions), etcd automatically and safely resumes once the network recovers and restores quorum; Raft enforces cluster consistency. For power loss, etcd persists the Raft log to disk; etcd replays the log to the point of failure and resumes cluster participation. For permanent hardware failure, the node may be removed from the cluster through [runtime reconfiguration][runtime reconfiguration]. + +It is recommended to have an odd number of members in a cluster. An odd-size cluster tolerates the same number of failures as an even-size cluster but with fewer nodes. The difference can be seen by comparing even and odd sized clusters: + +| Cluster Size | Majority | Failure Tolerance | +|:-:|:-:|:-:| +| 1 | 1 | 0 | +| 2 | 2 | 0 | +| 3 | 2 | 1 | +| 4 | 3 | 1 | +| 5 | 3 | 2 | +| 6 | 4 | 2 | +| 7 | 4 | 3 | +| 8 | 5 | 3 | +| 9 | 5 | 4 | + +Adding a member to bring the size of cluster up to an even number doesn't buy additional fault tolerance. Likewise, during a network partition, an odd number of members guarantees that there will always be a majority partition that can continue to operate and be the source of truth when the partition ends. + ### Operation #### How to backup a etcd cluster? etcdctl provides a `snapshot` command to create backups. See [backup] for more details. -[backup]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/recovery.md#snapshotting-the-keyspace \ No newline at end of file +### Performance + +#### How should I benchmark etcd? + +Try the [benchmark] tool. Current [benchmark results][benchmark-result] are available for comparison. + +[backup]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/recovery.md#snapshotting-the-keyspace +[chubby]: http://static.googleusercontent.com/media/research.google.com/en//archive/chubby-osdi06.pdf +[runtime reconfiguration]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/runtime-configuration.md +[benchmark]: https://github.com/coreos/etcd/tree/master/tools/benchmark +[benchmark-result]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/performance.md