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

Scheduling Applications at Scale

Armon Dadgar
November 20, 2015

Scheduling Applications at Scale

Tools like Docker and rkt make it easier than ever to package and distribute applications. Unfortunately, not all organizations have the luxury of being able to package their applications in a container runtime.

Many organizations have virtualized workloads that cannot be easily containerized, such as applications that require full hardware isolation or virtual appliances. On the opposite end of the spectrum, some organizations deploy workloads that are already static binaries such as Go applications or Java applications that only rely on the JVM. These types of applications do not benefit from containerization as they are already self-contained. To address the growing heterogeneity of workloads, HashiCorp created Nomad - a globally aware, distributed scheduler and cluster manager.

Nomad is designed to handle many types of workloads, on a variety of operating systems, at massive scale. Nomad empowers developers to specify jobs and tasks using a high-level specification in a plain-text file. Nomad accepts the job specification, parses the information, determines which compatible hosts have available resources, and then automatically manages the placement, healing, and scaling of the application. By placing multiple applications per host, Nomad maximizes resource utilization and dramatically reduces infrastructure costs.

The flexibility of Nomad's design brings the benefits of a scheduled application workflow to organizations with heterogeneous workloads and operating systems. This talk will discuss the pros and cons of running in a scheduled environment and an overview of the design and architecture of Nomad.

Armon Dadgar

November 20, 2015
Tweet

More Decks by Armon Dadgar

Other Decks in Technology

Transcript

  1. HASHICORP 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
  2. HASHICORP 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. HASHICORP 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
  4. HASHICORP example.nomad # Define our simple redis job job "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"] } } } }
  5. HASHICORP # Define our simple redis job job "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"] } } } }
  6. HASHICORP job “foobar” { # Restrict the parallelism in updates

    update { stagger = “60s” max_parallel = 3 } … }
  7. HASHICORP job “foobar” { group “hdfs-data-node” { # Ensure the

    scheduler does not put # multiple instances on one host constraint { distinct_hosts = true } … } }
  8. HASHICORP job “foobar” { group “hdfs-data-node” { # Attempt restart

    of tasks if they # fail unexpectedly restart { attempts = 5 interval = “10m” delay = “30s” } … } }
  9. HASHICORP job “foobar” { task “my-app” { # Ensure modern

    kernel available constraint { attribute = “kernel.version” version = “>= 3.14” } … } }
  10. HASHICORP job “foobar” { task “my-app” { # Inject environment

    variables env { MY_FEATURE_FLAG = “ON” } … } }
  11. HASHICORP job “foobar” { task “my-app” { # Register with

    Consul for service # discovery and health checking service { port = “http” check { type = “tcp” interval = “10s” } } … } }
  12. HASHICORP job “foobar” { # Make sure this task runs

    everywhere type = “system” # Nothing should evict our collector priority = 100 task “stats-collector” { … } }
  13. Terminal HASHICORP $ nomad agent -dev ==> Starting Nomad agent...

    ==> Nomad agent configuration: Atlas: <disabled> Client: true Log Level: DEBUG Region: global (DC: dc1) Server: true ==> Nomad agent started! Log data will stream in below: [INFO] serf: EventMemberJoin: nomad.global 127.0.0.1 [INFO] nomad: starting 4 scheduling worker(s) for [service batch _core] [INFO] raft: Node at 127.0.0.1:4647 [Follower] entering Follower state [INFO] nomad: adding server nomad.global (Addr: 127.0.0.1:4647) (DC: dc1) [DEBUG] client: applied fingerprints [storage arch cpu host memory] [DEBUG] client: available drivers [docker exec]
  14. HASHICORP Single Region Architecture SERVER SERVER SERVER CLIENT CLIENT CLIENT

    DC1 DC2 DC3 FOLLOWER LEADER FOLLOWER REPLICATION FORWARDING REPLICATION FORWARDING RPC RPC RPC
  15. HASHICORP 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
  16. Nomad HASHICORP Region is Isolation Domain 1-N Datacenters Per Region

    Flexibility to do 1:1 (Consul) Scheduling Boundary
  17. HASHICORP Case Study 3 servers in NYC3 100 clients in

    NYC3, SFO1, AMS2/3 1000 Containers