consul/website/pages/intro/vs/serf.mdx

56 lines
2.9 KiB
Plaintext
Raw Normal View History

2014-04-10 23:47:25 +00:00
---
2020-04-07 18:55:19 +00:00
layout: intro
page_title: Consul vs. Serf
sidebar_title: Serf
2020-04-07 18:55:19 +00:00
description: >-
Serf is a node discovery and orchestration tool and is the only tool discussed
so far that is built on an eventually-consistent gossip model with no
centralized servers. It provides a number of features, including group
membership, failure detection, event broadcasts, and a query mechanism.
However, Serf does not provide any high-level features such as service
discovery, health checking or key/value storage. Consul is a complete system
providing all of those features.
2014-04-10 23:47:25 +00:00
---
# Consul vs. Serf
2016-08-08 16:44:27 +00:00
[Serf](https://www.serf.io) is a node discovery and orchestration tool and is the only
tool discussed so far that is built on an eventually-consistent gossip model
2014-04-10 23:47:25 +00:00
with no centralized servers. It provides a number of features, including group
membership, failure detection, event broadcasts, and a query mechanism. However,
2014-04-10 23:47:25 +00:00
Serf does not provide any high-level features such as service discovery, health
checking or key/value storage. Consul is a complete system providing all of those
2020-04-06 20:27:35 +00:00
features.
2014-04-10 23:47:25 +00:00
2020-04-09 23:46:54 +00:00
The internal [gossip protocol](/docs/internals/gossip) used within Consul is in
fact powered by the Serf library: Consul leverages the membership and failure detection
features and builds upon them to add service discovery. By contrast, the discovery
feature of Serf is at a node level, while Consul provides a service and node level
abstraction.
2014-04-10 23:47:25 +00:00
The health checking provided by Serf is very low level and only indicates if the
agent is alive. Consul extends this to provide a rich health checking system
that handles liveness in addition to arbitrary host and service-level checks.
2014-04-10 23:47:25 +00:00
Health checks are integrated with a central catalog that operators can easily
query to gain insight into the cluster.
The membership provided by Serf is at a node level, while Consul focuses
on the service level abstraction, mapping single nodes to multiple services.
This can be simulated in Serf using tags, but it is much more limited and does
not provide useful query interfaces. Consul also makes use of a strongly-consistent
catalog while Serf is only eventually-consistent.
2014-04-10 23:47:25 +00:00
In addition to the service level abstraction and improved health checking,
Consul provides a key/value store and support for multiple datacenters.
Serf can run across the WAN but with degraded performance. Consul makes use
2020-04-09 23:46:54 +00:00
of [multiple gossip pools](/docs/internals/architecture) so that
2014-04-10 23:47:25 +00:00
the performance of Serf over a LAN can be retained while still using it over
a WAN for linking together multiple datacenters.
Consul is opinionated in its usage while Serf is a more flexible and
general purpose tool. In [CAP](https://en.wikipedia.org/wiki/CAP_theorem) terms,
Consul uses a CP architecture, favoring consistency over availability. Serf is an
AP system and sacrifices consistency for availability. This means Consul cannot
operate if the central servers cannot form a quorum while Serf will continue to
function under almost all circumstances.