SlideShare a Scribd company logo
1 of 35
Download to read offline
Grudging monkeys
and microservices
@ by Carlo Sciolla
whoami since 2010!
So... µservices, huh?
Ask the architect
“there is nothing new under the sun
-- “Uncle Bob” Martin on Microservices
But then
- smaller, isolated codebases
- stateless & immutable
- no distributed transactions
- polyglot trojan horse
Meet the micromonkeys
Genesis of an entertaining (?) talk about microservices
We’ll explore how to architect and operate microservices following the adventures of three monkeys that
need to collaborate to get rid of nasty bugs
The Sucker
Meet the first micromonkey: the sucker. He will happily groom anyone who requests it.
The
Sucker™
The Cheater
This micromonkey is fundamentally a bastard. He asks the help of others when in need, but always
refuse to groom anyone back. Not. Nice.
The Cheater™
The Grudger
Our last micromonkey is there to counter antisocial behaviors: if someone refuses to groom when he
asks, he will hold a grudge and refuse to groom the cheater afterwards.
The Grudger™
Life, a tick at a time
Our micromonkeys live a quantised life. The Simulator takes care of notifying the monkeys when it’s time
to go one more clock tick ahead.
The Simulator™
DEMO TIME!(wish me luck)
The macro picture
How micro is micro?
single app
boundary
Immutable deployment units
It’s my app in a box, babe!
Containers give you a unified distribution model across technologies and an efficient way of using your
system resources. Together with stateleness, they’re much more easy to hot-deploy than WAR files!
command = ["java", "-Dmonkey=grudger",
"-Dmonkey-id=1",
"-Dmonkey-port=8081",
"-Dmonkey-consul-endpoint=http://192.168.59.103:8500",
"-jar", "grudger.jar"]
single app
boundary$ lein uberjar
$ docker build
Beware of hidden complexity
Extended application domain
When you distribute your app as a Docker container, you’re also distributing (a part of) the OS, and as
such you’re responsible for it.
distro selection
security guarantees
persistent storage
init system
kernel panicslinked containers
(def stem-micromonkey
["/"
{"" api-index
"clock" {:put process-clock
:get show-clock}
"bugs" {:put add-bugs
:delete remove-bugs}
"status" status
"groom" {:post will-groom}
"reborn" {:post resuscitate}
"config" show-config}])
REST + (a)sync + P2P
REST + HTTPKit + core.async
The micromonkeys expose a tiny REST APIs using bidi and talk to each other using synchronous
request/response patterns, while the simulator use core.async to interact with them.
minimal API
fast responses
per-node transaction
States catch up: CAP
Convergent replicated data type (CvRDT)
The micromonkeys only shared state is a counter, treated as monotonically increasing. When the monkey
is dead it simulates a partition. As the clock value is sent along the tick request, state is trivially restored.
4242
42
36
43 44 45
36 36 45
Terraform
Immutable infrastructure
v1 v2
v1
$ terraform plan
$ terraform apply
$ git commit
Go CD
Automate everything
Continuous Delivery
docker build
automated
infrastructure
Consul
Service discovery
it’s me!
it’s me!
it’s me!
Service registration
At bootstrap, each micromonkey registers into Consul, exposing information like their URL, esposed TCP
port, what service category (-> monkey type) they are and what health check system to use.
Service discovery
Are there alive
monkeys?
Are there alive
monkeys?
Multi protocol
Consul accepts both HTTP and DNS queries to expose information regarding registered services.
Much more!
Full package
Consul comes with a variety of other extra features that make automation a pleasure. More info and full
documentation at http://consul.io
watches
kv store
distributed
cross datacenter
sweet!
What to explore next
Fault tolerance
Circuit breakers FTW
When things go sideways and failures propagate throughout your system, then being distributed won’t
improve your resilience.
(decommand ask-grooming
"Asks a monkey to groom us"
[monkey]
(let [res-chan (rest/ask-grooming monkey)]
(go (let [[response ch] (alts! response-chan
(timeout (config/response-timeout)))]
(if (= response-chan ch)
(process-response ch)
(throw (MonkeyTimeoutException. monkey)))))))
Auto scaling and scheduling
Persistent storage with Flocker
Monitoring (ELK, New Relic..)
Inspired by
Among the other million links
The whole Internet is talking about microservices, but these two offered a similar pattern for a full
microservices deployment which inspired the design of the Micromonkeys.
Questions?
Thank you!
Carlo Sciolla
Chief Technology Officer
http://skuro.tk
http://sytac.io
@skuro

