Service discovery in
Mesos Cluster
Miguel Angel Guillen
AeriaGames GmbH
Who am I?
● From Elche(Spain)
● Working in Berlin
in AeriaGames
● DevOps,Sysadmin,
SRE, etc…
● Video Games
AERIA GAMES
Different partners and
technologies
Mesos
● Cluster resources
● Supports docker containers
● Is really cool
● Mesos and Beyond was before this talk!!
Service discovery
“Service discovery tools manage how
processes and services in a cluster can find
and talk to one another.”
DNS
● More basic service discovery
● But A records are really simple
● SRV records are really useful
● Few services supports SRV
Service Discovery tools
● Provides a service registry system
● Integrates with an API
● Provides meta-data of the service
● Use or provides a K/V store
● It provides libraries and tools
Service Discovery tools
● Zookeeper
K/V store
libraries
● ETCD
K/V store
libraries
REST API
● Consul
K/V store
libraries
REST API
DNS
● All can be used as K/V store for all kind of usage
Mesos
Mesos
Zookeeper
● Zookeeper
K/V store
libraries
● NO YET REST OR DNS!*
● Only library support**
* REST is WIP
** you can use confd for reading, but set data is still from lib or
zkshell
What I should do?
● There is other options
● mesos-dns
● marathon-dns
● marathon-lb
● The problem is if service discovery
pattern fits in your needs
Service Discovery Patterns
● Client-Side Discovery Pattern
– The client is responsible for determining the
network locations
– Load balancing is managed by the client
– Usually client supports service discovery
with a library integrated (zookeeper)
Service Discovery Patterns
● The Server-Side Discovery Pattern
– The client makes a request to a service via a
load balancer
– Client don’t know the service, only load
balancer
– Load Balancer use service registry via DNS
or other kind of integrations.
Service Discovery Antipatterns
in microservices
Server side discovery
– We add an extra hop
– Load balancer as SpoF
● Or scale with the microservice
– Adds complexity to the architecture
And Finally…. In Mesos
Layers
Marathon
Mesos
Docker RegistratorRegistrator
Mesos-dnsMesos-dns
Marathon-lbMarathon-lb
consul RegistratorRegistrator
Mesos-consul
Service Discovery in mesos
Registrator
– Reads the event bus of docker and adds the
service to a service registry
● Application is removed from the registry when
docker container is stopped.
– If the host crash the services are still
registered
● If the host is recovered problems can appear
– There are better solutions for using with mesos
Mesos-consul
mesos-consul
● “Mesos-consul automatically registers/deregisters
services run as Mesos tasks.”
● Can be deployed in mesos as task or marthon app
● Depends on consul as service registry
● Use a lot of the features of consul like tags
● Develop for mantl(CiscoCloud)
Service Discovery in mesos
Mesos-DNS
“Mesos-DNS enables DNS based service discovery in
Apache Mesos clusters.”
● Supports SRV records
● It has special records for marathon
– Ex: leading master: A record (leader.domain) and SRV
records (_leader._tcp.domain and _leader._udp.domain)
● Supports round robin for multiple tasks with the
same name
Service Discovery in mesos
Service discovery in
mesos/marathon
Marathon-lb
“Marathon-lb is a tool for managing HAProxy, by
consuming Marathon's app state”
● Server side service discovery
● Deployable in marathon it self
● Depends on marathon
● Is included in DCOS
?
Vielen Dank!!

Service discovery in mesos