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

Herding Cattle (Or: Service Discovery Done Right)

Herding Cattle (Or: Service Discovery Done Right)

Michael Hausenblas

October 05, 2015
Tweet

More Decks by Michael Hausenblas

Other Decks in Technology

Transcript

  1. © 2015 Mesosphere, Inc. All Rights Reserved. HERDING CATTLE
 (OR:

    SERVICE DISCOVERY DONE RIGHT) 1 Michael Hausenblas, Developer & Cloud Advocate | 2015-10-05 | LinuxCon Dublin, Ireland
  2. © 2015 Mesosphere, Inc. All Rights Reserved. WHAT
 IS
 THIS


    ALL ABOUT? 3 Pets vs Cattle Pets are individuals that you give names and when they get ill you nurse them back to health. Cattle are anonymous, identical to other cattle you assign numbers and when they get ill → next one. http://www.theregister.co.uk/2013/03/18/servers_pets_or_cattle_cern/
  3. © 2015 Mesosphere, Inc. All Rights Reserved. CONSEQUENCES
 OF GOING


    ALL-IN WITH
 CATTLE APPROACH 4 Pets vs Cattle • scale out on commodity hardware • elasticity • 'cheap' & 'simple' • R U on pager duty? Just sleep through! • social ≫ technology challenge • where the f#@k is my app? http://www.theregister.co.uk/2013/03/18/servers_pets_or_cattle_cern/
  4. © 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY 101

    9 how do you know on which
 IP:PORT
 your app runs?
  5. © 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY CHALLENGES

    10 • Remember the location, that is IP:PORT of each app across re-launches throughout the cluster • Potentially exclude unhealthy hosts • Others/related • strong consistency vs. highly available
 (or: the CAP theorem strikes, again) • how about load balancing?
  6. © 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY
 ESSENTIAL

    11 Source: O'Reilly book 'Docker in Production', 2015. • service announcement • service lookup
  7. © 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY
 OPTIONS

    12 Name Consistency Language Options etcd strong Go sidekick+client registration Eureka eventual Java client registration Consul strong Go auto | Traefik Mesos-DNS strong Go auto | Traefik (Marathon) SkyDNS strong Go client registration Weave-DNS strong Go auto Zookeeper strong Java client registration http://programmableinfrastructure.com/components/service-discovery/
  8. © 2015 Mesosphere, Inc. All Rights Reserved. LOCAL OS VS.

    DISTRIBUTED OS 15 http://bitly.com/os-vs-dcos
  9. © 2015 Mesosphere, Inc. All Rights Reserved. DCOS IS A

    DISTRIBUTED OPERATING SYSTEM 16 • kernel (Apache Mesos, written in C++) scales to 10,000 of nodes • fault-tolerant in all components, rolling upgrades throughout • containers first class citizens (LXC, Docker) • local OS per node (+container enabled) • scheduling (long-lived, batch) • service discovery, monitoring, logging, debugging
  10. © 2015 Mesosphere, Inc. All Rights Reserved. BENEFITS 18 DCOS

    • Run stateless services such as Web servers, app servers (via Marathon) and stateful services like Crate, Kafka, HDFS, Cassandra, ArangoDB etc. together on one cluster • Dynamic partitioning of your cluster, depending on your needs (business requirements) • Increased utilization (10% → 80% an more)
  11. © 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY
 EXAMPLE

    2 21 { "id": "webserver", "cmd": "python3 -m http.server 8080", "cpus": 0.5, "mem": 32.0, "container": { "type": "DOCKER", "docker": { "image": "python:3", "network": "BRIDGE", "portMappings": [ { "containerPort": 8080, "hostPort": 0 } ] } }, "acceptedResourceRoles": [ "slave_public" ], "constraints": [ [ "hostname", "UNIQUE" ] ] }
  12. © 2015 Mesosphere, Inc. All Rights Reserved. MESOSPHERE IS HIRING,

    WORLDWIDE … San Francisco New York Hamburg https://mesosphere.com/careers/
  13. © 2015 Mesosphere, Inc. All Rights Reserved. Q & A

    24 • @mhausenblas • mhausenblas.info • @mesosphere • mesosphere.io/product Kudos for material in this talk go out to:
 The folks who wrote 'Docker in Production' and my colleagues from p24e.io http://shop.oreilly.com/product/9781939902184.do http://p24e.io