More Related Content

What's hot

Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Rob Fuller
 
Puppet DSL: back to the basics
Puppet DSL: back to the basicsPuppet DSL: back to the basics
Puppet DSL: back to the basicsJulien Pivotto
 
Design patterns - Common Solutions to Common Problems - Brad Wood
Design patterns -  Common Solutions to Common Problems - Brad WoodDesign patterns -  Common Solutions to Common Problems - Brad Wood
Design patterns - Common Solutions to Common Problems - Brad WoodOrtus Solutions, Corp
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015ice799
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatzBenjamin Delpy
 
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...RootedCON
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chefice799
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric WarfareWill Schroeder
 
"Powershell kung-fu" - Paweł Maziarz
"Powershell kung-fu" - Paweł Maziarz"Powershell kung-fu" - Paweł Maziarz
"Powershell kung-fu" - Paweł MaziarzPROIDEA
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008Stephan Chenette
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicJaime Blasco
 
Writing malware while the blue team is staring at you
Writing malware while the blue team is staring at youWriting malware while the blue team is staring at you
Writing malware while the blue team is staring at youRob Fuller
 

What's hot (12)

Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
 
Puppet DSL: back to the basics
Puppet DSL: back to the basicsPuppet DSL: back to the basics
Puppet DSL: back to the basics
 
Design patterns - Common Solutions to Common Problems - Brad Wood
Design patterns -  Common Solutions to Common Problems - Brad WoodDesign patterns -  Common Solutions to Common Problems - Brad Wood
Design patterns - Common Solutions to Common Problems - Brad Wood
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatz
 
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...
Raúl Siles - Browser Exploitation for Fun and Profit Revolutions [RootedCON 2...
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chef
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric Warfare
 
"Powershell kung-fu" - Paweł Maziarz
"Powershell kung-fu" - Paweł Maziarz"Powershell kung-fu" - Paweł Maziarz
"Powershell kung-fu" - Paweł Maziarz
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_public
 
Writing malware while the blue team is staring at you
Writing malware while the blue team is staring at youWriting malware while the blue team is staring at you
Writing malware while the blue team is staring at you
 

Viewers also liked

Social Media Strategies for Events - Hanzehogeschool Groningen 290312
Social Media Strategies for Events - Hanzehogeschool Groningen 290312Social Media Strategies for Events - Hanzehogeschool Groningen 290312
Social Media Strategies for Events - Hanzehogeschool Groningen 290312EventsAcademy
 
Tendencias O Innovar
Tendencias O InnovarTendencias O Innovar
Tendencias O InnovarSilvia Calvet
 
#MayoInOz Opening Keynote
#MayoInOz Opening Keynote#MayoInOz Opening Keynote
#MayoInOz Opening KeynoteLee Aase
 
Leveraging Social Media Skills
Leveraging Social Media Skills Leveraging Social Media Skills
Leveraging Social Media Skills GovLoop
 
London Best Places to Work Roadshow | ARM
London Best Places to Work Roadshow | ARMLondon Best Places to Work Roadshow | ARM
London Best Places to Work Roadshow | ARMGlassdoor
 
Challenges in stereoscopic movie making and cinema
Challenges in stereoscopic movie making and cinemaChallenges in stereoscopic movie making and cinema
Challenges in stereoscopic movie making and cinemadanielbuechele
 
Finding and Closing Business from the Social Web
Finding and Closing Business from the Social Web Finding and Closing Business from the Social Web
Finding and Closing Business from the Social Web Heinz Marketing Inc
 
The Flexible “Motion Offense” as a Core Basketball Strategy
The Flexible “Motion Offense” as a Core Basketball StrategyThe Flexible “Motion Offense” as a Core Basketball Strategy
The Flexible “Motion Offense” as a Core Basketball StrategyCraig Raucher New York
 
Daily Newsletter: 10th January, 2011
Daily Newsletter: 10th January, 2011Daily Newsletter: 10th January, 2011
Daily Newsletter: 10th January, 2011Fullerton Securities
 
UX w trudnych warunkach
UX w trudnych warunkachUX w trudnych warunkach
UX w trudnych warunkachAnna Liszewska
 
Digital Marketing: Advice & Tips
Digital Marketing: Advice & TipsDigital Marketing: Advice & Tips
Digital Marketing: Advice & TipsPaul Di Gangi
 
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)Christophe Lachnitt
 

