SlideShare a Scribd company logo
1 of 42
Download to read offline
Building a smarter application stack
Tomas	
  Doran	
  
@bobtfish	
  
2014-­‐06-­‐10
Docker is the future
• Preaching to the converted here ;)

• Game changing technology

• No silver bullets (ever)
• Introduces it’s own set of problems and issues
• Dependency discovery / wiring
• Scheduling
2
Smartstack
• One possible solution to discovery
problems

• This talk:
• Application architecture
• Problem(s) we’re solving
• Why this solution works well for us
• Alternate solutions
3
Microservices - also the future!
• The same as SOA
• But one API per service.
• Own data store!

• Lots of services (dozens, maybe 100s)

• All individually very simple
• Easy to reason about.
• Easy to replace
4
Don’t break the site - ever!!!
• Microservices are individually deployable!
• When we say “Don’t break the site”
• We mean
• Don’t break all of the site!
5
Don’t break the site - ever!!!
• If you have graceful degradation…
• You can ignore MTBF in the backend services!
• You only care about MTTR.
6
“I’ll just break this out into it’s own
application, as it’ll be easier to
maintain in 10 years time”
- Pre seed funding
nobody, ever!
7
Monolith - the reality
• Everyone has one of these :)
• If you’re far enough down the path, you call
this ‘The presentation layer’.

• Still poses a challenge
• need async requests
• need graceful degradation
8
Monolith - the reality
• Most popular service

• Most dependencies
• Call into 10s or 100s of other services in a
request!

• Needs circuit breakers + dynamic
configuration
9
No silver bullet = No one solution
• You should always have 2.
• Nagios / Sensu
• RRDs + Ganglia / Graphite + Diamond
• YAML files / Zookeeper
10
No silver bullet = No one solution
• ‘Top down’ architecture sucks.
• Instead, broad goals + ’Bottom up’ architecture
• Internal competition!
• Replacing the incumbent solution happens
organically
• If your thing works better, people will want to
move! 

• Not perfect! Better than top-down!
11
“Humans are bad at predicting the performance of
complex systems […]. Our ability to create large
and complex systems fools us into believing that
we’re also entitled to understand them”

- Carlos Bueno “Mature optimization handbook”

12
Distributed complexity
• Distributed systems introduce their own set of complexity
• Reasoning about the whole system challenging
• Timing/profiling/performance analysis non-trivial
• Resource scheduling also non-trivial
• 2nd order effects
!
• Can’t reason about emergent behavior
13
14
15
?
16
?
What the heck happened at 16:46?
17
?
And why did it stop at 17:00?
Dynamic architecture
• Cattle not pets
• AWS and VMs in ‘the cloud’ started this
• Docker takes it a step further

• Explicitly manage persistent state
• Explicit regular recycling
• All updates are redeploys

18
Dependency nightmares
• Almost everything has some dependencies
• Simple example, web app with a mysql DB
• App config in a YAML file

• Mysql container address changes when you restart mysql!
• Oops, app can’t find mysql!

• Do I need to restart every application using mysql?
• Sucks!
• Do I need to rebuild application containers using mysql?
• To edit the config YAML file!
• Super super sucks! 19
Runtime wiring
• mysql failovers - the simple case!

• Presentation layer talking to service REST layers
• Different deployment schedules
• No downtime

• Only possible solution: wiring dependencies at runtime
• A challenge
• Also an opportunity

• DNS is workable in some cases
20
Dynamic discovery
• Discovery becomes a core problem

• DNS re-resolving not generally trustworthy
• You need to test everything for this

• DNS balancing (internally) is awful
• Failed node + multiple connections/requests
• DNS round robin
• Everything sees failure
• Slow to shift traffic
• Round robin is crappy for load balancing

21
Externalized wiring
• Remove a lot of complexity from the application domain

• Run a load balancer (haproxy) on each machine

• Applications always connect to load balancer on fixed
host/port
• localhost on traditional metal/VMs
• supplied by —link or environment variables in Docker

