building the glue for service discovery & load balancing microservices

Post on 16-Apr-2017

839 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© 2016 Mesosphere, Inc. All Rights Reserved.

BUILDING THE GLUE FOR SERVICE DISCOVERY & LOAD BALANCING MICROSERVICES

@SARGUN

1

Sargun Dhillon, 2016

© 2016 Mesosphere, Inc. All Rights Reserved.

WHO AM I?

2

© 2016 Mesosphere, Inc. All Rights Reserved.

AGENDA

3

• How, and why did we go here?

• What have I been building in the past year?

• Why?

• How?

• Challenges

• Some of the future

© 2016 Mesosphere, Inc. All Rights Reserved.

A BRIEF HISTORY OF NETWORKS IN THE DATACENTER

4

© 2016 Mesosphere, Inc. All Rights Reserved.

ORGANIZATIONS CIRCA 2007

5

•Before DevOps was coined

•Clear differentiation of ownership

•The datacenter was owned by the NOC

•Deployment of services was done by sysadmins in the operations group

•Developers operated without access to production systems

•Production deployments gated by QA and Operations

© 2016 Mesosphere, Inc. All Rights Reserved.

SOFTWARE CIRCA 2007

6

•Different services glued together via CORBA, XML-RPC, SOAP

•No one was really consciously doing microservices

•Networks were static, giant layer 2 domains

•Load Balancing provided by hardware

•Everyone ran their own datacenter

•EC2 in its infancy, only a year prior has the term “Cloud” began to become popular

•Systems statically partitioned

© 2016 Mesosphere, Inc. All Rights Reserved. 7

SaaS continued to grow at an incredible rate

© 2016 Mesosphere, Inc. All Rights Reserved. 8

There became a race to ship faster

© 2016 Mesosphere, Inc. All Rights Reserved. 9

We kept the software alive By feeding it

With Sysadmins

© 2016 Mesosphere, Inc. All Rights Reserved. 10

We kept the machines alive By feeding them

With Blood

© 2016 Mesosphere, Inc. All Rights Reserved. 11

This wasn’t working

© 2016 Mesosphere, Inc. All Rights Reserved.

ORGANIZATIONS 2008+

12

•We began seeing a gradual shift in the industry where lines between QA, Dev, and Ops were blurring

•Devops term coined in 2008, first DevOpsDay in 2009

•Gradual adoption of the cloud, fewer organizations owning their own datacenters

•Either networking was outsourced to the cloud, or typically remained in a small internal organization

•Needed to reduce ratio of operators to servers

© 2016 Mesosphere, Inc. All Rights Reserved.

SOFTWARE CIRCA 2008+

13

•Popularization of Open Source tooling to automate QA and much of traditional operations

•Jenkins / Hudson

•Puppet / Chef

•Capistrano

•Popularization of stacks requiring more complex operational requirements

•Nutch / Hadoop

•NoSQLs

•Machine still statically partitioned

•Networks still sacred territory

© 2016 Mesosphere, Inc. All Rights Reserved.

CIRCA 2011

14

•Much of what’s been happening for the past half-decade hits networking

•Much of this falls under the term “SDN” (Software Defined Networking) or “NFV” (Network Function Virtualization)

•Hastened by the adoption of VMs in the enterprise in the hype cycle

•Openflow promises to fix everything

•Major adoptions of the cloud by startups as well as enterprise

•Virtualization begins to become mainstream as a mechanism of consolidating workloads

•The invention of the “private cloud”

•DotCloud / Docker funded by Y-combinator a year earlier

•Term “Microservice” coined

© 2016 Mesosphere, Inc. All Rights Reserved.

CIRCA 2013

15

• Docker becomes an instant hit and brings containers to the forefront

• Dynamic partitioning begins to make in-roads

• Google releases Omega paper

• Apache Aurora open sourced

• Microservice counts explode, demanding collocation of workloads for efficiency

• Mesosphere Founded

• Site Reliability Engineering begins to popularize and further blur the lines between Dev, Ops, and QA

© 2016 Mesosphere, Inc. All Rights Reserved. 16

Everything was changing

© 2016 Mesosphere, Inc. All Rights Reserved. 17

Why?

© 2016 Mesosphere, Inc. All Rights Reserved. 18

Business Value

© 2016 Mesosphere, Inc. All Rights Reserved. 19

© 2016 Mesosphere, Inc. All Rights Reserved.

BENEFITS

20

•Reduction in cost of goods sold

•Smaller engineer to server ratio

•Linear, or super linear growth rate of engineering team to servers is unsustainable

•Smaller engineer to capability ratio, where capability includes:

•Features

•Throughput

•Better User Experience

•Better availability

•Quicker release to features and fixes

© 2016 Mesosphere, Inc. All Rights Reserved. 21

But at what cost?

© 2016 Mesosphere, Inc. All Rights Reserved. 22

Complexity

© 2016 Mesosphere, Inc. All Rights Reserved.

OLD WORLD

23

© 2016 Mesosphere, Inc. All Rights Reserved.

NEW WORLD

24

© 2016 Mesosphere, Inc. All Rights Reserved.

DIVING DEEPER

25

© 2016 Mesosphere, Inc. All Rights Reserved. 26

Paxos?

Raft?

Ω Failure Detector?

Pods?

Wat?

Sidecars?

Etcd?

Zookeeper?

VxLan?

© 2016 Mesosphere, Inc. All Rights Reserved. 27

Performance

© 2016 Mesosphere, Inc. All Rights Reserved.

REDIS PERFORMANCE

28

© 2016 Mesosphere, Inc. All Rights Reserved. 29

MySQL Performance with Containers

0

75000

150000

225000

300000

Container-free Host Mode Bridged Overlay

Transactions / Sec

© 2016 Mesosphere, Inc. All Rights Reserved.

OUR JOURNEY

30

© 2016 Mesosphere, Inc. All Rights Reserved. 31

“Connectivity”

© 2016 Mesosphere, Inc. All Rights Reserved. 32

Where are my apps running?

© 2016 Mesosphere, Inc. All Rights Reserved. 33

© 2016 Mesosphere, Inc. All Rights Reserved. 34

The Old World

© 2016 Mesosphere, Inc. All Rights Reserved. 35

Let Mesos* Choose Ports

*The Scheduler

© 2016 Mesosphere, Inc. All Rights Reserved. 36

How do you find the tasks?

© 2016 Mesosphere, Inc. All Rights Reserved. 37

A Directory?

© 2016 Mesosphere, Inc. All Rights Reserved. 38

See: DNS

© 2016 Mesosphere, Inc. All Rights Reserved. 39

© 2016 Mesosphere, Inc. All Rights Reserved. 40

Solution: Expose the IP and Port of Tasks

via DNS SRV records

© 2016 Mesosphere, Inc. All Rights Reserved. 41

Everyone has DNS right?

© 2016 Mesosphere, Inc. All Rights Reserved. 42

And GLibc even has a bug open for it!

© 2016 Mesosphere, Inc. All Rights Reserved. 43

…Opened in 2005

© 2016 Mesosphere, Inc. All Rights Reserved. 44

So, we performed an OODA loop

1. Observe 2. Orient 3. Decide 4. Act

© 2016 Mesosphere, Inc. All Rights Reserved.

OBSERVE: SERVICE DISCOVERY

45

• Existing Dynamic Service Discovery Solutions:

• Etcd

• Finagle + Zookeeper

• Consul

• Existing Static Service Discovery Solutions:

• Amazon ELB

• Hardware Load Balancers

• Service Discovery is an afterthought

Gathering our data about the field

© 2016 Mesosphere, Inc. All Rights Reserved.

OBSERVE: NETWORKING

46

• Everybody assumes IP per application instance

• Everybody assumes reliable DNS

• Some people want to be fast

• Some people want security

• Nobody wants to edit application code

• Nobody wants to talk to their network engineer

Gathering our data about the field

© 2016 Mesosphere, Inc. All Rights Reserved.

ORIENT: NETWORKING CORE TENANTS

47

•We must be agnostic to the underlying environment

•AWS / Azure / GCE / Softlayer as the lowest common denominators

•We should require minimal changes to user code in order to work

•We should provide similar services to existing environments

•Fixed load balancers

•Security

•IP/Container

•We do not want to require a change in organization procedures

© 2016 Mesosphere, Inc. All Rights Reserved. 48

Act: What did we build?

© 2016 Mesosphere, Inc. All Rights Reserved. 49

Load Balancing: Minuteman

© 2016 Mesosphere, Inc. All Rights Reserved.

WHAT WE WANTED

50

© 2016 Mesosphere, Inc. All Rights Reserved. 51

First try: LD_PRELOAD

© 2016 Mesosphere, Inc. All Rights Reserved. 52

How does connect() work?

© 2016 Mesosphere, Inc. All Rights Reserved. 53

© 2016 Mesosphere, Inc. All Rights Reserved. 54

© 2016 Mesosphere, Inc. All Rights Reserved. 55

How does connect() work on LD_PRELOAD?

© 2016 Mesosphere, Inc. All Rights Reserved. 56