Viewers also liked (14)

Social Media Strategies for Events - Hanzehogeschool Groningen 290312
Social Media Strategies for Events - Hanzehogeschool Groningen 290312Social Media Strategies for Events - Hanzehogeschool Groningen 290312
Social Media Strategies for Events - Hanzehogeschool Groningen 290312
 
Tendencias O Innovar
Tendencias O InnovarTendencias O Innovar
Tendencias O Innovar
 
#MayoInOz Opening Keynote
#MayoInOz Opening Keynote#MayoInOz Opening Keynote
#MayoInOz Opening Keynote
 
Leveraging Social Media Skills
Leveraging Social Media Skills Leveraging Social Media Skills
Leveraging Social Media Skills
 
London Best Places to Work Roadshow | ARM
London Best Places to Work Roadshow | ARMLondon Best Places to Work Roadshow | ARM
London Best Places to Work Roadshow | ARM
 
Challenges in stereoscopic movie making and cinema
Challenges in stereoscopic movie making and cinemaChallenges in stereoscopic movie making and cinema
Challenges in stereoscopic movie making and cinema
 
Finding and Closing Business from the Social Web
Finding and Closing Business from the Social Web Finding and Closing Business from the Social Web
Finding and Closing Business from the Social Web
 
The Flexible “Motion Offense” as a Core Basketball Strategy
The Flexible “Motion Offense” as a Core Basketball StrategyThe Flexible “Motion Offense” as a Core Basketball Strategy
The Flexible “Motion Offense” as a Core Basketball Strategy
 
prof. in eng. proj. mngt., const. mngt.
prof. in eng. proj. mngt., const. mngt.prof. in eng. proj. mngt., const. mngt.
prof. in eng. proj. mngt., const. mngt.
 
Daily Newsletter: 10th January, 2011
Daily Newsletter: 10th January, 2011Daily Newsletter: 10th January, 2011
Daily Newsletter: 10th January, 2011
 
UX w trudnych warunkach
UX w trudnych warunkachUX w trudnych warunkach
UX w trudnych warunkach
 
Digital Marketing: Advice & Tips
Digital Marketing: Advice & TipsDigital Marketing: Advice & Tips
Digital Marketing: Advice & Tips
 
Recorte Web - AAM - MediaIN
Recorte Web - AAM - MediaINRecorte Web - AAM - MediaIN
Recorte Web - AAM - MediaIN
 
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)
XopheLachnitt - Surinformation et maîtrise de l'information 4/4 (2013)
 

Similar to Grudging monkeys and microservices

Kali Linux - Falconer
Kali Linux - FalconerKali Linux - Falconer
Kali Linux - FalconerTony Godfrey
 
Defending Against Botnets
Defending Against BotnetsDefending Against Botnets
Defending Against BotnetsJim Lippard
 
Docker app armor_usecase
Docker app armor_usecaseDocker app armor_usecase
Docker app armor_usecaseKazuki Omo
 
Criminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureCriminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureJim Lippard
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Jérôme Petazzoni
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Tomoaki Sato
 
How to prevent cyber terrorism taragana
How to prevent cyber terrorism  taraganaHow to prevent cyber terrorism  taragana
How to prevent cyber terrorism taraganaGilles Sgro
 
Making the case for sandbox v1.1 (SD Conference 2007)
Making the case for sandbox v1.1 (SD Conference 2007)Making the case for sandbox v1.1 (SD Conference 2007)
Making the case for sandbox v1.1 (SD Conference 2007)Dinis Cruz
 
Virtual Machines Security Internals: Detection and Exploitation
 Virtual Machines Security Internals: Detection and Exploitation Virtual Machines Security Internals: Detection and Exploitation
