+ All Categories
Home > Engineering > Reactive Microsystems: The Evolution of Microservices at Scale

Reactive Microsystems: The Evolution of Microservices at Scale

Date post: 22-Jan-2018
Category:
Upload: jonas-boner
View: 293 times
Download: 20 times
Share this document with a friend
75
REACTIVE MICROSYSTEMS THE EVOLUTION OF MICROSERVICES AT SCALE JONAS BONÉR @JBONER
Transcript
Page 1: Reactive Microsystems: The Evolution of Microservices at Scale

REACTIVE MICROSYSTEMSTHE EVOLUTION OF MICROSERVICES AT SCALE

JONAS BONÉR

@JBONER

Page 2: Reactive Microsystems: The Evolution of Microservices at Scale

WE HAVE BEEN SPOILED BY

THE ALMIGHTYMONOLITH

Page 3: Reactive Microsystems: The Evolution of Microservices at Scale

KNOCK, KNOCK. WHO’S THERE?

REALITY

Page 4: Reactive Microsystems: The Evolution of Microservices at Scale
Page 5: Reactive Microsystems: The Evolution of Microservices at Scale

WE CAN'T MAKE THE HORSE FASTER

Page 6: Reactive Microsystems: The Evolution of Microservices at Scale

WE NEED CARS FOR WHERE WE ARE GOING

Page 7: Reactive Microsystems: The Evolution of Microservices at Scale

BUT DON'T JUST DRINK THE

THINK FOR YOURSELF

Page 8: Reactive Microsystems: The Evolution of Microservices at Scale

NO ONE WANTSMICROSERVICESIT'S A NECCESSARY EVIL

Page 9: Reactive Microsystems: The Evolution of Microservices at Scale

ARCHITECTURAL CONTEXT OF MICROSERVICES:

DISTRIBUTED SYSTEMS

Page 10: Reactive Microsystems: The Evolution of Microservices at Scale

TODAY'S JOURNEY

Page 11: Reactive Microsystems: The Evolution of Microservices at Scale

LET'S SAY THAT WE WANT TO SLICE THIS MONOLITH UP

Page 12: Reactive Microsystems: The Evolution of Microservices at Scale

TOO MANY END UP WITH AN ARCHITECTURE LIKE THIS

Page 13: Reactive Microsystems: The Evolution of Microservices at Scale

MICROLITH:SINGLE INSTANCEMICROSERVICE

-NOT RESILIENT-NOT ELASTIC

Page 14: Reactive Microsystems: The Evolution of Microservices at Scale

One actor is no actor.Actors come in systems.

— Carl Hewitt

Page 15: Reactive Microsystems: The Evolution of Microservices at Scale

MICROSERVICESCOME IN SYSTEMS

Page 16: Reactive Microsystems: The Evolution of Microservices at Scale

3 HELPFUL TOOLS1. EVENTS-FIRST DDD2. REACTIVE DESIGN

3. EVENT-BASED PERSISTENCE

Page 17: Reactive Microsystems: The Evolution of Microservices at Scale

PRACTICE

EVENTS-FIRSTDOMAIN-DRIVEN DESIGN

Page 18: Reactive Microsystems: The Evolution of Microservices at Scale

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

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

LET THE

EVENTS DEFINETHE BOUNDED CONTEXT

Page 21: Reactive Microsystems: The Evolution of Microservices at Scale

EVENTS REPRESENT FACTS

Page 22: Reactive Microsystems: The Evolution of Microservices at Scale

To condense fact from the vapor of nuance

— Neal Stephenson, Snow Crash

Page 23: Reactive Microsystems: The Evolution of Microservices at Scale

WHAT ARE THE FACTS?

Page 24: Reactive Microsystems: The Evolution of Microservices at Scale

TRY OUT

EVENT STORMING

Page 25: Reactive Microsystems: The Evolution of Microservices at Scale

UNDERSTAND HOW FACTS ARE CAUSALLY RELATED

HOW FACTS FLOW IN THE SYSTEM

Page 26: Reactive Microsystems: The Evolution of Microservices at Scale

THINK IN TERMS OFCONSISTENCY BOUNDARIES

Page 27: Reactive Microsystems: The Evolution of Microservices at Scale

WE NEED TO

CONTAIN MUTABLE STATE &

PUBLISH FACTS

Page 28: Reactive Microsystems: The Evolution of Microservices at Scale

AGGREGATE⇒ UNIT OF CONSISTENCY⇒ UNIT OF FAILURE

Page 29: Reactive Microsystems: The Evolution of Microservices at Scale

PRACTICE

REACTIVE DESIGN

Page 30: Reactive Microsystems: The Evolution of Microservices at Scale

REACTIVE PROGRAMMINGVS

REACTIVE SYSTEMS

Page 31: Reactive Microsystems: The Evolution of Microservices at Scale

REACTIVE PROGRAMMINGCAN HELP US MAKE THEINDIVIDUAL INSTANCEHIGHLY PERFORMANT & EFFICIENT

Page 32: Reactive Microsystems: The Evolution of Microservices at Scale

GOASYNCHRONOUS

Page 33: Reactive Microsystems: The Evolution of Microservices at Scale

ASYNCHRONOUS& NON-BLOCKING

- MORE EFFICIENT USE OF RESOURCES- MINIMIZES CONTENTION ON SHARED

RESOURCES