• Applications become wiring agnostic!
22
Externalized wiring
23
‘Client side load balancing’
• Lots of projects use this approach:
• Project Atomic
• Marathon + Mesos-Docker
• vulcand (https://github.com/mailgun/vulcand)
• Frontrunner (https://github.com/Wizcorp/
frontrunner)
• Consul
!
• Smartstack
24
Legacy infrastructure
• Physical machines
• Application images in AMIs
• kvm

• Can’t just use container links or a Docker only
solution

• Want to use the same (uniform) solution
everywhere.
25
Entropy reduction
• You can’t change everything at once!

• Everything will tend towards chaos
• ‘Old infrastructure’
• ‘New infrastructure’
• ‘New new infrastructure’
!
• Solution specifically chosen so it could be generic.
26
SmartStack
• 2 parts
• Synapse
• Nerve
!
• Conceptually simple
• Very flexible
• Easy to hack on
• Plays well on traditional machines
• Plays well in docker
27
Synapse
• Does discovery against a pluggable backend
• Writes out a haproxy configuration

• Assign a well known port to all services
• Application connects to that port
• haproxy forwards to an available backend

• Your application doesn’t need to know about discovery!

• Technology agnostic - works the same on metal/VMs/Docker
28
29
Why synapse?
• haproxy is a well known solution
• ruby - easy to modify
• simple (has one job)
• Pluggable - discovery with multiple methods:
• JSON config (static)
• zookeeper
• etcd
• docker API
• ec2 tags
• Flexible
• Deploy one per instance
• Or pairs as dedicated lbs 30
Nerve
• Health checks services
• Health checks are pluggable.
• HTTP (flexible) + mysql come out the box
• Registers service information to backend
• zookeeper
• etcd (beta)
31
32
Connector agnostic containers
• On ‘real servers’ or VMs, running a synapse
instance per box is fine.

• In docker, we want to abstract more than that
• Make containers connector agnostic!
• They don’t need to know or care
• Upgrade independently.
33
Synapse <3 ambassador
containers
• ‘Ambassador pattern’
• Run a synapse ‘ambassador’ container on each host
for each service
• Link each application to the ambassador for each of
it’s dependencies
• Environment variables to each service’s haproxy
• Separates synapse management (i.e. changing the
wiring) from application management (i.e.
upgrading the app version).
34
35
Container links
• Ambassador for service A presents:
• port 8000 for HTTP REST service
• port 8443 for HTTPS REST service
!
• Container linking to ambassador sees:
• SRVA_PORT_8000_TCP=tcp://172.17.0.8:6379
• SRVA_PORT_8000_TCP_PROTO=tcp
• SRVA_PORT_8000_TCP_ADDR=172.17.0.8
• SRVA_PORT_8000_TCP_PORT=6379
• SRVA_PORT_8443_TCP=tcp://172.17.0.8:6380
• SRVA_PORT_8443_TCP_PROTO=tcp
• SRVA_PORT_8443_TCP_ADDR=172.17.0.8
• SRVA_PORT_8443_TCP_PORT=6380
36
Nerve registration container
• Each app container gets a Nerve instance
• Nerve registers its 1 app
• Nerve instance can be generic
• Make services all have a standard /health
endpoint
• Healthchecks standard
• Only need one nerve container image!
37
Alternate options
• Just register the contents of the docker API into etcd
• http://coreos.com/blog/docker-dynamic-ambassador-
powered-by-etcd/
• No health checks
• Docker only
• confd
• Consul
• frontrunner - discovery from Marathon
• Uses haproxy too
• Less health checking options
38
Vulcand
39
Issues
• If you have lots of machines + services, you have a lot
of Synapses
• haproxy health checks can become expensive on
end user apps
• Nerve helps with this

• Lots of small load balancers is harder to reason about
than a few big ones
40
Live demo?
41
Thanks
• Slides will be online

http://slideshare.net/bobtfish

• Official Smartstack site:

http://nerds.airbnb.com/smartstack-service-discovery-cloud/

• Pre-built containers to play with + blog post

http://engineeringblog.yelp.com/

https://index.docker.io/u/bobtfish/synapse-etcd-amb/

https://index.docker.io/u/bobtfish/nerve-etcd/

• Questions?
42

More Related Content

What's hot

London devops logging
London devops loggingLondon devops logging
London devops logging
Tomas Doran
 

What's hot (20)

Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
How Yelp does Service Discovery
How Yelp does Service DiscoveryHow Yelp does Service Discovery
How Yelp does Service Discovery
 
Service discovery in Docker environments
Service discovery in Docker environmentsService discovery in Docker environments
Service discovery in Docker environments
 
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
 
Cassandra on Docker
Cassandra on DockerCassandra on Docker
Cassandra on Docker
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Distributed automation sel_conf_2015
Distributed automation sel_conf_2015Distributed automation sel_conf_2015
Distributed automation sel_conf_2015
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud Maker
 
Cassandra and docker
Cassandra and dockerCassandra and docker
Cassandra and docker
 
Ansible Oxford - Cows & Containers
Ansible Oxford - Cows & ContainersAnsible Oxford - Cows & Containers
Ansible Oxford - Cows & Containers
 
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
Monitor-Driven Development Using Ansible
Monitor-Driven Development Using AnsibleMonitor-Driven Development Using Ansible
Monitor-Driven Development Using Ansible
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraForm
 
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and AnsibleService Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
London devops logging
London devops loggingLondon devops logging
London devops logging
 
Ansible - A 'crowd' introduction
Ansible - A 'crowd' introductionAnsible - A 'crowd' introduction
Ansible - A 'crowd' introduction
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
 

Viewers also liked

Cumulonimbus fortification-secure-your-data-in-the-cloud
Cumulonimbus fortification-secure-your-data-in-the-cloudCumulonimbus fortification-secure-your-data-in-the-cloud
Cumulonimbus fortification-secure-your-data-in-the-cloud
David Busby, CISSP
 

Viewers also liked (20)

Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data stores
 
Service Discovery in Distributed Systems
Service Discovery in Distributed SystemsService Discovery in Distributed Systems
Service Discovery in Distributed Systems
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
Cumulonimbus fortification-secure-your-data-in-the-cloud
Cumulonimbus fortification-secure-your-data-in-the-cloudCumulonimbus fortification-secure-your-data-in-the-cloud
Cumulonimbus fortification-secure-your-data-in-the-cloud
 
Dear IT...I'd Like A Kubernetes Cluster
Dear IT...I'd Like A Kubernetes ClusterDear IT...I'd Like A Kubernetes Cluster
Dear IT...I'd Like A Kubernetes Cluster
 
Introducing Kubernetes Clusters in Rancher - February 2016 Online Meetup
Introducing Kubernetes Clusters in Rancher - February 2016 Online MeetupIntroducing Kubernetes Clusters in Rancher - February 2016 Online Meetup
Introducing Kubernetes Clusters in Rancher - February 2016 Online Meetup
 
Next Gen Storage and Networking in Container Environments - September 2016 Ra...
Next Gen Storage and Networking in Container Environments - September 2016 Ra...Next Gen Storage and Networking in Container Environments - September 2016 Ra...
Next Gen Storage and Networking in Container Environments - September 2016 Ra...
 
Rancher March 2016 Online Meetup Containers-as-a-Service with Rancher 1.0
Rancher March 2016 Online Meetup Containers-as-a-Service with Rancher 1.0Rancher March 2016 Online Meetup Containers-as-a-Service with Rancher 1.0
Rancher March 2016 Online Meetup Containers-as-a-Service with Rancher 1.0
 
Storage for containers and cloud-native deployments - Rancher Online Meetup -...
Storage for containers and cloud-native deployments - Rancher Online Meetup -...Storage for containers and cloud-native deployments - Rancher Online Meetup -...
Storage for containers and cloud-native deployments - Rancher Online Meetup -...
 
PuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon Cherry
PuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon CherryPuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon Cherry
PuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon Cherry
 
Automate CI/CD with Rancher
Automate CI/CD with RancherAutomate CI/CD with Rancher
Automate CI/CD with Rancher
 
Deploying Containers with Rancher
Deploying Containers with RancherDeploying Containers with Rancher
Deploying Containers with Rancher
 
Workshop WSO2 BPS 3.5.x - BPMN
Workshop WSO2 BPS 3.5.x - BPMN Workshop WSO2 BPS 3.5.x - BPMN
Workshop WSO2 BPS 3.5.x - BPMN
 
The ultimate container monitoring bake-off - Rancher Online Meetup October 2016
The ultimate container monitoring bake-off - Rancher Online Meetup October 2016The ultimate container monitoring bake-off - Rancher Online Meetup October 2016
The ultimate container monitoring bake-off - Rancher Online Meetup October 2016
 
WTF Is Rancher?
WTF Is Rancher?WTF Is Rancher?
WTF Is Rancher?
 
Docker In the Bank
Docker In the BankDocker In the Bank
Docker In the Bank
 
WILD microSERVICES v2
WILD microSERVICES v2WILD microSERVICES v2
WILD microSERVICES v2
 
Intro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratchIntro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratch
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 

Similar to Building a smarter application stack - service discovery and wiring for Docker

Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
QAware GmbH
 

Similar to Building a smarter application stack - service discovery and wiring for Docker (20)

Microservices pros and cons dark
Microservices pros and cons darkMicroservices pros and cons dark
Microservices pros and cons dark
 
Microservices pros and cons - houston tech fest
Microservices pros and cons - houston tech festMicroservices pros and cons - houston tech fest
Microservices pros and cons - houston tech fest
 
Jelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the SceneJelastic - Containers Live Migration Behind the Scene
Jelastic - Containers Live Migration Behind the Scene
 
The impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves GoelevenThe impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves Goeleven
 
Allyourbase
AllyourbaseAllyourbase
Allyourbase
 
PromCon EU 2022 - Centralized vs Decentralized Prometheus Scraping Architectu...
PromCon EU 2022 - Centralized vs Decentralized Prometheus Scraping Architectu...PromCon EU 2022 - Centralized vs Decentralized Prometheus Scraping Architectu...
PromCon EU 2022 - Centralized vs Decentralized Prometheus Scraping Architectu...
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native Application
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with Docker
 
Scaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSScaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWS
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
LASUG Online: Introduction to Docker and Docker Tools
LASUG Online: Introduction to Docker and Docker ToolsLASUG Online: Introduction to Docker and Docker Tools
LASUG Online: Introduction to Docker and Docker Tools
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
 
Digital Transformation with Kubernetes, Containers, and Microservices
Digital Transformation with Kubernetes, Containers, and MicroservicesDigital Transformation with Kubernetes, Containers, and Microservices
Digital Transformation with Kubernetes, Containers, and Microservices
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
Deploying microservices on AWS
Deploying microservices on AWSDeploying microservices on AWS
Deploying microservices on AWS
 
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ... The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
 

More from Tomas Doran

Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)
Tomas Doran
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
Tomas Doran
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
Tomas Doran
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
Tomas Doran
 
