Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nomad and next generation application architectures

Nomad and next generation application architectures

We provide an overview of HashiCorp Nomad, which is a cluster manager and scheduler. We explore what a cluster scheduler is and the benefits they provide, including higher resource utilization, decoupling developers and operators, and better quality of service. The high level design of Nomad is explained and how it supports running over a million containers. The scalability of Nomad sets the stage for using the API from applications to build next generation applications that blur the lines between applications and infrastructure.

Armon Dadgar

June 21, 2017
Tweet

More Decks by Armon Dadgar

Other Decks in Technology

Transcript

  1. HashiCorp Suite CONNECT RUN SECURE PROVISION Infrastructure & applications Applications

    Infrastructure & applications Infrastructure Consul Nomad Terraform Vault Packer Vagrant Consul Enterprise Nomad Enterprise Vault Enterprise Terraform Enterprise FOR TEAMS OSS TOOL SUITE PRODUCT SUITE
  2. CPU Scheduler Web Server -Thread 1 CPU - Core 1

    CPU - Core 2 Web Server -Thread 2 Redis -Thread 1 Kernel -Thread 1 Work (Input) Resources CPU Scheduler
  3. CPU Scheduler Web Server -Thread 1 CPU - Core 1

    CPU - Core 2 Web Server -Thread 2 Redis -Thread 1 Kernel -Thread 1 Work (Input) Resources CPU Scheduler
  4. Schedulers in the Wild Type Work Resources CPU Scheduler Threads

    Physical Cores AWS EC2 / OpenStack Nova Virtual Machines Hypervisors Hadoop YARN MapReduce Jobs Client Nodes Cluster Scheduler Applications Servers
  5. Advantages Higher Resource U.liza.on Decouple Work from Resources Be:er Quality

    of Service Bin Packing Over-Subscrip.on Job Queueing
  6. job "redis" { datacenters = ["us-east-1"] task "redis" { driver

    = "docker" config { image = "redis:latest" } resources { cpu = 500 # Mhz memory = 256 # MB network { mbits = 10 port “redis" {} } } } } example.nomad
  7. OS Workloads Drivers Windows Long Running Service Docker / Rkt

    / LXC Linux Short Lived Batch Qemu / KVM BSD Periodic Cron “exec” cgroups+chroot Solaris System Agents Static Binaries / Fat JARs
  8. Single Region Architecture SERVER SERVER SERVER CLIENT CLIENT CLIENT DC1

    DC2 DC3 FOLLOWER LEADER FOLLOWER REPLICATION FORWARDING REPLICATION FORWARDING RPC RPC RPC
  9. Multi Region Architecture SERVER SERVER SERVER FOLLOWER LEADER FOLLOWER REPLICATION

    FORWARDING REPLICATION REGION B  GOSSIP REPLICATION REPLICATION FORWARDING REGION FORWARDING  REGION A SERVER FOLLOWER SERVER SERVER LEADER FOLLOWER
  10. Side Cars • Sidecar or Co-Process Pattern • Application that

    runs alongside “main” process • Nomad “Task Group” • Borg “Alloc” • Kubernetes “Pod”
  11. Routing Proxy Log Shipper App1 Routing Proxy Log Shipper App2

    Client Node Allocation #1 Allocation #2 App3 Allocation #3
  12. Side Cars • Configuration (Consul-Template) • Logging Agents (Splunk, CloudWatch)

    • Telemetry Agents (Datadog) • Service Mesh (Envoy, Linkerd) • Load Balancing (HAProxy, Nginx, Fabio)
  13. Queues • Workers are online service doing batch work •

    Workers provisioned in advance • N+1 instances for high availability • Typically idle or underutilized
  14. Nomad Dispatch • “Dispatch” a worker for each incoming event

    • Consumer launched on-demand and terminates when done • Publisher shielded from implementation detail • Nomad job acts like a future, queues when busy • Avoids underutilization
  15. job “my-dispatch” { datacenter = [“dc1”] type = “batch” parameterized

    { meta_required = [“input”] } task “worker” { driver = “docker” config = { image = “myworker:latest” args = [“—input”, “${NOMAD_META_INPUT}”] }
 } } my-dispatch.job
  16. Function-as-a-Service • AWS Lambda • Small Granularity • Low Volume,

    Latency Insensitive => Nomad Dispatch • High Volume, Latency Sensitive => Setup Overhead Prohibitive
  17. FaaS / Serverless • Process multiple events per worker •

    Dynamically scale workers • Queue messages to avoid dropping
  18. Nomad Server Register Dispatch Job Web Server Push Worker 1

    Schedule Controller Pull Dispatch Deep Message Queue
  19. Nomad Server Register Dispatch Job Web Server Push Worker 1

    Schedule Worker 2 Worker N Controller Pull Dispatch
  20. Big Data Processing • Large scale batch workload • Graph

    of processing steps • Each phase dynamic size • Programmatically setup/teardown workers • Native Spark Integration!
  21. Large-scale cluster management at Google with Borg. Abhishek Verma, Luis

    Pedrosa, Madhukar R. Korupolu, David Oppenheimer, Eric Tune, John Wilkes.