Contenu connexe Similaire à Building the Glue for Service Discovery & Load Balancing Microservices (20) Building the Glue for Service Discovery & Load Balancing Microservices1. © 2016 Mesosphere, Inc. All Rights Reserved.
BUILDING THE GLUE FOR
SERVICE DISCOVERY &
LOAD BALANCING
MICROSERVICES
@SARGUN
1
Sargun Dhillon, 2016
3. © 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
4. © 2016 Mesosphere, Inc. All Rights Reserved.
A BRIEF HISTORY
OF NETWORKS
IN THE
DATACENTER
4
5. © 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
6. © 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
7. © 2016 Mesosphere, Inc. All Rights Reserved. 7
SaaS continued to grow at
an incredible rate
9. © 2016 Mesosphere, Inc. All Rights Reserved. 9
We kept the software alive
By feeding it
With Sysadmins
10. © 2016 Mesosphere, Inc. All Rights Reserved. 10
We kept the machines alive
By feeding them
With Blood
12. © 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
13. © 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
14. © 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
15. © 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
20. © 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
26. © 2016 Mesosphere, Inc. All Rights Reserved. 26
Paxos?
Raft?
Ω Failure Detector?
Pods?
Wat?
Sidecars?
Etcd?
Zookeeper?
VxLan?
29. © 2016 Mesosphere, Inc. All Rights Reserved. 29
MySQL Performance with Containers
0
75000
150000
225000
300000
Container-free Host Mode Bridged Overlay
Transactions / Sec
35. © 2016 Mesosphere, Inc. All Rights Reserved. 35
Let Mesos* Choose Ports
*The Scheduler
40. © 2016 Mesosphere, Inc. All Rights Reserved. 40
Solution:
Expose the IP and Port of Tasks
via
DNS SRV records
44. © 2016 Mesosphere, Inc. All Rights Reserved. 44
So, we performed an OODA loop
1.Observe
2. Orient
3. Decide
4. Act
45. © 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
46. © 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
47. © 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
55. © 2016 Mesosphere, Inc. All Rights Reserved. 55
How does connect() work on
LD_PRELOAD?
68. © 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
70. © 2016 Mesosphere, Inc. All Rights Reserved.
GLOBAL STATE
70
• Load Balancer Task Mapping
• DNS Zones
• Virtual Network Routing Tables
• Reachability
• Security ACLs
77. © 2016 Mesosphere, Inc. All Rights Reserved. 77
Nobody ever got fired for using
Zookeeper
87. © 2016 Mesosphere, Inc. All Rights Reserved. 87
All we need is a sparse, connected graph
89. © 2016 Mesosphere, Inc. All Rights Reserved. 89
Enter: HyParView
Builds a connected graph (overlay), where the degree is <=K
105. © 2016 Mesosphere, Inc. All Rights Reserved. 105
Constant Adaptive
Health Checks*
*Borrowed from SWIM, Gossip Style Failure Detector
110. © 2016 Mesosphere, Inc. All Rights Reserved. 110
Routing*
*Borrowed from Dijkstra, OSPF, IS-IS, Perlman
114. © 2016 Mesosphere, Inc. All Rights Reserved. 114
Minimum Spanning Tree, From Sender A
115. © 2016 Mesosphere, Inc. All Rights Reserved. 115
A Wild Pokemon Appears!*
*CRDT papers
Database
118. © 2016 Mesosphere, Inc. All Rights Reserved.
LASHUP KV
118
•Datatypes:
•Maps
•Composable
•Sets
•Flags
•Counters
•Registers
•Last-write-wins
122. © 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
124. © 2016 Mesosphere, Inc. All Rights Reserved. 124
Zero Overhead NFV:
Software Defined Systems?
132. © 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
135. © 2016 Mesosphere, Inc. All Rights Reserved. 135
0000:0000:0000:0000:0000:0000:0000:0000
64-bits
IPv6
64-bits
Network
Part
Host
Part
136. © 2016 Mesosphere, Inc. All Rights Reserved. 136
SLAAC
StateLess Address Auto Configuration
137. © 2016 Mesosphere, Inc. All Rights Reserved.
IPV6
137
•264 addresses per host
•Automatically configured
•Challenges
•Cloud support
•Organization challenges
140. © 2016 Mesosphere, Inc. All Rights Reserved. 140
We’re probably doing it wrong
(today)
142. © 2016 Mesosphere, Inc. All Rights Reserved.
BUILDING THE GLUE FOR
SERVICE DISCOVERY &
LOAD BALANCING
MICROSERVICES
@SARGUN
142