SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Cassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoCassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoJon Haddad
 
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 SceneJelastic Multi-Cloud PaaS
 
Single tenant software to multi-tenant SaaS using K8S
Single tenant software to multi-tenant SaaS using K8SSingle tenant software to multi-tenant SaaS using K8S
Single tenant software to multi-tenant SaaS using K8SCloudLinux
 
Reactive microservices with play and akka
Reactive microservices with play and akkaReactive microservices with play and akka
Reactive microservices with play and akkascalaconfjp
 
Diagnosing Problems in Production - Cassandra
Diagnosing Problems in Production - CassandraDiagnosing Problems in Production - Cassandra
Diagnosing Problems in Production - CassandraJon Haddad
 
Microservices Runtimes
Microservices RuntimesMicroservices Runtimes
Microservices RuntimesFrank Munz
 
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov Docker, Inc.
 
Put Your Thinking CAP On
Put Your Thinking CAP OnPut Your Thinking CAP On
Put Your Thinking CAP OnTomer Gabel
 
Docker Service Registration and Discovery
Docker Service Registration and DiscoveryDocker Service Registration and Discovery
Docker Service Registration and Discoverym_richardson
 
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...Docker, Inc.
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM DeploymentJoe Kutner
 
12 Factor Scala
12 Factor Scala12 Factor Scala
12 Factor ScalaJoe Kutner
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOpsYongHyuk Lee
 
Diagnosing Problems in Production (Nov 2015)
Diagnosing Problems in Production (Nov 2015)Diagnosing Problems in Production (Nov 2015)
Diagnosing Problems in Production (Nov 2015)Jon Haddad
 
Opening of Cloud Native Taiwan User Group Meetup#2
Opening of Cloud Native Taiwan User Group Meetup#2Opening of Cloud Native Taiwan User Group Meetup#2
Opening of Cloud Native Taiwan User Group Meetup#2HungWei Chiu
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresChristian Posta
 

La actualidad más candente (17)

Cassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoCassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day Toronto
 
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
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Single tenant software to multi-tenant SaaS using K8S
Single tenant software to multi-tenant SaaS using K8SSingle tenant software to multi-tenant SaaS using K8S
Single tenant software to multi-tenant SaaS using K8S
 
Reactive microservices with play and akka
Reactive microservices with play and akkaReactive microservices with play and akka
Reactive microservices with play and akka
 
Diagnosing Problems in Production - Cassandra
Diagnosing Problems in Production - CassandraDiagnosing Problems in Production - Cassandra
Diagnosing Problems in Production - Cassandra
 
Microservices Runtimes
Microservices RuntimesMicroservices Runtimes
Microservices Runtimes
 
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
 
Put Your Thinking CAP On
Put Your Thinking CAP OnPut Your Thinking CAP On
Put Your Thinking CAP On
 
Docker Service Registration and Discovery
Docker Service Registration and DiscoveryDocker Service Registration and Discovery
Docker Service Registration and Discovery
 
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
 
12 Factor Scala
12 Factor Scala12 Factor Scala
12 Factor Scala
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOps
 
Diagnosing Problems in Production (Nov 2015)
Diagnosing Problems in Production (Nov 2015)Diagnosing Problems in Production (Nov 2015)
Diagnosing Problems in Production (Nov 2015)
 
Opening of Cloud Native Taiwan User Group Meetup#2
Opening of Cloud Native Taiwan User Group Meetup#2Opening of Cloud Native Taiwan User Group Meetup#2
Opening of Cloud Native Taiwan User Group Meetup#2
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
 

Destacado

Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Docker, Inc.
 
DockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the ServersDockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the ServersDocker, Inc.
 
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...Docker, Inc.
 
Dockerfile Basics Workshop #1
Dockerfile Basics Workshop #1Dockerfile Basics Workshop #1
Dockerfile Basics Workshop #1Docker, Inc.
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker, Inc.
 
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)Docker, Inc.
 
Docker Online Meetup #30: Docker Trusted Registry 1.4.1
Docker Online Meetup #30: Docker Trusted Registry 1.4.1Docker Online Meetup #30: Docker Trusted Registry 1.4.1
Docker Online Meetup #30: Docker Trusted Registry 1.4.1Docker, Inc.
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryDocker, Inc.
 
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad AfanahOn-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad AfanahDocker, Inc.
 
Docker at DevTable
Docker at DevTableDocker at DevTable
Docker at DevTableDocker, Inc.
 
Docker at RelateIQ
Docker at RelateIQDocker at RelateIQ
Docker at RelateIQDocker, Inc.
 
DockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by TianonDockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by TianonDocker, Inc.
 
Test What You Write, Ship What You Test
Test What You Write, Ship What You TestTest What You Write, Ship What You Test
Test What You Write, Ship What You TestDocker, Inc.
 
Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2Docker, Inc.
 
DockerCon Recap - Online Meetup by Ben Firshman
DockerCon Recap - Online Meetup by Ben FirshmanDockerCon Recap - Online Meetup by Ben Firshman
DockerCon Recap - Online Meetup by Ben FirshmanDocker, Inc.
 
DockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout SessionDockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout SessionDocker, Inc.
 
DockerCon SF 2015: From Months to Minutes
DockerCon SF 2015: From Months to MinutesDockerCon SF 2015: From Months to Minutes
DockerCon SF 2015: From Months to MinutesDocker, Inc.
 

Destacado (20)

Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane
 
DockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the ServersDockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the Servers
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
 
Docker at Spotify
Docker at SpotifyDocker at Spotify
Docker at Spotify
 
Dockerfile Basics Workshop #1
Dockerfile Basics Workshop #1Dockerfile Basics Workshop #1
Dockerfile Basics Workshop #1
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
 
Docker Online Meetup #30: Docker Trusted Registry 1.4.1
Docker Online Meetup #30: Docker Trusted Registry 1.4.1Docker Online Meetup #30: Docker Trusted Registry 1.4.1
Docker Online Meetup #30: Docker Trusted Registry 1.4.1
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous Delivery
 
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad AfanahOn-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
 
Developer Week
Developer WeekDeveloper Week
Developer Week
 
Docker at DevTable
Docker at DevTableDocker at DevTable
Docker at DevTable
 
Docker at RelateIQ
Docker at RelateIQDocker at RelateIQ
Docker at RelateIQ
 
DockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by TianonDockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by Tianon
 
Test What You Write, Ship What You Test
Test What You Write, Ship What You TestTest What You Write, Ship What You Test
Test What You Write, Ship What You Test
 
Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2
 
DockerCon Recap - Online Meetup by Ben Firshman
DockerCon Recap - Online Meetup by Ben FirshmanDockerCon Recap - Online Meetup by Ben Firshman
DockerCon Recap - Online Meetup by Ben Firshman
 
DockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout SessionDockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout Session
 
DockerCon SF 2015: From Months to Minutes
DockerCon SF 2015: From Months to MinutesDockerCon SF 2015: From Months to Minutes
DockerCon SF 2015: From Months to Minutes
 

Similar a Building a Smarter Application Stack

Microservices pros and cons dark
Microservices pros and cons darkMicroservices pros and cons dark
Microservices pros and cons darkAndrew Siemer
 
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 festAndrew Siemer
 
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 GoelevenParticular Software
 
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...Eric D. Schabell
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native ApplicationEmiliano Pecis
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn Adams
 
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!Stuart Charlton
 
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 OpenEBS
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerWeb à Québec
 
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 AWSBrett McLain
 
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 ToolsVasiliy Fomichev
 
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…Sergey Dzyuban
 
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 MicroservicesLightbend
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceEvan McGee
 
Deploying microservices on AWS
Deploying microservices on AWSDeploying microservices on AWS
Deploying microservices on AWSMichael Haberman
 
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 ...Josef Adersberger
 
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
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresDocker, Inc.
 
Docker-N-Beyond
Docker-N-BeyondDocker-N-Beyond
Docker-N-Beyondsantosh007
 

Similar a Building a Smarter Application Stack (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
 
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
 
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, ...
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failures
 
Docker-N-Beyond
Docker-N-BeyondDocker-N-Beyond
Docker-N-Beyond
 

Más de Docker, Inc.

Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience Docker, Inc.
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildDocker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSDocker, Inc.
 
Securing Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINXSecuring Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINXDocker, Inc.
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeDocker, Inc.
 
Distributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDistributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDocker, Inc.
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubDocker, Inc.
 
Monitoring in a Microservices World
Monitoring in a Microservices WorldMonitoring in a Microservices World
Monitoring in a Microservices WorldDocker, Inc.
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...Docker, Inc.
 
Predicting Space Weather with Docker
Predicting Space Weather with DockerPredicting Space Weather with Docker
Predicting Space Weather with DockerDocker, Inc.
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeDocker, Inc.
 
How to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryHow to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryDocker, Inc.
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Docker, Inc.
 
Kubernetes at Datadog Scale
Kubernetes at Datadog ScaleKubernetes at Datadog Scale
Kubernetes at Datadog ScaleDocker, Inc.
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels Docker, Inc.
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelDocker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSDocker, Inc.
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...Docker, Inc.
 
Developing with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDeveloping with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDocker, Inc.
 

Más de Docker, Inc. (20)

Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
Securing Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINXSecuring Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINX
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Hands-on Helm
Hands-on Helm Hands-on Helm
Hands-on Helm
 
Distributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDistributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at Salesforce
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker Hub
 
Monitoring in a Microservices World
Monitoring in a Microservices WorldMonitoring in a Microservices World
Monitoring in a Microservices World
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
 
Predicting Space Weather with Docker
Predicting Space Weather with DockerPredicting Space Weather with Docker
Predicting Space Weather with Docker
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio Code
 
How to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryHow to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container Registry
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!
 
Kubernetes at Datadog Scale
Kubernetes at Datadog ScaleKubernetes at Datadog Scale
Kubernetes at Datadog Scale
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
 
Developing with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDeveloping with Docker for the Arm Architecture
Developing with Docker for the Arm Architecture
 

Building a Smarter Application Stack

  • 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