Page 34: Reactive Microsystems: The Evolution of Microservices at Scale

ALWAYS APPLY BACKPRESSURE

A FAST SYSTEMSHOULD NOT OVERLOADA SLOW SYSTEM

Page 35: Reactive Microsystems: The Evolution of Microservices at Scale

BACKPRESSURE

Page 36: Reactive Microsystems: The Evolution of Microservices at Scale

LET'S APPLY REACTIVE PROGRAMMING TO OUR MICROLITHS

Page 37: Reactive Microsystems: The Evolution of Microservices at Scale

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

REACTIVE SYSTEMSCAN HELP US BUILDDISTRIBUTED SYSTEMS THAT ARE

ELASTIC & RESILIENT

Page 39: Reactive Microsystems: The Evolution of Microservices at Scale

REACTIVE SYSTEMS ARE BASED ON

ASYNCHRONOUSMESSAGE-PASSING

Page 40: Reactive Microsystems: The Evolution of Microservices at Scale

ALLOWS DECOUPLING IN

SPACEAND

TIME

Page 41: Reactive Microsystems: The Evolution of Microservices at Scale

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

SELF-HEALING THROUGH BULKHEADING

Page 43: Reactive Microsystems: The Evolution of Microservices at Scale

SELF-HEALING THROUGH SUPERVISION

Page 44: Reactive Microsystems: The Evolution of Microservices at Scale

MICROSERVICESCOME AS SYSTEMS

Page 45: Reactive Microsystems: The Evolution of Microservices at Scale

EACH MICROSERVICENEEDS BE DESIGNED ASA DISTRIBUTED SYSTEM

A MICROSYSTEM

Page 46: Reactive Microsystems: The Evolution of Microservices at Scale

WE NEED TO MOVE

FROM MICROLITHSTO MICROSYSTEMS

Page 47: Reactive Microsystems: The Evolution of Microservices at Scale

SEPARATE THE

STATELESS BEHAVIORFROM THE

STATEFUL ENTITYTO SCALE THEM INDIVIDUALLY

Page 48: Reactive Microsystems: The Evolution of Microservices at Scale

SCALING (STATELESS) BEHAVIOR

IS EASY

Page 49: Reactive Microsystems: The Evolution of Microservices at Scale

SCALING (STATEFUL) ENTITIES

IS HARD

Page 50: Reactive Microsystems: The Evolution of Microservices at Scale

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

REACTIVEMICROSYSTEM

Page 52: Reactive Microsystems: The Evolution of Microservices at Scale

PRACTICE

EVENT-BASEDPERSISTENCE

Page 53: Reactive Microsystems: The Evolution of Microservices at Scale

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

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

EVENT LOGGINGFOR SCALABLE PERSISTENCE

Page 56: Reactive Microsystems: The Evolution of Microservices at Scale

CRUDIS DEAD

Page 57: Reactive Microsystems: The Evolution of Microservices at Scale

EVENT SOURCINGA CURE FOR THE CARDINAL SIN

Page 58: Reactive Microsystems: The Evolution of Microservices at Scale

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

THE LOGIS A DATABASE OF THE PASTNOT JUST A DATABASE OF THE PRESENT

Page 60: Reactive Microsystems: The Evolution of Microservices at Scale

EVENT LOGGING AVOIDS THE INFAMOUS

OBJECT-RELATIONALIMPEDENCE MISMATCH

Page 61: Reactive Microsystems: The Evolution of Microservices at Scale

UNTANGLE THE

READ & WRITEMODELS WITH

CQRS

Page 62: Reactive Microsystems: The Evolution of Microservices at Scale

ADVANTAGES OF USING CQRS:1. RESILIENCE

2. SCALABILITY3. POLYGLOT PERSISTENCE

Page 63: Reactive Microsystems: The Evolution of Microservices at Scale

USE

EVENT SOURCINGAND

EVENT STREAMING

Page 64: Reactive Microsystems: The Evolution of Microservices at Scale

HOW CAN WE

COORDINATE WORKACROSS AGGREGATES?

Page 65: Reactive Microsystems: The Evolution of Microservices at Scale

EVENT-DRIVENWORKFLOW

Page 66: Reactive Microsystems: The Evolution of Microservices at Scale

BUT WHAT ABOUT

TRANSACTIONS?

Page 67: Reactive Microsystems: The Evolution of Microservices at Scale

Two-phase commit is theanti-availability protocol.

— Pat Helland

Page 68: Reactive Microsystems: The Evolution of Microservices at Scale

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

USE A PROTOCOL OF

GUESS.APOLOGIZE.

COMPENSATE.

Page 70: Reactive Microsystems: The Evolution of Microservices at Scale

IT'S HOW THE WORLD WORKS

Page 71: Reactive Microsystems: The Evolution of Microservices at Scale

USE SAGASNOT DISTRIBUTED TRANSACTIONS

Page 72: Reactive Microsystems: The Evolution of Microservices at Scale
Page 73: Reactive Microsystems: The Evolution of Microservices at Scale

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

TRY THE

LAGOMMICROSERVICES FRAMEWORKPOWERED BY AKKA & PLAYLAGOMFRAMEWORK.COM

Page 75: Reactive Microsystems: The Evolution of Microservices at Scale

LEARN MOREDOWNLOAD MY BOOK FOR FREE AT:BIT.LY/REACTIVE-MICROSYSTEMS


Recommended