Microservice design patterns

HughMcKee 104 views 58 slides Jul 27, 2021
Slide 1
Slide 1 of 58
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58

About This Presentation

There are many design patterns for building microservices, and most of them are wrong. Actually, that is not true. The fundamental objectives for implementing microservice systems are speed and agility. Speed, of course, is how quickly you can get things done. Regardless of what design patterns you ...


Slide Content

Microservice
Design Patterns
Hugh McKee
Developer Advocate
@mckeeh3

Take a moment to flex your mind







This won’t hurt - much

There is a boat full of people

The boat capsizes

Not a single person gets wet

How can this happen?


Pattern Flexibility

There is a boat full of people

The boat capsizes

Not a single person gets wet

How can this happen?

They are all married!
Pattern Flexibility

Pattern Flexibility
5 + 5 + 5 = 550

Add one line to correct this expression

Pattern Flexibility
5 + 5 + 5 = 550

Add one line to correct this expression

My
Ask

Progression of design patterns

What is a Microlith?
A microlith is a distributed monolith.

●Microservices are tightly coupled
●Monolithic database
What are tightly coupled
microservices?
Have RPC dependencies with other
microservices.

Communicate synchronously via RESTful
RPC calls with other microservices.

What happens
when, not if, WHEN
something fails?

Something
went wrong.
Please try
again later.

Tightly coupled synchronous RESTful RPC

Tightly coupled synchronous RESTful RPC

Tightly coupled synchronous RESTful RPC

Tightly coupled synchronous RESTful RPC

Loose Coupling
Event driven asynchronous communication

Loosely coupled asynchronous messaging

Loosely coupled asynchronous messaging

Loosely coupled asynchronous messaging

Loosely coupled asynchronous messaging

Still a Microlith?
Best effort to decouple all or most
microservices.

Database is still monolithic.

Loosely coupled microservices
Asynchronous intra service
messaging

Each service owns its own
schema/data


Shared outside perspective

Hidden private inside perspective

Each microservice owns its own schema/data

Outside perspective

Inside perspective

Outside perspective

Event Oriented Microservices
Do the least amount of work while
someone or something is waiting

Push work out-of-band done
asynchronously in the background

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging

Make asynchronous messaging the norm, synchronous messaging the exception

Each microservice owns its own schema

Turn data reference sources (e.g. customer data) into data change publishers

Make event-oriented the norm, traditional CRUD the exception

Always do the - when this thing breaks - analysis to uncover weak, brittle patterns

“At the heart of science is an essential
balance between two seemingly
contradictory attitudes--an openness to
new ideas, no matter how bizarre or
counterintuitive they may be, and the
most ruthless skeptical scrutiny of all
ideas, old and new. This is how deep
truths are winnowed from deep
nonsense.”

Carl Sagan
computer
^

Microservice Design
Patterns



See these patterns in action
with Akka Serverless open beta



Thank you!

Hugh McKee
Developer Advocate
@mckeeh3