© 2016 Mesosphere, Inc. All Rights Reserved. 57

© 2016 Mesosphere, Inc. All Rights Reserved. 58

© 2016 Mesosphere, Inc. All Rights Reserved. 59

© 2016 Mesosphere, Inc. All Rights Reserved. 60

…But no

© 2016 Mesosphere, Inc. All Rights Reserved. 61

Static Linking

© 2016 Mesosphere, Inc. All Rights Reserved. 62

What else is there?

© 2016 Mesosphere, Inc. All Rights Reserved. 63

© 2016 Mesosphere, Inc. All Rights Reserved. 64

© 2016 Mesosphere, Inc. All Rights Reserved. 65

© 2016 Mesosphere, Inc. All Rights Reserved. 66

© 2016 Mesosphere, Inc. All Rights Reserved. 67

Minuteman: Flows at a Moment’s notice

© 2016 Mesosphere, Inc. All Rights Reserved.

MINUTEMAN: BENEFITS

68

•Appearance of a fixed-load balancer

•Fully distributed

•Other than first packet, the entire lifetime is handled in kernel space

•Source: github.com/dcos/minuteman

© 2016 Mesosphere, Inc. All Rights Reserved. 69

How do we tie it all together?

© 2016 Mesosphere, Inc. All Rights Reserved.

GLOBAL STATE

70

• Load Balancer Task Mapping

• DNS Zones

• Virtual Network Routing Tables

• Reachability

• Security ACLs

© 2016 Mesosphere, Inc. All Rights Reserved. 71

Computers

© 2016 Mesosphere, Inc. All Rights Reserved. 72

Constant Churn

© 2016 Mesosphere, Inc. All Rights Reserved. 73

Sometimes

They Break

© 2016 Mesosphere, Inc. All Rights Reserved. 74

Sometimes

Many Break

© 2016 Mesosphere, Inc. All Rights Reserved. 75

Sometimes

You don’t know

© 2016 Mesosphere, Inc. All Rights Reserved.

HOW DO YOU DO SIGNALING?

76

© 2016 Mesosphere, Inc. All Rights Reserved. 77

Nobody ever got fired for using Zookeeper

© 2016 Mesosphere, Inc. All Rights Reserved. 78

We know about Zookeeper

© 2016 Mesosphere, Inc. All Rights Reserved. 79

It works…usually

© 2016 Mesosphere, Inc. All Rights Reserved. 80

How else can we do this?

© 2016 Mesosphere, Inc. All Rights Reserved. 81

Naively

© 2016 Mesosphere, Inc. All Rights Reserved. 82

Massive Amount of Information

© 2016 Mesosphere, Inc. All Rights Reserved. 83

Who else has solved this?

© 2016 Mesosphere, Inc. All Rights Reserved. 84

Academia

© 2016 Mesosphere, Inc. All Rights Reserved. 85

Control Plane: Lashup

© 2016 Mesosphere, Inc. All Rights Reserved. 86

How do we scale the naive approach?

© 2016 Mesosphere, Inc. All Rights Reserved. 87

All we need is a sparse, connected graph

© 2016 Mesosphere, Inc. All Rights Reserved. 88

But how?

© 2016 Mesosphere, Inc. All Rights Reserved. 89

Enter: HyParViewBuilds a connected graph (overlay), where the degree is <=K

© 2016 Mesosphere, Inc. All Rights Reserved. 90

Boot Time

© 2016 Mesosphere, Inc. All Rights Reserved. 91

© 2016 Mesosphere, Inc. All Rights Reserved. 92

© 2016 Mesosphere, Inc. All Rights Reserved. 93

© 2016 Mesosphere, Inc. All Rights Reserved. 94

© 2016 Mesosphere, Inc. All Rights Reserved. 95

© 2016 Mesosphere, Inc. All Rights Reserved. 96

© 2016 Mesosphere, Inc. All Rights Reserved. 97

© 2016 Mesosphere, Inc. All Rights Reserved. 98

© 2016 Mesosphere, Inc. All Rights Reserved. 99

© 2016 Mesosphere, Inc. All Rights Reserved. 100

© 2016 Mesosphere, Inc. All Rights Reserved. 101

© 2016 Mesosphere, Inc. All Rights Reserved. 102

© 2016 Mesosphere, Inc. All Rights Reserved. 103

© 2016 Mesosphere, Inc. All Rights Reserved. 104

Connected Graph

Hyparview

© 2016 Mesosphere, Inc. All Rights Reserved. 105

Constant Adaptive Health Checks*

*Borrowed from SWIM, Gossip Style Failure Detector

