Top Banner
HASHICORP Deploying and Discovering at Scale with Consul & Nomad
54

San Francisco HashiCorp User Group at GitHub

Apr 11, 2017

Download

Technology

Jon Benson
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: San Francisco HashiCorp User Group at GitHub

HASHICORP

Deploying and Discovering at Scale with Consul & Nomad

Page 2: San Francisco HashiCorp User Group at GitHub

HASHICORP

Jon Benson @jm_benson

Page 3: San Francisco HashiCorp User Group at GitHub

HASHICORP

Agenda

• Nomad Overview

• Nomad Architecture

Page 4: San Francisco HashiCorp User Group at GitHub

HASHICORP

Agenda

• Consul Overview

• Consul Architecture

• Prepared Queries

Page 5: San Francisco HashiCorp User Group at GitHub

HASHICORP

Agenda

• Demo

• Questions!

Page 6: San Francisco HashiCorp User Group at GitHub

HASHICORP

Advantages of a Scheduler

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 7: San Francisco HashiCorp User Group at GitHub

HASHICORP

Advantages of a Scheduler

Bin Packing

Over-Subscription

Job Queueing

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 8: San Francisco HashiCorp User Group at GitHub

HASHICORP

Advantages of a Scheduler

Abstraction

API Contracts

Standardization

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 9: San Francisco HashiCorp User Group at GitHub

HASHICORP

Advantages of a Scheduler

Priorities

Resource Isolation

Pre-emption

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 10: San Francisco HashiCorp User Group at GitHub

HASHICORP

Page 11: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Cluster Scheduler

Easily Deploy Applications

Job Specification

Page 12: San Francisco HashiCorp User Group at GitHub

HASHICORP

example.nomad

# Define our simple redis jobjob "redis" {

# Run only in us-east-1 datacenters = ["us-east-1"]

# Define the single redis task using Docker task "redis" { driver = "docker"

config { image = "redis:latest" }

