reactive microsystems: the evolution of microservices at scale
TRANSCRIPT
![Page 1: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/1.jpg)
REACTIVE MICROSYSTEMSTHE EVOLUTION OF MICROSERVICES AT SCALE
JONAS BONÉR
@JBONER
![Page 2: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/2.jpg)
WE HAVE BEEN SPOILED BY
THE ALMIGHTYMONOLITH
![Page 3: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/3.jpg)
KNOCK, KNOCK. WHO’S THERE?
REALITY
![Page 4: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/4.jpg)
![Page 5: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/5.jpg)
WE CAN'T MAKE THE HORSE FASTER
![Page 6: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/6.jpg)
WE NEED CARS FOR WHERE WE ARE GOING
![Page 7: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/7.jpg)
BUT DON'T JUST DRINK THE
THINK FOR YOURSELF
![Page 8: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/8.jpg)
NO ONE WANTSMICROSERVICESIT'S A NECCESSARY EVIL
![Page 9: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/9.jpg)
ARCHITECTURAL CONTEXT OF MICROSERVICES:
DISTRIBUTED SYSTEMS
![Page 10: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/10.jpg)
TODAY'S JOURNEY
![Page 11: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/11.jpg)
LET'S SAY THAT WE WANT TO SLICE THIS MONOLITH UP
![Page 12: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/12.jpg)
TOO MANY END UP WITH AN ARCHITECTURE LIKE THIS
![Page 13: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/13.jpg)
MICROLITH:SINGLE INSTANCEMICROSERVICE
-NOT RESILIENT-NOT ELASTIC
![Page 14: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/14.jpg)
One actor is no actor.Actors come in systems.
— Carl Hewitt
![Page 15: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/15.jpg)
MICROSERVICESCOME IN SYSTEMS
![Page 16: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/16.jpg)
3 HELPFUL TOOLS1. EVENTS-FIRST DDD2. REACTIVE DESIGN
3. EVENT-BASED PERSISTENCE
![Page 17: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/17.jpg)
PRACTICE
EVENTS-FIRSTDOMAIN-DRIVEN DESIGN
![Page 18: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/18.jpg)
DON'T FOCUS ON THE THINGSthe nouns
the domain objects
FOCUS ON WHAT HAPPENSthe verbsthe events
![Page 19: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/19.jpg)
When you start modeling events,it forces you to think about the
behavior of the system,as opposed to thinking about structure inside the system.
— Greg Young
![Page 20: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/20.jpg)
LET THE
EVENTS DEFINETHE BOUNDED CONTEXT
![Page 21: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/21.jpg)
EVENTS REPRESENT FACTS
![Page 22: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/22.jpg)
To condense fact from the vapor of nuance
— Neal Stephenson, Snow Crash
![Page 23: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/23.jpg)
WHAT ARE THE FACTS?
![Page 24: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/24.jpg)
TRY OUT
EVENT STORMING
![Page 25: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/25.jpg)
UNDERSTAND HOW FACTS ARE CAUSALLY RELATED
HOW FACTS FLOW IN THE SYSTEM
![Page 26: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/26.jpg)
THINK IN TERMS OFCONSISTENCY BOUNDARIES
![Page 27: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/27.jpg)
WE NEED TO
CONTAIN MUTABLE STATE &
PUBLISH FACTS
![Page 28: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/28.jpg)
AGGREGATE⇒ UNIT OF CONSISTENCY⇒ UNIT OF FAILURE
![Page 29: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/29.jpg)
PRACTICE
REACTIVE DESIGN
![Page 30: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/30.jpg)
REACTIVE PROGRAMMINGVS
REACTIVE SYSTEMS
![Page 31: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/31.jpg)
REACTIVE PROGRAMMINGCAN HELP US MAKE THEINDIVIDUAL INSTANCEHIGHLY PERFORMANT & EFFICIENT
![Page 32: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/32.jpg)
GOASYNCHRONOUS
![Page 33: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/33.jpg)
ASYNCHRONOUS& NON-BLOCKING
- MORE EFFICIENT USE OF RESOURCES- MINIMIZES CONTENTION ON SHARED
RESOURCES
![Page 34: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/34.jpg)
ALWAYS APPLY BACKPRESSURE
A FAST SYSTEMSHOULD NOT OVERLOADA SLOW SYSTEM
![Page 35: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/35.jpg)
BACKPRESSURE
![Page 36: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/36.jpg)
LET'S APPLY REACTIVE PROGRAMMING TO OUR MICROLITHS
![Page 37: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/37.jpg)
WE'RE GETTING THERE, BUT WE STILL HAVE ASINGLE INSTANCE MICROSERVICE⇒ NOT SCALABLE⇒ NOT RESILIENT
![Page 38: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/38.jpg)
REACTIVE SYSTEMSCAN HELP US BUILDDISTRIBUTED SYSTEMS THAT ARE
ELASTIC & RESILIENT
![Page 39: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/39.jpg)
REACTIVE SYSTEMS ARE BASED ON
ASYNCHRONOUSMESSAGE-PASSING
![Page 40: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/40.jpg)
ALLOWS DECOUPLING IN
SPACEAND
TIME
![Page 41: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/41.jpg)
ALLOWS FOR LOCATION TRANSPARENCYONE COMMUNICATION ABSTRACTION ACROSS ALL DIMENSIONS OF SCALE
CORE ⇒ SOCKET ⇒ CPU ⇒ CONTAINER ⇒ SERVER ⇒ RACK ⇒
DATA CENTER ⇒ SYSTEM
![Page 42: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/42.jpg)
SELF-HEALING THROUGH BULKHEADING
![Page 43: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/43.jpg)
SELF-HEALING THROUGH SUPERVISION
![Page 44: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/44.jpg)
MICROSERVICESCOME AS SYSTEMS
![Page 45: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/45.jpg)
EACH MICROSERVICENEEDS BE DESIGNED ASA DISTRIBUTED SYSTEM
A MICROSYSTEM
![Page 46: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/46.jpg)
WE NEED TO MOVE
FROM MICROLITHSTO MICROSYSTEMS
![Page 47: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/47.jpg)
SEPARATE THE
STATELESS BEHAVIORFROM THE
STATEFUL ENTITYTO SCALE THEM INDIVIDUALLY
![Page 48: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/48.jpg)
SCALING (STATELESS) BEHAVIOR
IS EASY
![Page 49: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/49.jpg)
SCALING (STATEFUL) ENTITIES
IS HARD
![Page 50: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/50.jpg)
THERE IS NO SUCH THING AS A"STATELESS" ARCHITECTUREIT'S JUST SOMEONE ELSE'S PROBLEM
![Page 51: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/51.jpg)
REACTIVEMICROSYSTEM
![Page 52: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/52.jpg)
PRACTICE
EVENT-BASEDPERSISTENCE
![Page 53: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/53.jpg)
Update-in-place strikes systems designers as a cardinal sin:
it violates traditional accounting practices that have been observed
for hundreds of years.— Jim Gray
![Page 54: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/54.jpg)
The truth is the log.The database is a cache of a
subset of the log.— Pat Helland
![Page 55: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/55.jpg)
EVENT LOGGINGFOR SCALABLE PERSISTENCE
![Page 56: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/56.jpg)
CRUDIS DEAD
![Page 57: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/57.jpg)
EVENT SOURCINGA CURE FOR THE CARDINAL SIN
![Page 58: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/58.jpg)
Modeling events forces you to have a temporal focus on what’s
going on in the system.Time becomes a crucial factor of
the system.— Greg Young
![Page 59: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/59.jpg)
THE LOGIS A DATABASE OF THE PASTNOT JUST A DATABASE OF THE PRESENT
![Page 60: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/60.jpg)
EVENT LOGGING AVOIDS THE INFAMOUS
OBJECT-RELATIONALIMPEDENCE MISMATCH
![Page 61: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/61.jpg)
UNTANGLE THE
READ & WRITEMODELS WITH
CQRS
![Page 62: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/62.jpg)
ADVANTAGES OF USING CQRS:1. RESILIENCE
2. SCALABILITY3. POLYGLOT PERSISTENCE
![Page 63: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/63.jpg)
USE
EVENT SOURCINGAND
EVENT STREAMING
![Page 64: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/64.jpg)
HOW CAN WE
COORDINATE WORKACROSS AGGREGATES?
![Page 65: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/65.jpg)
EVENT-DRIVENWORKFLOW
![Page 66: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/66.jpg)
BUT WHAT ABOUT
TRANSACTIONS?
![Page 67: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/67.jpg)
Two-phase commit is theanti-availability protocol.
— Pat Helland
![Page 68: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/68.jpg)
In general,application developerssimply do not implement
large scalable applications
assuming distributed transactions.
— Pat Helland
![Page 69: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/69.jpg)
USE A PROTOCOL OF
GUESS.APOLOGIZE.
COMPENSATE.
![Page 70: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/70.jpg)
IT'S HOW THE WORLD WORKS
![Page 71: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/71.jpg)
USE SAGASNOT DISTRIBUTED TRANSACTIONS
![Page 72: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/72.jpg)
![Page 73: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/73.jpg)
IN SUMMARY
1. Don't build Microliths2. Microservices come in (distributed) systems
3. Microservices come as (micro)systems4. Embrace the Reactive principles
5. Embrace Event-first DDD & Persistence6. Profit!
![Page 74: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/74.jpg)
TRY THE
LAGOMMICROSERVICES FRAMEWORKPOWERED BY AKKA & PLAYLAGOMFRAMEWORK.COM
![Page 75: Reactive Microsystems: The Evolution of Microservices at Scale](https://reader034.vdocuments.net/reader034/viewer/2022042501/5a652d467f8b9a5b558b4df9/html5/thumbnails/75.jpg)
LEARN MOREDOWNLOAD MY BOOK FOR FREE AT:BIT.LY/REACTIVE-MICROSYSTEMS