© 2016 Mesosphere, Inc. All Rights Reserved. 106

Dealing with Failure

Hyparview

© 2016 Mesosphere, Inc. All Rights Reserved. 107

Dealing with Failure

Hyparview

© 2016 Mesosphere, Inc. All Rights Reserved. 108

Dealing with Failure

Hyparview

© 2016 Mesosphere, Inc. All Rights Reserved. 109

Dealing with Failure

Hyparview

© 2016 Mesosphere, Inc. All Rights Reserved. 110

Routing*

*Borrowed from Dijkstra, OSPF, IS-IS, Perlman

© 2016 Mesosphere, Inc. All Rights Reserved. 111

© 2016 Mesosphere, Inc. All Rights Reserved. 112

© 2016 Mesosphere, Inc. All Rights Reserved. 113

Just Run Dijkstra*

*BFS / DFS

© 2016 Mesosphere, Inc. All Rights Reserved. 114

Minimum Spanning Tree, From Sender A

© 2016 Mesosphere, Inc. All Rights Reserved. 115

A Wild Pokemon Appears!*

*CRDT papers

Database

© 2016 Mesosphere, Inc. All Rights Reserved. 116

CRDTS: Semilattices

“Time”

© 2016 Mesosphere, Inc. All Rights Reserved. 117

CRDT KV Store

© 2016 Mesosphere, Inc. All Rights Reserved.

LASHUP KV

118

•Datatypes:

•Maps

•Composable

•Sets

•Flags

•Counters

•Registers

•Last-write-wins

© 2016 Mesosphere, Inc. All Rights Reserved. 119

Evaluation

© 2016 Mesosphere, Inc. All Rights Reserved. 120

Prior to Lashup

© 2016 Mesosphere, Inc. All Rights Reserved. 121

After Lashup

© 2016 Mesosphere, Inc. All Rights Reserved.

PROJECT LASHUP

122

•A novel distributed systems SDK that provides:

•Membership

•Multicast Delivery

•Strongly-eventually consistent data storage

•Powers:

•Minuteman VIP dissemination

•Minuteman node liveness checks

•Overlay routing

•DNS Synchronization

•Source: github.com/dcos/lashup

© 2016 Mesosphere, Inc. All Rights Reserved.

THE FUTURE

123

© 2016 Mesosphere, Inc. All Rights Reserved. 124

Zero Overhead NFV: Software Defined Systems?

© 2016 Mesosphere, Inc. All Rights Reserved. 125

This seems familiar

© 2016 Mesosphere, Inc. All Rights Reserved. 126

Something new

© 2016 Mesosphere, Inc. All Rights Reserved. 127

Something new(-ish)

© 2016 Mesosphere, Inc. All Rights Reserved. 128

© 2016 Mesosphere, Inc. All Rights Reserved. 129

(Extended)BPF?

© 2016 Mesosphere, Inc. All Rights Reserved. 130

© 2016 Mesosphere, Inc. All Rights Reserved. 131

© 2016 Mesosphere, Inc. All Rights Reserved.

ZERO-OVERHEAD NFV

132

•Implemented using built-in Linux APIs

•Linux Security Module API

•Linux eBPF

•Allows standard BSD API to work

•Example: getpeername() works

•In preliminary testing: <0.1% overhead

•Challenges

•Upgrading Kernel

© 2016 Mesosphere, Inc. All Rights Reserved. 133

IPv6: Just more addresses?

© 2016 Mesosphere, Inc. All Rights Reserved. 134

000.000.000.000

32-bits

IPv4

© 2016 Mesosphere, Inc. All Rights Reserved. 135

0000:0000:0000:0000:0000:0000:0000:0000

64-bits

IPv6

64-bits

Network Part

Host Part

© 2016 Mesosphere, Inc. All Rights Reserved. 136

SLAAC StateLess Address Auto Configuration

© 2016 Mesosphere, Inc. All Rights Reserved.

IPV6

137

•264 addresses per host

•Automatically configured

•Challenges

•Cloud support

•Organization challenges

© 2016 Mesosphere, Inc. All Rights Reserved. 138

What did we learn?

© 2016 Mesosphere, Inc. All Rights Reserved. 139

Organizations are weird

© 2016 Mesosphere, Inc. All Rights Reserved. 140

We’re probably doing it wrong (today)

© 2016 Mesosphere, Inc. All Rights Reserved. 141

The future looks bright

© 2016 Mesosphere, Inc. All Rights Reserved.

BUILDING THE GLUE FOR SERVICE DISCOVERY & LOAD BALANCING MICROSERVICES

@SARGUN

142

top related