resources { cpu = 500 # Mhz memory = 256 # MB network { mbits = 10 dynamic_ports = ["redis"] } } }}

Page 13: San Francisco HashiCorp User Group at GitHub

HASHICORP

Job Specification

Declares what to run

Page 14: San Francisco HashiCorp User Group at GitHub

HASHICORP

Job Specification

Nomad determines where and manages how to run

Page 15: San Francisco HashiCorp User Group at GitHub

HASHICORP

Job Specification

Abstract work from resources

Page 16: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 17: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Multi-Datacenter

Multi-Region

Flexible Workloads

Job Priorities

Bin Packing

Large Scale

Operationally Simple

Page 18: San Francisco HashiCorp User Group at GitHub

HASHICORP

Thousands of regions

Tens of thousands of clients per region

Thousands of jobs per region

Page 19: San Francisco HashiCorp User Group at GitHub

HASHICORP

Built on Experience

gossip consensus

Page 20: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Cluster Management

• Gossip Based (P2P)

• Membership

• Failure Detection

• Event System

Page 21: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Gossip Protocol

• Large Scale

• Production Hardened

• Operationally Simple

Page 22: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Service configuration and discovery

• Monitoring at scale

• High-availability

Page 23: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Service configuration and discovery

• Monitoring at scale

• High-availability

Page 24: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Service configuration and discovery

• Monitoring at scale

• High-availability

Page 25: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Service configuration and discovery

• Monitoring at scale

• High-availability

Page 26: San Francisco HashiCorp User Group at GitHub

HASHICORP

Page 27: San Francisco HashiCorp User Group at GitHub

HASHICORP

• Multi-Datacenter

• Raft Consensus

• Large Scale

• Production Hardened

• Coordination (Locking)

• Central Servers + Distributed Clients

• Network Tomography

• Prepared Queries

Page 28: San Francisco HashiCorp User Group at GitHub

HASHICORP

Prepared Queries

• Multiple instances of a given service exist in multiple

datacenters

• Clients can talk to any of them, and always prefer the

instances with lowest latency

• Policies can change, desire to not have the clients know

the details of how to locate a healthy service

Page 29: San Francisco HashiCorp User Group at GitHub

HASHICORP

Prepared Queries

• New query namespace, similar to services

• Register queries to answer for parts of this namespace

• Clients use APIs, or “.query.consul” DNS lookups to run

queries

Page 30: San Francisco HashiCorp User Group at GitHub

HASHICORP

gossip consensus

Mature Libraries

Design Patterns

No Scheduling Logic

Page 31: San Francisco HashiCorp User Group at GitHub

HASHICORP

Built on Research

gossip consensus

Page 32: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Inspired by Google Omega

Optimistic Concurrency

Internal State and Coordination

Service and Batch workloads

Pluggable Architecture

Page 33: San Francisco HashiCorp User Group at GitHub

HASHICORP

Single Region Architecture

SERVER SERVER SERVER

CLIENT CLIENT CLIENTDC1 DC2 DC3

FOLLOWER LEADER FOLLOWER

REPLICATIONFORWARDING

REPLICATIONFORWARDING

RPC RPC RPC

Page 34: San Francisco HashiCorp User Group at GitHub

HASHICORP

Multi Region Architecture

SERVER SERVER SERVERFOLLOWER LEADER FOLLOWER

REPLICATIONFORWARDING

REPLICATION

REGION B GOSSIP

REPLICATION REPLICATIONFORWARDING

REGION FORWARDING

REGION A

SERVERFOLLOWER

SERVER SERVERLEADER FOLLOWER

Page 35: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Region is Isolation Domain

1-N Datacenters Per Region

Flexibility to do 1:1 (Consul)

Scheduling Boundary

Page 36: San Francisco HashiCorp User Group at GitHub

HASHICORP

Data Model

Page 37: San Francisco HashiCorp User Group at GitHub

HASHICORP

Evaluations ~= State Change Event

Page 38: San Francisco HashiCorp User Group at GitHub

HASHICORP

Create / Update / Delete JobNode Up / Node Down

Allocation Failed

Page 39: San Francisco HashiCorp User Group at GitHub

HASHICORP

External Event

Evalua?on Crea?on

Evalua?on Queuing

Evalua?on Processing

Op?mis?c Coordina?on

State Updates

Page 40: San Francisco HashiCorp User Group at GitHub

HASHICORP

Server Architecture

Omega Class Scheduler

Pluggable Logic

Internal Coordination and State

Multi-Region / Multi-Datacenter

Page 41: San Francisco HashiCorp User Group at GitHub

HASHICORP

Client Architecture

Broad OS Support

Host Fingerprinting

Pluggable Drivers

Page 42: San Francisco HashiCorp User Group at GitHub

HASHICORP

Fingerprinting

Operating System

Hardware

Applications

Environment

Type Examples

Kernel, OS, Versions

CPU, Memory, Disk

Java, Docker, Consul

AWS, GCE

Page 43: San Francisco HashiCorp User Group at GitHub

HASHICORP

Fingerprinting

Constrain Placement and Bin Pack

Page 44: San Francisco HashiCorp User Group at GitHub

HASHICORP

Fingerprinting

“Task Requires Linux, Docker, and PCI-Compliant Hardware” expressed as Constraints

Page 45: San Francisco HashiCorp User Group at GitHub

HASHICORP

Fingerprinting

“Task needs 512MB RAM and 1 Core” expressed as Resource Ask

Page 46: San Francisco HashiCorp User Group at GitHub

HASHICORP

Drivers

Execute Tasks Provide Resource Isolation

Page 47: San Francisco HashiCorp User Group at GitHub

HASHICORP

Containerized

Virtualized

Standalone

Docker

Qemu / KVM

Java Jar

Static Binaries

Rocket

Page 48: San Francisco HashiCorp User Group at GitHub

HASHICORP

Containerized

Virtualized

Standalone

Docker

Rocket

Windows Server Containers

Qemu / KVM

Hyper-V

Xen

Java Jar

Static Binaries

C#

Page 49: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Workload Flexibility:

Schedulers

Fingerprints

Drivers

Job Specification

Page 50: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Operational Simplicity:

Single Binary

No Dependencies

Highly Available

Page 51: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Cluster Scheduler

Easily Deploy Applications

Job Specification

Page 52: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

Higher Resource Utilization

Decouple Work from Resources

Better Quality of Service

Page 53: San Francisco HashiCorp User Group at GitHub

NomadHASHICORP

• Million Container Challenge

• hashicorp.com/c1m.html

• github.com/hashicorp/c1m

• Nomad 0.4

• Volume support across drivers

• Advanced networking

Page 54: San Francisco HashiCorp User Group at GitHub

HASHICORP

Thanks!We’ll do a quick demo then answer questions…

Jon Benson @jm_benson