Virtual Machines Security Internals: Detection and ExploitationMattia Salvi
 
Threat stack aws
Threat stack awsThreat stack aws
Threat stack awsJen Andre
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?Jérôme Petazzoni
 
FOSDEM 2021 - Infrastructure as Code Drift & Driftctl
FOSDEM 2021 - Infrastructure as Code Drift & DriftctlFOSDEM 2021 - Infrastructure as Code Drift & Driftctl
FOSDEM 2021 - Infrastructure as Code Drift & DriftctlStephane Jourdan
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityJérôme Petazzoni
 
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriThe Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriDocker, Inc.
 
Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1Florin D. Tanasache
 
Gnome, linux mobile stacks, and you
Gnome, linux mobile stacks, and youGnome, linux mobile stacks, and you
Gnome, linux mobile stacks, and youAndrew Savory
 
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...Codemotion Tel Aviv
 
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsMy Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsSascha Wolter
 

Similar to Grudging monkeys and microservices (20)

Kali Linux - Falconer
Kali Linux - FalconerKali Linux - Falconer
Kali Linux - Falconer
 
Defending Against Botnets
Defending Against BotnetsDefending Against Botnets
Defending Against Botnets
 
Docker app armor_usecase
Docker app armor_usecaseDocker app armor_usecase
Docker app armor_usecase
 
Criminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureCriminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and Future
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Analysing Ransomware
Analysing RansomwareAnalysing Ransomware
Analysing Ransomware
 
How to prevent cyber terrorism taragana
How to prevent cyber terrorism  taraganaHow to prevent cyber terrorism  taragana
How to prevent cyber terrorism taragana
 
Sneaky computation
Sneaky computationSneaky computation
Sneaky computation
 
Making the case for sandbox v1.1 (SD Conference 2007)
Making the case for sandbox v1.1 (SD Conference 2007)Making the case for sandbox v1.1 (SD Conference 2007)
Making the case for sandbox v1.1 (SD Conference 2007)
 
Virtual Machines Security Internals: Detection and Exploitation
 Virtual Machines Security Internals: Detection and Exploitation Virtual Machines Security Internals: Detection and Exploitation
Virtual Machines Security Internals: Detection and Exploitation
 
Threat stack aws
Threat stack awsThreat stack aws
Threat stack aws
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?
 
FOSDEM 2021 - Infrastructure as Code Drift & Driftctl
FOSDEM 2021 - Infrastructure as Code Drift & DriftctlFOSDEM 2021 - Infrastructure as Code Drift & Driftctl
FOSDEM 2021 - Infrastructure as Code Drift & Driftctl
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and security
 
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriThe Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
 
Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1Penetration Testing Project Game of Thrones CTF: 1
Penetration Testing Project Game of Thrones CTF: 1
 
Gnome, linux mobile stacks, and you
Gnome, linux mobile stacks, and youGnome, linux mobile stacks, and you
Gnome, linux mobile stacks, and you
 
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
My Minecraft Smart Home: Prototyping the internet of uncanny things - Sascha ...
 
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny ThingsMy Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
My Minecraft-Smart-Home: Prototyping the Internet of Uncanny Things
 

More from Carlo Sciolla

Codemotion Amsterdam: a conference for the tech community
Codemotion Amsterdam: a conference for the tech communityCodemotion Amsterdam: a conference for the tech community
Codemotion Amsterdam: a conference for the tech communityCarlo Sciolla
 
Functional Programming with Clojure
Functional Programming with ClojureFunctional Programming with Clojure
Functional Programming with ClojureCarlo Sciolla
 
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011Carlo Sciolla
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure wayCarlo Sciolla
 

More from Carlo Sciolla (6)

Codemotion Amsterdam: a conference for the tech community
Codemotion Amsterdam: a conference for the tech communityCodemotion Amsterdam: a conference for the tech community
Codemotion Amsterdam: a conference for the tech community
 
Functional Programming with Clojure
Functional Programming with ClojureFunctional Programming with Clojure
Functional Programming with Clojure
 
Dispatch in Clojure
Dispatch in ClojureDispatch in Clojure
Dispatch in Clojure
 