High scale flavour
High scale flavourHigh scale flavour
High scale flavour
Tomas Doran
 
Large platform architecture in (mostly) perl - an illustrated tour
Large platform architecture in (mostly) perl - an illustrated tourLarge platform architecture in (mostly) perl - an illustrated tour
Large platform architecture in (mostly) perl - an illustrated tour
Tomas Doran
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
Tomas Doran
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
Tomas Doran
 

More from Tomas Doran (20)

Deploying puppet code at light speed
Deploying puppet code at light speedDeploying puppet code at light speed
Deploying puppet code at light speed
 
Thinking through puppet code layout
Thinking through puppet code layoutThinking through puppet code layout
Thinking through puppet code layout
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
"The worst code I ever wrote"
"The worst code I ever wrote""The worst code I ever wrote"
"The worst code I ever wrote"
 
Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)
 
Test driven infrastructure development
Test driven infrastructure developmentTest driven infrastructure development
Test driven infrastructure development
 
London devops - orc
London devops - orcLondon devops - orc
London devops - orc
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logs
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
High scale flavour
High scale flavourHigh scale flavour
High scale flavour
 
Large platform architecture in (mostly) perl - an illustrated tour
Large platform architecture in (mostly) perl - an illustrated tourLarge platform architecture in (mostly) perl - an illustrated tour
Large platform architecture in (mostly) perl - an illustrated tour
 
