Slide 1

Slide 1 text

HASHICORP Towards Running Stateful Applications on Nomad Diptanu Gon Choudhury @diptanu HashiConf US Sep 2016

Slide 2

Slide 2 text

Quest to increase agility and reliability Develop Build Deploy Production Fast turnaround High Availability
 Control Plane for operations

Slide 3

Slide 3 text

Quest to increase agility and reliability Develop Build Deploy Region 1 Region 2 DC 1 DC 2 DC 3 DC 3 DC 3 DC 3

Slide 4

Slide 4 text

Nomad Multi DC Multi Region Diverse workload Diverse platform Built for scale Operationally simple

Slide 5

Slide 5 text

Nomad Optimistic Concurrency State Coordination Service, Batch and System workloads

Slide 6

Slide 6 text

Application Configuration Constraints job "redis" { datacenters = ["us-east-1"] group “cache” { count = 100 task "redis" { driver = "docker" config { image = "redis:latest" } resources { cpu = 500 memory = 256 network { mbits = 10 dynamic_ports = ["redis"] } } } }

Slide 7

Slide 7 text

job "redis" { datacenters = ["us-east-1"] task "redis" { driver = "docker" config { image = "redis:latest" } resources { cpu = 500 memory = 256 network { mbits = 10 dynamic_ports = ["redis"] } } } }

Slide 8

Slide 8 text

Batch Scheduler
 Service Scheduler Restart Policies
 System Scheduler Consul Integration
 Log Management
 Runtime Stats
 Job Plans Vault Integration
 TLS Sticky Volumes
 Disk Watchers Volume Plugins
 Network Plugins ACL Priorities
 Quotas

Slide 9

Slide 9 text

Nomad is a great platform for stateless workloads

Slide 10

Slide 10 text

Improved support and features
 for Stateful Applications

Slide 11

Slide 11 text

Nomad Jobs Task Group Task Group Task A Task B Task C Task D Allocation Allocation Job

Slide 12

Slide 12 text

Allocations Allocations are instances of a task group on a compute node Ephemeral in nature Allocations manage the life cycle of tasks within them Provides the environment and file system for the tasks

Slide 13

Slide 13 text

Allocation Resources CPU Shares Memory Network Ports and IPs Task Resources Shared Resources Disk Resources

Slide 14

Slide 14 text

Allocation Directory Allocation directory provides a shared data directory for tasks stdout and stderr streams of tasks are written in logs dir Each Task has a task local directory

Slide 15

Slide 15 text

Allocation Directory Ephemeral Disk Allocation Directory Task Dir Task Dir Allocation Directory

Slide 16

Slide 16 text

Allocation Directory Allocation Directory data logs tmp local tmp Task Dir Task Dir local tmp

Slide 17

Slide 17 text

Allocations Allocations are ephemeral in nature Allocations can be restarted on a different node Allocation directory not preserved when restarted on same node They are garbage collected by Nomad after they transition to terminal state

Slide 18

Slide 18 text

Sticky Volumes

Slide 19

Slide 19 text

Sticky Volumes Prefers to restart allocation on the same nodes to avoid replication Replicate the shared data dir and task local dirs of allocations Best effort replication, not a Distributed File Systems

Slide 20

Slide 20 text

group “redis” { ephemeral_disk { sticky = true
 size = 20000 } task “redis” { … } 
 task “backup-agent” { … } } cache.nomad

Slide 21

Slide 21 text

Ephemeral Disk Shared Allocation Directory Task A Task B

Slide 22

Slide 22 text

Ephemeral Disk Shared Allocation Directory Task A Task B Shared Allocation Directory Task A Task B Move

Slide 23

Slide 23 text

Node A Allocation Allocation Node B P2P Replication

Slide 24

Slide 24 text

Disk Watcher Watch dog process to monitor disk usage Allocations get killed if they use more disk resources than they are allocated If an allocation exceeds it’s disk quota, the allocation fails permanently

Slide 25

Slide 25 text

The Future Data Volumes to add additional volumes to allocations Volume plugins for materializing volumes on storage services like EBS, EFS, NFS, etc File system drivers for supporting file systems such as ZFS

Slide 26

Slide 26 text

Thanks! https://www.nomadproject.io/
 https://github.com/hashicorp/nomad