A Dive Into Clojure
A Dive Into ClojureA Dive Into Clojure
A Dive Into Clojure
 
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure way
 

Grudging monkeys and microservices

  • 4. Ask the architect “there is nothing new under the sun -- “Uncle Bob” Martin on Microservices
  • 5. But then - smaller, isolated codebases - stateless & immutable - no distributed transactions - polyglot trojan horse
  • 7. Genesis of an entertaining (?) talk about microservices We’ll explore how to architect and operate microservices following the adventures of three monkeys that need to collaborate to get rid of nasty bugs
  • 8. The Sucker Meet the first micromonkey: the sucker. He will happily groom anyone who requests it. The Sucker™
  • 9. The Cheater This micromonkey is fundamentally a bastard. He asks the help of others when in need, but always refuse to groom anyone back. Not. Nice. The Cheater™
  • 10. The Grudger Our last micromonkey is there to counter antisocial behaviors: if someone refuses to groom when he asks, he will hold a grudge and refuse to groom the cheater afterwards. The Grudger™
  • 11. Life, a tick at a time Our micromonkeys live a quantised life. The Simulator takes care of notifying the monkeys when it’s time to go one more clock tick ahead. The Simulator™
  • 14. How micro is micro? single app boundary
  • 15. Immutable deployment units It’s my app in a box, babe! Containers give you a unified distribution model across technologies and an efficient way of using your system resources. Together with stateleness, they’re much more easy to hot-deploy than WAR files! command = ["java", "-Dmonkey=grudger", "-Dmonkey-id=1", "-Dmonkey-port=8081", "-Dmonkey-consul-endpoint=http://192.168.59.103:8500", "-jar", "grudger.jar"] single app boundary$ lein uberjar $ docker build
  • 16. Beware of hidden complexity Extended application domain When you distribute your app as a Docker container, you’re also distributing (a part of) the OS, and as such you’re responsible for it. distro selection security guarantees persistent storage init system kernel panicslinked containers
  • 17. (def stem-micromonkey ["/" {"" api-index "clock" {:put process-clock :get show-clock} "bugs" {:put add-bugs :delete remove-bugs} "status" status "groom" {:post will-groom} "reborn" {:post resuscitate} "config" show-config}]) REST + (a)sync + P2P REST + HTTPKit + core.async The micromonkeys expose a tiny REST APIs using bidi and talk to each other using synchronous request/response patterns, while the simulator use core.async to interact with them. minimal API fast responses per-node transaction
  • 18. States catch up: CAP Convergent replicated data type (CvRDT) The micromonkeys only shared state is a counter, treated as monotonically increasing. When the monkey is dead it simulates a partition. As the clock value is sent along the tick request, state is trivially restored. 4242 42 36 43 44 45 36 36 45
  • 20. Immutable infrastructure v1 v2 v1 $ terraform plan $ terraform apply $ git commit
  • 21. Go CD
  • 25. Service discovery it’s me! it’s me! it’s me! Service registration At bootstrap, each micromonkey registers into Consul, exposing information like their URL, esposed TCP port, what service category (-> monkey type) they are and what health check system to use.
  • 26. Service discovery Are there alive monkeys? Are there alive monkeys? Multi protocol Consul accepts both HTTP and DNS queries to expose information regarding registered services.
  • 27. Much more! Full package Consul comes with a variety of other extra features that make automation a pleasure. More info and full documentation at http://consul.io watches kv store distributed cross datacenter sweet!
  • 29. Fault tolerance Circuit breakers FTW When things go sideways and failures propagate throughout your system, then being distributed won’t improve your resilience. (decommand ask-grooming "Asks a monkey to groom us" [monkey] (let [res-chan (rest/ask-grooming monkey)] (go (let [[response ch] (alts! response-chan (timeout (config/response-timeout)))] (if (= response-chan ch) (process-response ch) (throw (MonkeyTimeoutException. monkey)))))))
  • 30. Auto scaling and scheduling
  • 33. Inspired by Among the other million links The whole Internet is talking about microservices, but these two offered a similar pattern for a full microservices deployment which inspired the design of the Micromonkeys.
  • 35. Thank you! Carlo Sciolla Chief Technology Officer http://skuro.tk http://sytac.io @skuro