we don't need consensus: all agreed?

28
We don’t need consensus: all agreed? [email protected] @tom_wilkie

Upload: weaveworks

Post on 13-Apr-2017

895 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: We don't need consensus: All agreed?

We don’t need consensus: all agreed?

[email protected]@tom_wilkie

Page 2: We don't need consensus: All agreed?
Page 3: We don't need consensus: All agreed?

μServices

Page 4: We don't need consensus: All agreed?

μServices

“In computing, microservices is a software architecture style in which complex applications are composed of small,

independent processes communicating with each other using language-agnostic APIs.”

https://en.wikipedia.org/wiki/Microservices

Page 5: We don't need consensus: All agreed?

ContainerizationMonoliths

Developer Freedom

Services & ReplicasDistributed Systems

Page 6: We don't need consensus: All agreed?

Infrastructure μServices

Page 7: We don't need consensus: All agreed?

Routing Service Discovery IP Address Management Load Balancing

Infrastructure Microservices

Page 8: We don't need consensus: All agreed?

Fallacies of distributed computing• The network is reliable. • Latency is zero. • Bandwidth is infinite. • The network is secure. • Topology doesn't

change.

• There is one administrator.

• Transport cost is zero. • The network is

homogeneous.

Bill Joy, Peter Deutsch et al., 20 years ago

Page 9: We don't need consensus: All agreed?
Page 10: We don't need consensus: All agreed?

Routing Service Disco IPAM Load Bal.

Flannel, libnetwork Consul, SkyDNS

Flannel, libnetwork bakersteet, SmartStack,

kubeproxy

Infrastructure Microservices

Page 11: We don't need consensus: All agreed?

Our industry’s addiction to this architecture is leading us to build fragile systems.

This is a dangerous precedent

We should be more concerned about ease of use and reliability.

Page 12: We don't need consensus: All agreed?

Ease of use

Page 13: We don't need consensus: All agreed?

FragilityPrivate DC Public Cloud

Where do I put my KV store?

Page 14: We don't need consensus: All agreed?

Do we even need strong consistency?

Page 15: We don't need consensus: All agreed?

Routing Service Disco IPAM Load Bal.

BGP DNS

ICANN …

Infrastructure Microservices

Page 16: We don't need consensus: All agreed?

An alternative approach

Page 17: We don't need consensus: All agreed?

Gossip• Consider each node

broadcasting updates:• O(n2) traffic, O(1)

propagation delay• Alternatively, each node picks

random set of neighbours and tells them:• O(log n) traffic, O(log n)

propagation delay on average

Page 18: We don't need consensus: All agreed?

Convergent Replicated Data Type• maintains consistency

without consensus • nodes merge updates

from other nodes • merge function must be

commutative, associative and idempotent

https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type

Page 19: We don't need consensus: All agreed?

Concrete Application of CRDTs

Page 20: We don't need consensus: All agreed?

Routing: Weave Net

• Data structure is a mapping from container MAC address to host ID

• We also gossip the topology, who is connected to whom

Page 21: We don't need consensus: All agreed?

IP Address Management• Data structure is a ring,

mapping IP address segments to hosts

• Each host only ever manipulates its own entries.

• When one host wants to grant some free space to another host, it splits one of its own ranges and gossips an update.

Page 22: We don't need consensus: All agreed?

Service Discovery: WeaveDNS• Data structure is a mapping

from DNS name to IP address • Entries also contain the host

and container ID, so multiple hosts can have an entry for the same name

• This allows for round-robin DNS load-spreading

Page 23: We don't need consensus: All agreed?

Results

Page 24: We don't need consensus: All agreed?
Page 25: We don't need consensus: All agreed?

A demo

Page 26: We don't need consensus: All agreed?

@weaveworks github.com/weaveworks

Questions?http://weave.works/product/scope

[email protected] @tom_wilkie

Page 27: We don't need consensus: All agreed?

Credits

Based on talk by Bryan Boreham, who cowrote the IPAM implementation with me.

https://www.youtube.com/watch?v=117gWVShcGU

Page 28: We don't need consensus: All agreed?

Details• How do we keep from accumulating an ever-

increasing set of tombstoned entries? • Tombstoned entries time out after a while

• CRDTs are not something you can pull off-the-shelf • Data structure must be carefully designed

• How to bootstrap the IP allocator system? • We use Paxos