Large platform architecture in (mostly) perl
Large platform architecture in (mostly) perlLarge platform architecture in (mostly) perl
Large platform architecture in (mostly) perl
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
CatalystX::SimpleLogin
CatalystX::SimpleLoginCatalystX::SimpleLogin
CatalystX::SimpleLogin
 

Recently uploaded

💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 

Recently uploaded (20)

20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 

Building a smarter application stack - service discovery and wiring for Docker

  • 1. Building a smarter application stack Tomas  Doran   @bobtfish   2014-­‐06-­‐10
  • 2. Docker is the future • Preaching to the converted here ;)
 • Game changing technology
 • No silver bullets (ever) • Introduces it’s own set of problems and issues • Dependency discovery / wiring • Scheduling 2
  • 3. Smartstack • One possible solution to discovery problems
 • This talk: • Application architecture • Problem(s) we’re solving • Why this solution works well for us • Alternate solutions 3
  • 4. Microservices - also the future! • The same as SOA • But one API per service. • Own data store!
 • Lots of services (dozens, maybe 100s)
 • All individually very simple • Easy to reason about. • Easy to replace 4
  • 5. Don’t break the site - ever!!! • Microservices are individually deployable! • When we say “Don’t break the site” • We mean • Don’t break all of the site! 5
  • 6. Don’t break the site - ever!!! • If you have graceful degradation… • You can ignore MTBF in the backend services! • You only care about MTTR. 6
  • 7. “I’ll just break this out into it’s own application, as it’ll be easier to maintain in 10 years time” - Pre seed funding nobody, ever! 7
  • 8. Monolith - the reality • Everyone has one of these :) • If you’re far enough down the path, you call this ‘The presentation layer’.
 • Still poses a challenge • need async requests • need graceful degradation 8
  • 9. Monolith - the reality • Most popular service
 • Most dependencies • Call into 10s or 100s of other services in a request!
 • Needs circuit breakers + dynamic configuration 9
  • 10. No silver bullet = No one solution • You should always have 2. • Nagios / Sensu • RRDs + Ganglia / Graphite + Diamond • YAML files / Zookeeper 10
  • 11. No silver bullet = No one solution • ‘Top down’ architecture sucks. • Instead, broad goals + ’Bottom up’ architecture • Internal competition! • Replacing the incumbent solution happens organically • If your thing works better, people will want to move! 
 • Not perfect! Better than top-down! 11
  • 12. “Humans are bad at predicting the performance of complex systems […]. Our ability to create large and complex systems fools us into believing that we’re also entitled to understand them”
 - Carlos Bueno “Mature optimization handbook”
 12
  • 13. Distributed complexity • Distributed systems introduce their own set of complexity • Reasoning about the whole system challenging • Timing/profiling/performance analysis non-trivial • Resource scheduling also non-trivial • 2nd order effects ! • Can’t reason about emergent behavior 13
  • 14. 14
  • 15. 15 ?
  • 16. 16 ? What the heck happened at 16:46?
  • 17. 17 ? And why did it stop at 17:00?
  • 18. Dynamic architecture • Cattle not pets • AWS and VMs in ‘the cloud’ started this • Docker takes it a step further
 • Explicitly manage persistent state • Explicit regular recycling • All updates are redeploys
 18
  • 19. Dependency nightmares • Almost everything has some dependencies • Simple example, web app with a mysql DB • App config in a YAML file
 • Mysql container address changes when you restart mysql! • Oops, app can’t find mysql!
 • Do I need to restart every application using mysql? • Sucks! • Do I need to rebuild application containers using mysql? • To edit the config YAML file! • Super super sucks! 19
  • 20. Runtime wiring • mysql failovers - the simple case!
 • Presentation layer talking to service REST layers • Different deployment schedules • No downtime
 • Only possible solution: wiring dependencies at runtime • A challenge • Also an opportunity
 • DNS is workable in some cases 20
  • 21. Dynamic discovery • Discovery becomes a core problem
 • DNS re-resolving not generally trustworthy • You need to test everything for this
 • DNS balancing (internally) is awful • Failed node + multiple connections/requests • DNS round robin • Everything sees failure • Slow to shift traffic • Round robin is crappy for load balancing
 21
  • 22. Externalized wiring • Remove a lot of complexity from the application domain
 • Run a load balancer (haproxy) on each machine
 • Applications always connect to load balancer on fixed host/port • localhost on traditional metal/VMs • supplied by —link or environment variables in Docker
 • Applications become wiring agnostic! 22
  • 24. ‘Client side load balancing’ • Lots of projects use this approach: • Project Atomic • Marathon + Mesos-Docker • vulcand (https://github.com/mailgun/vulcand) • Frontrunner (https://github.com/Wizcorp/ frontrunner) • Consul ! • Smartstack 24
  • 25. Legacy infrastructure • Physical machines • Application images in AMIs • kvm
 • Can’t just use container links or a Docker only solution
 • Want to use the same (uniform) solution everywhere. 25
  • 26. Entropy reduction • You can’t change everything at once!
 • Everything will tend towards chaos • ‘Old infrastructure’ • ‘New infrastructure’ • ‘New new infrastructure’ ! • Solution specifically chosen so it could be generic. 26
  • 27. SmartStack • 2 parts • Synapse • Nerve ! • Conceptually simple • Very flexible • Easy to hack on • Plays well on traditional machines • Plays well in docker 27
  • 28. Synapse • Does discovery against a pluggable backend • Writes out a haproxy configuration
 • Assign a well known port to all services • Application connects to that port • haproxy forwards to an available backend
 • Your application doesn’t need to know about discovery!
 • Technology agnostic - works the same on metal/VMs/Docker 28
  • 29. 29
  • 30. Why synapse? • haproxy is a well known solution • ruby - easy to modify • simple (has one job) • Pluggable - discovery with multiple methods: • JSON config (static) • zookeeper • etcd • docker API • ec2 tags • Flexible • Deploy one per instance • Or pairs as dedicated lbs 30
  • 31. Nerve • Health checks services • Health checks are pluggable. • HTTP (flexible) + mysql come out the box • Registers service information to backend • zookeeper • etcd (beta) 31
  • 32. 32
  • 33. Connector agnostic containers • On ‘real servers’ or VMs, running a synapse instance per box is fine.
 • In docker, we want to abstract more than that • Make containers connector agnostic! • They don’t need to know or care • Upgrade independently. 33
  • 34. Synapse <3 ambassador containers • ‘Ambassador pattern’ • Run a synapse ‘ambassador’ container on each host for each service • Link each application to the ambassador for each of it’s dependencies • Environment variables to each service’s haproxy • Separates synapse management (i.e. changing the wiring) from application management (i.e. upgrading the app version). 34
  • 35. 35
  • 36. Container links • Ambassador for service A presents: • port 8000 for HTTP REST service • port 8443 for HTTPS REST service ! • Container linking to ambassador sees: • SRVA_PORT_8000_TCP=tcp://172.17.0.8:6379 • SRVA_PORT_8000_TCP_PROTO=tcp • SRVA_PORT_8000_TCP_ADDR=172.17.0.8 • SRVA_PORT_8000_TCP_PORT=6379 • SRVA_PORT_8443_TCP=tcp://172.17.0.8:6380 • SRVA_PORT_8443_TCP_PROTO=tcp • SRVA_PORT_8443_TCP_ADDR=172.17.0.8 • SRVA_PORT_8443_TCP_PORT=6380 36
  • 37. Nerve registration container • Each app container gets a Nerve instance • Nerve registers its 1 app • Nerve instance can be generic • Make services all have a standard /health endpoint • Healthchecks standard • Only need one nerve container image! 37
  • 38. Alternate options • Just register the contents of the docker API into etcd • http://coreos.com/blog/docker-dynamic-ambassador- powered-by-etcd/ • No health checks • Docker only • confd • Consul • frontrunner - discovery from Marathon • Uses haproxy too • Less health checking options 38
  • 40. Issues • If you have lots of machines + services, you have a lot of Synapses • haproxy health checks can become expensive on end user apps • Nerve helps with this
 • Lots of small load balancers is harder to reason about than a few big ones 40
  • 42. Thanks • Slides will be online
 http://slideshare.net/bobtfish
 • Official Smartstack site:
 http://nerds.airbnb.com/smartstack-service-discovery-cloud/
 • Pre-built containers to play with + blog post
 http://engineeringblog.yelp.com/
 https://index.docker.io/u/bobtfish/synapse-etcd-amb/
 https://index.docker.io/u/bobtfish/nerve-etcd/
 • Questions? 42