SlideShare a Scribd company logo
CloudConf
Turin 16th March 2017
Deploy, scale and coordinate a microservice oriented
application
cloudconf.it
Walter Dal Mut
walter.dalmut @ corley.it
Solution Architect @ Corley
Microservices
They're coming outta the walls
Docker Swarm
Issue a new process (deploy)
$ docker service create 
--name app 
registry.walterdalmut.com/app:v1
$ ./app &
Run different processes (scale)
$ docker service scale app=10 $ ./app &
$ ./app &
$ ./app &
What about the locking system?
In a distributed system: locks (distributed locks) are
the foundations for activity synchronization
What about coordination?
A service have its own con guration at
launch
I am here with this address, port etc...
A service require other service
con gurations
Where the database is, which password i should use, etc...
The service should reports its owns status
I am alive and responsive (for healthcheck)
other services can check the health report for the maintenance mode
or to shortcircuit the service dependency
To expose the coordination problem we create an
application
Read the twitter stream
#cloudconf2017
users that tweet with this handle
create a reserved API service [ JSON over HTTP ]
GET /tweet - list my tweets
POST /tweet - record a new
tweet
The database to store tweets is self-contained in the API service
Now every service is exposed with a unique pair
address:port in the swarm
every box is a container (service)
blinks for activities (publish new tweets)
Multiple services
(1)
(1)
(1..*)
(n)
(1..*)
Stream readerer
Distributed queue
Service Worker (need a distributed lock)
a lock identi es the service deployment
progress
on missing => service deploy
on existing => publish messages
Per user container
A proxy to list users and redirects requests
HTTP framework
> GET /user/walterdalmut HTTP/1.1
> Host: cluster.corsi.walterdalmut.com:30000
> User-Agent: curl/7.47.0
> Accept: */*
< HTTP/1.1 302 Found
< location: http://cluster.corsi.walterdalmut.com:30002/v1/tweet
< vary: origin
< cache-control: no-cache
< content-length: 0
< Date: Sun, 12 Mar 2017 11:26:50 GMT
< Connection: keep-alive
CloudConf2017 Example
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
Every user have its own network address and
port
Every user expose its own API
How do we connect services together?
DNS as a coordination system
DNS is a good solution to point things in a network
DNS SRV expose a service address con guration
$ dig srv _auth._tcp.walterdalmut.com +short
1 10 8080 1.api.walterdalmut.com
1 10 8080 2.api.walterdalmut.com
And service con gurations?
host: db.mynet.local
port: 3306
username: root
password: root
dbname: example
K / V
Several coordination systems available
Etcd is one of the most interesting coordination system available
Consul integrates di erent things together like: DNS, KV, etc...
many other: zookeeper, etc...
Redis as a coordination service
distribute con gurations at paths
$ cat mydb.conf | redis-cli set /path/to/disk/mydb.conf -
Where is my `ls` command now?
$ redis-cli keys /path/*
1) "/path/to/disk/mydb.conf"
Get my con guration back
$ redis-cli get /path/to/disk/mydb.conf
host: db.mynet.local
port: 3306
username: root
password: root
dbname: example
How to report the application status?
Healthchecks
Con gurations can also expires
Dead man switch
application reports continuously
cat mydb.conf | SETEX /path/to/disk/mydb.conf 30 -
EXPIRE /path/to/disk/mydb.conf 30
... sleep 20
EXPIRE /path/to/disk/mydb.conf 30
...
Services links together
Can i watch for con guration changes?
refresh my services on updates
Redis Keyspace Noti cations
or in your con guration le
CONFIG SET notify-keyspace-events AKE
Listen for my con guration changes
SUBSCRIBE __keyspace@0__:/path/to/disk/mydb.conf
Here the event
$ cat mydb.conf | redis-cli set /path/to/disk/mydb.conf -
1) "message"
2) "__keyspace@0__:/path/to/disk/mydb.conf"
3) "set"
Distributed locks
In a single node for redis
NX - if not exists
PX 30000 - expires in 30000 ms
SET /etc/lock/username/.lock {random_value} NX PX 30000
After 30 seconds the lock expires
SET /etc/lock/walterdalmut/.lock 3891573 NX PX 30000
OK
SET /etc/lock/walterdalmut/.lock 2857152 NX PX 30000
(nil)
How do i release the lock?
DEL /etc/lock/walterdalmut/.lock
How do i extend the lock?
EXPIRE /etc/lock/walterdalmut/.lock 30
How do i watch for lock release?
Lock releases
SUBSCRIBE __keyspace@0__:/etc/lock/walterdalmut/.lock
1) "message"
2) "__keyspace@0__:/etc/lock/walterdalmut/.lock"
3) "del"
1) "message"
2) "__keyspace@0__:/etc/lock/walterdalmut/.lock"
3) "expired"
Thank you for listening

More Related Content

PDF
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
PDF
Introduction to Docker
PDF
Swarm mode
PDF
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
PDF
Declare your infrastructure: InfraKit, LinuxKit and Moby
PDF
Amazon EC2 Container Service in Action
PDF
2015 DockerCon Using Docker in production at bity.com
PPTX
Building Windows Images with Packer
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Introduction to Docker
Swarm mode
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
Declare your infrastructure: InfraKit, LinuxKit and Moby
Amazon EC2 Container Service in Action
2015 DockerCon Using Docker in production at bity.com
Building Windows Images with Packer

What's hot (20)

PPTX
Couch to OpenStack: Glance - July, 23, 2013
PPTX
Seastar at Linux Foundation Collaboration Summit
PDF
Docker volume-isolator-in-mesos
PDF
Cassandra and Docker Lessons Learned
PDF
Docker swarm workshop
PDF
Docker Container Orchestration
PDF
Red hat lvm cheatsheet
PDF
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
PPTX
Couch to OpenStack: Nova - July, 30, 2013
PPTX
CoreOS Overview and Current Status
PDF
Scaling and Managing Cassandra with docker, CoreOS and Presto
PPTX
Cassandra via-docker
PDF
Docker Elastic Beanstalk
PPTX
Exploring Docker Security
PPTX
Academy PRO: Docker. Lecture 3
PPTX
Academy PRO: Docker. Lecture 4
ODP
Docker and stuff
PDF
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
PPTX
Couch to open_stack_keystone
PDF
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Couch to OpenStack: Glance - July, 23, 2013
Seastar at Linux Foundation Collaboration Summit
Docker volume-isolator-in-mesos
Cassandra and Docker Lessons Learned
Docker swarm workshop
Docker Container Orchestration
Red hat lvm cheatsheet
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
Couch to OpenStack: Nova - July, 30, 2013
CoreOS Overview and Current Status
Scaling and Managing Cassandra with docker, CoreOS and Presto
Cassandra via-docker
Docker Elastic Beanstalk
Exploring Docker Security
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 4
Docker and stuff
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
Couch to open_stack_keystone
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Ad

Viewers also liked (20)

PPTX
HIPAA Compliance in the AWS Cloud
PDF
A single language for backend and frontend from AngularJS to cloud with Clau...
PPTX
The advantage of developing with TypeScript
PPTX
AngularJS: Service, factory & provider
PDF
An Updated Performance Comparison of Virtual Machines and Linux Containers
PPTX
Sensu Monitoring
PDF
Micro, Nano, Mono? Microservices verständlich erklärt
PDF
Raspberry Pi - HW/SW Application Development
PDF
Toolkit of modern web development (DevFest Košice 7.5.2016)
PDF
Demystifying datastores
PDF
Metrics driven dev ops 2017
PDF
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
PDF
Introduction to concurrent programming with akka actors
ODP
Redis overview
PDF
React vs Angular2
PPTX
Golang 101 (Concurrency vs Parallelism)
PDF
Protocol buffers and Microservices
PDF
Security Monitoring with eBPF
PDF
Introduction of Mesosphere DCOS
PPTX
Сергей Радзыняк ".NET Microservices in Real Life"
HIPAA Compliance in the AWS Cloud
A single language for backend and frontend from AngularJS to cloud with Clau...
The advantage of developing with TypeScript
AngularJS: Service, factory & provider
An Updated Performance Comparison of Virtual Machines and Linux Containers
Sensu Monitoring
Micro, Nano, Mono? Microservices verständlich erklärt
Raspberry Pi - HW/SW Application Development
Toolkit of modern web development (DevFest Košice 7.5.2016)
Demystifying datastores
Metrics driven dev ops 2017
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Introduction to concurrent programming with akka actors
Redis overview
React vs Angular2
Golang 101 (Concurrency vs Parallelism)
Protocol buffers and Microservices
Security Monitoring with eBPF
Introduction of Mesosphere DCOS
Сергей Радзыняк ".NET Microservices in Real Life"
Ad

Similar to CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application (20)

PPTX
Cloud Foundry a Developer's Perspective
DOCX
Windows server Interview question and answers
PPT
Dce rpc
DOC
Server interview[1]
PPTX
Unleash software architecture leveraging on docker
PDF
January 2017 - Deep dive on AWS Lambda and DevOps
PDF
Service discovery in a microservice architecture using consul
PDF
Service Discovery in Distributed System with DCOS & Kubernettes. - Sahil Sawhney
PPTX
Service Discovery using etcd, Consul and Kubernetes
PDF
Framework Agnostic Discovery
PDF
Beyond static configuration
PDF
Appswitch: Pune Docker Kubernetes meetup 28 July, 2018
PPTX
Deploy and Destroy: Testing Environments - Michael Arenzon - DevOpsDays Tel A...
PDF
Higher order infrastructure: from Docker basics to cluster management - Nicol...
PPT
C-System Models Presentation files .ppt
PDF
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
PDF
Chapter 6-Remoting
PDF
Microservices. Microservices everywhere! (At OSCON 2015)
PDF
Android chapter16-web-services
PDF
Cloud Foundry Technical Overview
Cloud Foundry a Developer's Perspective
Windows server Interview question and answers
Dce rpc
Server interview[1]
Unleash software architecture leveraging on docker
January 2017 - Deep dive on AWS Lambda and DevOps
Service discovery in a microservice architecture using consul
Service Discovery in Distributed System with DCOS & Kubernettes. - Sahil Sawhney
Service Discovery using etcd, Consul and Kubernetes
Framework Agnostic Discovery
Beyond static configuration
Appswitch: Pune Docker Kubernetes meetup 28 July, 2018
Deploy and Destroy: Testing Environments - Michael Arenzon - DevOpsDays Tel A...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
C-System Models Presentation files .ppt
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
Chapter 6-Remoting
Microservices. Microservices everywhere! (At OSCON 2015)
Android chapter16-web-services
Cloud Foundry Technical Overview

More from Corley S.r.l. (20)

PDF
Aws rekognition - riconoscimento facciale
PDF
AWSome day 2018 - scalability and cost optimization with container services
PDF
AWSome day 2018 - API serverless with aws
PDF
AWSome day 2018 - database in cloud
PDF
Trace your micro-services oriented application with Zipkin and OpenTracing
PDF
Apiconf - The perfect REST solution
PDF
Apiconf - Doc Driven Development
PDF
Authentication and authorization in res tful infrastructures
PDF
Flexibility and scalability of costs in serverless infrastructures
PDF
Angular coding: from project management to web and mobile deploy
PDF
Corley cloud angular in cloud
PDF
Measure your app internals with InfluxDB and Symfony2
PDF
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
PDF
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
PDF
Middleware PHP - A simple micro-framework
PDF
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
PDF
Cloud Conf 2015 - Develop and Deploy IOT Applications
PDF
An introduction to Hubot - CloudConf 2015 - Turin Italy
PDF
AngularJS advanced project management
PDF
Scale your Magento app with Elastic Beanstalk
Aws rekognition - riconoscimento facciale
AWSome day 2018 - scalability and cost optimization with container services
AWSome day 2018 - API serverless with aws
AWSome day 2018 - database in cloud
Trace your micro-services oriented application with Zipkin and OpenTracing
Apiconf - The perfect REST solution
Apiconf - Doc Driven Development
Authentication and authorization in res tful infrastructures
Flexibility and scalability of costs in serverless infrastructures
Angular coding: from project management to web and mobile deploy
Corley cloud angular in cloud
Measure your app internals with InfluxDB and Symfony2
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Middleware PHP - A simple micro-framework
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
Cloud Conf 2015 - Develop and Deploy IOT Applications
An introduction to Hubot - CloudConf 2015 - Turin Italy
AngularJS advanced project management
Scale your Magento app with Elastic Beanstalk

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Online Work Permit System for Fast Permit Processing
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PDF
Build Multi-agent using Agent Development Kit
PPTX
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
AI in Product Development-omnex systems
PPT
Introduction Database Management System for Course Database
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Online Work Permit System for Fast Permit Processing
A REACT POMODORO TIMER WEB APPLICATION.pdf
L1 - Introduction to python Backend.pptx
ISO 45001 Occupational Health and Safety Management System
Which alternative to Crystal Reports is best for small or large businesses.pdf
Odoo POS Development Services by CandidRoot Solutions
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Build Multi-agent using Agent Development Kit
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
Best Practices for Rolling Out Competency Management Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
PTS Company Brochure 2025 (1).pdf.......
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
AI in Product Development-omnex systems
Introduction Database Management System for Course Database
Softaken Excel to vCard Converter Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx

CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application

  • 1. CloudConf Turin 16th March 2017 Deploy, scale and coordinate a microservice oriented application cloudconf.it
  • 2. Walter Dal Mut walter.dalmut @ corley.it Solution Architect @ Corley
  • 6. Issue a new process (deploy) $ docker service create --name app registry.walterdalmut.com/app:v1 $ ./app &
  • 7. Run different processes (scale) $ docker service scale app=10 $ ./app & $ ./app & $ ./app &
  • 8. What about the locking system? In a distributed system: locks (distributed locks) are the foundations for activity synchronization
  • 10. A service have its own con guration at launch I am here with this address, port etc... A service require other service con gurations Where the database is, which password i should use, etc... The service should reports its owns status I am alive and responsive (for healthcheck) other services can check the health report for the maintenance mode or to shortcircuit the service dependency
  • 11. To expose the coordination problem we create an application
  • 12. Read the twitter stream #cloudconf2017
  • 13. users that tweet with this handle create a reserved API service [ JSON over HTTP ] GET /tweet - list my tweets POST /tweet - record a new tweet The database to store tweets is self-contained in the API service
  • 14. Now every service is exposed with a unique pair address:port in the swarm
  • 15. every box is a container (service) blinks for activities (publish new tweets)
  • 16. Multiple services (1) (1) (1..*) (n) (1..*) Stream readerer Distributed queue Service Worker (need a distributed lock) a lock identi es the service deployment progress on missing => service deploy on existing => publish messages Per user container A proxy to list users and redirects requests
  • 17. HTTP framework > GET /user/walterdalmut HTTP/1.1 > Host: cluster.corsi.walterdalmut.com:30000 > User-Agent: curl/7.47.0 > Accept: */* < HTTP/1.1 302 Found < location: http://cluster.corsi.walterdalmut.com:30002/v1/tweet < vary: origin < cache-control: no-cache < content-length: 0 < Date: Sun, 12 Mar 2017 11:26:50 GMT < Connection: keep-alive
  • 21. Every user have its own network address and port Every user expose its own API How do we connect services together?
  • 22. DNS as a coordination system DNS is a good solution to point things in a network DNS SRV expose a service address con guration $ dig srv _auth._tcp.walterdalmut.com +short 1 10 8080 1.api.walterdalmut.com 1 10 8080 2.api.walterdalmut.com
  • 23. And service con gurations? host: db.mynet.local port: 3306 username: root password: root dbname: example
  • 24. K / V Several coordination systems available Etcd is one of the most interesting coordination system available Consul integrates di erent things together like: DNS, KV, etc... many other: zookeeper, etc...
  • 25. Redis as a coordination service
  • 26. distribute con gurations at paths $ cat mydb.conf | redis-cli set /path/to/disk/mydb.conf -
  • 27. Where is my `ls` command now? $ redis-cli keys /path/* 1) "/path/to/disk/mydb.conf"
  • 28. Get my con guration back $ redis-cli get /path/to/disk/mydb.conf host: db.mynet.local port: 3306 username: root password: root dbname: example
  • 29. How to report the application status? Healthchecks
  • 30. Con gurations can also expires Dead man switch application reports continuously cat mydb.conf | SETEX /path/to/disk/mydb.conf 30 - EXPIRE /path/to/disk/mydb.conf 30 ... sleep 20 EXPIRE /path/to/disk/mydb.conf 30 ...
  • 31. Services links together Can i watch for con guration changes? refresh my services on updates
  • 32. Redis Keyspace Noti cations or in your con guration le CONFIG SET notify-keyspace-events AKE
  • 33. Listen for my con guration changes SUBSCRIBE __keyspace@0__:/path/to/disk/mydb.conf
  • 34. Here the event $ cat mydb.conf | redis-cli set /path/to/disk/mydb.conf - 1) "message" 2) "__keyspace@0__:/path/to/disk/mydb.conf" 3) "set"
  • 35. Distributed locks In a single node for redis NX - if not exists PX 30000 - expires in 30000 ms SET /etc/lock/username/.lock {random_value} NX PX 30000
  • 36. After 30 seconds the lock expires SET /etc/lock/walterdalmut/.lock 3891573 NX PX 30000 OK SET /etc/lock/walterdalmut/.lock 2857152 NX PX 30000 (nil)
  • 37. How do i release the lock? DEL /etc/lock/walterdalmut/.lock
  • 38. How do i extend the lock? EXPIRE /etc/lock/walterdalmut/.lock 30
  • 39. How do i watch for lock release? Lock releases SUBSCRIBE __keyspace@0__:/etc/lock/walterdalmut/.lock 1) "message" 2) "__keyspace@0__:/etc/lock/walterdalmut/.lock" 3) "del" 1) "message" 2) "__keyspace@0__:/etc/lock/walterdalmut/.lock" 3) "expired"
  • 40. Thank you for listening