Share
Embed
Herding Cattle (Or: Service Discovery Done Right)
Talk at LinuxCon, Europe, see https://lceeu2015.sched.org/event/3a7c04b30416a33a7567282b40d32a96
Michael Hausenblas
October 05, 2015
Transcript
24 slides
-
© 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 -
© 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/ -
© 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/ -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY 101
7 step 1: deployment -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY 101
8 step 2: end-user request -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY 101
9 how do you know on which IP:PORT your app runs? -
© 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? -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY ESSENTIAL
11 Source: O'Reilly book 'Docker in Production', 2015. • service announcement • service lookup -
© 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/ -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY EXAMPLE
1 13 Simple Docker container -
© 2015 Mesosphere, Inc. All Rights Reserved. MEET THE DATA
CENTER OPERATING SYSTEM 14 -
© 2015 Mesosphere, Inc. All Rights Reserved. LOCAL OS VS.
DISTRIBUTED OS 15 http://bitly.com/os-vs-dcos -
© 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 -
© 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) -
© 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" ] ] } -
© 2015 Mesosphere, Inc. All Rights Reserved. SERVICE DISCOVERY EXAMPLE
2 22 http://mesosphere.github.io/mesos-dns/ -
© 2015 Mesosphere, Inc. All Rights Reserved. MESOSPHERE IS HIRING,
WORLDWIDE … San Francisco New York Hamburg https://mesosphere.com/careers/ -
© 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