There are many different approaches to how you let your microservices communicate between one another. Be it asynchronous or synchronous, choreographed or orchestrated, eventual consistent or distributedly transactional, fault tolerant or just a mess! In this session I will provide an overview on different concepts of microservice communication and their pros & cons. On the way I'll try to throw in some anecdotes, success stories and failures I learned from so that you can hopefully take something home with you.
4. 4
Basics
Synchronous vs. Asynchronous Integration
Distributed Transactions vs. Eventual Consistency
Service Routing
Organisational Considerations
Q & A
Agenda
6. 6
Basics – Leaving the Process
User Content
Search Sales
Suggestions Images
User Content
Search Sales
Suggestions Images
7. 7
Basics – Fallacies of distributed computing
The network is reliable
Latency is zero
Bandwidth is infinite
The network is secure
Topology doesn't change
There is one administrator
Transport cost is zero
The network is homogeneous
8. 8
Basics – Types of communication
Synchronous protocol
Sender Receiver
Request
Response
Asynchronous protocol
Sender Receiver
Request
9. 9
Basics – Types of communication
Single Receiver
Multiple Receiver
Sender Receiver
Sender
Receiver
Receiver
Receiver
10. 10
Basics – Types of communication
Orchestration
Choreography
Customer
Service
Loyality
Service
Post
Service
Email
Service
“Customer Created”
Customer
Service
Loyality
Service
Post
Service
Email
Service
“Create Points Balance!”
“Send Welcome Email”
“Send Welcome Pack”
14. 14
Synchronous vs. Asynchronous Integration
User
Content
Sales …
Suggestions Images
Frontend API New Frontend
Content Images
Suggestions Sales
Synchronous
Asynchronous
15. 15
Synchronous vs. Asynchronous Integration
User
Content
Sales …
Suggestions Images
Frontend API New Frontend
Content Images
Suggestions Sales
Asynchronous
Content ImagesContentImages
16. 16
Synchronous vs. Asynchronous Integration
“The one-hop rule: A service should not
call other services to respond to a request.”
https://messente.com/blog/most-recent/5-mistakes-transition-to-microservices
17. 17
Synchronous vs. Asynchronous Integration
“Simply put, without decoupling the data,
the architecture is not microservices.”
https://martinfowler.com/articles/break-monolith-into-microservices.html
23. 23
Distributed Transactions vs. Eventual Consistency –
Eventual Consistency
Content Service Search Service
Updates content Searches content
Eventually consistent
24. 24
• Search Service has a daily cronjob
• Fetches all content via REST API
• Search Index is eventually consistent “the next day”
Synchronous protocol + Orchestration
Distributed Transactions vs. Eventual Consistency –
Eventual Consistency done “simple”
25. 25
Distributed Transactions vs. Eventual Consistency –
Eventual Consistency done “hard”
• Content Service pushes update events to message queue
• Search Service subscribed to content update events
• Search Index is eventually consistent “every few seconds”
Asynchronous protocol + Choreography
30. 30
Service Routing – Container orchestration
Service
A
Service
B
http://10.0.1.78
kube-dns
10.0.1.78service-b
ingress
cluster
https://service-b.leanix.net
31. 31
Service Routing – Container orchestration
• Local Service Routing
• Ingress Routing
• Ingress HTTPs Encryption
32. 32
Service Routing – Router Model
Service
A
Service
B
cluster-westeurope cluster-eastus
Router
https://service-b.leanix.net
33. 33
Service Routing – Router Model
• Global Service Routing
• Rate Limiting
• Caching
• Generic Error Pages
34. 34
Service Routing – Service Mesh
Service
A
Service
B
cluster-westeurope cluster-eastus
proxy proxy
Gateway
Control
Plane
37. 37
“Speech is silver, silence is golden.”
Don Quijote
Organisational Considerations – Rule of Thumb
38. 38
“Organizations which design systems [...]
produce designs which are copies of the
communication structures of these organizations.”
M. Conway
Organisational Considerations – Conway’s Law