SlideShare a Scribd company logo
1 of 67
Download to read offline
Communication in a microservice architecture
Irina Scurtu
• Romania Based
• Software Architect @Endava
• Organizer of DotNet Iasi user group
• I teach .Net
@irina_scurtu
Agenda
▪ Monoliths& Microservices
▪ HTTP calls – sync & async
▪ RPC
▪ Messaging
▪ Queues
▪ Message Brokers
▪ Actor Model
MONOLITH
MONOLITH
▪ Self-contained
▪ Single codebase
▪ Single deploy unit
▪ Easy life for developers
▪ Dependencies are in your code
▪ Single technology stack
MONOLITH
▪ All or nothing deploys
▪ Downtimes
▪ Long build times
▪ ~ 0 continuous delivery
▪ Hard to test
Scaling the MONOLITH
Scale up
2
1 5
3
monolith syndrome?
MICROSERVICE?
▪ it’s that thing that is not a monolith
▪ With it’s own database
▪ Easy to deploy
▪ Standalone
▪ Easy to maintain
Is it?
MICROSERVICES?
▪ Introduces complexity
▪ Cascading effects in case of failure
▪ Need to monitor them closely
Principles of microservices
▪ Modeled around business concepts
▪ Culture of automation
▪ Independently deployable
▪ Isolate failure
2
1 5
3
Independent
units
Now we have
▪ Loosely coupled components
▪ Small codebases
▪ Easy to deploy and scale
▪ Reusable components
▪ Multiple databases
2
1 5
3
Do you know?
▪ Amazon calls 150 APIs to Build a Page
▪ Netflix services about 5 billions API calls/day
▪ 99.7% are internal
HTTP API CALLS
HTTP CALLS
S
Response
H
HTTP CALLS
S H
HTTP CALLS
“It’s perfectly
fine to use sync
HTTP Calls”
•Timeouts
•Availability
•Going back to coupling?
•You can loose requests
•Need to have a retry
mechanism
“It’s perfectly fine to use async HTTP Calls”
▪ You’ll have exactly the same issues as with sync calls
▪ Distribute load?!
▪ You can serve more request
▪ You can serve the requests faster
HTTP General Notes
▪ Sync by nature
▪ Make a TCP connection for each request
▪ No retry out of the box
▪ No delivery guarantees
▪ No routing without a Service Discovery or configuration
▪ Good for public facing APIs
▪ Familiar
▪ Easy to debug
Challenges
▪Service Discovery
▪Retry policies
▪Circuit breakers
▪Timeouts
▪Routing
▪Tracing
RPC
RPC
▪A kind of API call
▪Done through a message broker
▪Ties systems together but preserves their
encapsulations
RPC
S H
Queues
Request
RPC
S
Queues
Response
Request
H
Gain vs Loss
• You don’t lose the requests
• You can add more handler instances
• You can ‘apparently’ spread the load
• You can process more requests
▪ Need to match the request
to the response
▪ You wait for a response =>
sync
Messaging
Messaging
▪Gives you loosely coupled integration
▪Doesn’t require both systems to be up
▪Messages ca be transformed in transit
▪Messaging systems trade consistency for availability
▪You don’t loose messages
Messaging
ASYNC Queue Processing
S H
Queues
RequestRequest
Queue
S
Queues
Response
Request
Request
Request
H
Queue
Response
Response
With a DB
S
Queues
Response
Request
Request
Request
H
Storage
With a DB
s
Queues
Response
Request
Request
Request
H
Storage
Gains
• Is a reaction to the problems
of distributed sys
• Process more requests
• Process request faster
• Don’t lose requests
▪ You move the potential
issues to another
subsystem (DB in our case)
▪ Eventual consistency
remains a problem
Loss
Gain vs Loss
▪ Connection is scarce
▪ Batch process the message
▪ Use a semaphore to process them in batches
WHY USE A MESSAGE BROKER with MSA ?
Agility
❑Faster development
❑No integration process
❑Teams have ownership and full understanding of the
codebase
❑You can switch technologies if needed
Resiliency
❑You don’t have a single point of failure
Scalability
Scale up
Scale out
Performance
Increased Throughput
38 267 vs 3500
ElasticityScale down to
reduce costs
A lot of ‘ilities’
❑Reliability
❑Flexibility
❑Distribution
❑Increased Throughput
❑Scalability
❑Elasticity
❑Performance
❑Agility
Tools/Frameworks/Systems
Data Types
Queues
Actor Model
Message Brokers
What options do I have?
plenty
Many more
Queues
• Useful for point to point communication
• Messages are ordered and timestamped
• Pull-mode
Actor model
▪Actors are processes that encapsulate behaviour
▪Actors are more than message consumers
▪Can delegate and create new actors
▪Can supervise children
▪At most once delivery
Message Brokers
▪One process sends a message to a named queue or topic
▪One or many consumers
▪Handles connections and disconnections very well
▪One-way data flow or request/response model –”ReplyTo”
▪Dead-letter queue concept
Message Brokers
▪Lightweight
▪Queues are FIFO
▪Supports AMPQ protocol
▪Easy to use, fast
▪At-least-once delivery
AMPQ General Notes
▪ Async by nature
▪ Guaranteed message delivery
▪ At-least once, exactly once, at most once delivery
▪ No DNS resolve
▪ Programmatic routing
▪ Retries out-of-the box
▪ Ack, Nack out of the box
▪ Concept of “channel”
Topic Exchange
References
In Summary
Messages are great
show them some
THANK YOU
@irina_scurtu
Q&A

More Related Content

What's hot

NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
James Hollingworth
 

What's hot (17)

Securing Kafka with SPIFFE @ TransferWise
Securing Kafka with SPIFFE @ TransferWiseSecuring Kafka with SPIFFE @ TransferWise
Securing Kafka with SPIFFE @ TransferWise
 
Coding for the cloud - development of modern web applications
Coding for the cloud - development of modern web applicationsCoding for the cloud - development of modern web applications
Coding for the cloud - development of modern web applications
 
NServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architectureNServiceBus - introduction to a message based distributed architecture
NServiceBus - introduction to a message based distributed architecture
 
Rubyhosting
RubyhostingRubyhosting
Rubyhosting
 
ClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScriptClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScript
 
Tomas Urbonaitis "Introduction to asynchronous persistent messaging with NSer...
Tomas Urbonaitis "Introduction to asynchronous persistent messaging with NSer...Tomas Urbonaitis "Introduction to asynchronous persistent messaging with NSer...
Tomas Urbonaitis "Introduction to asynchronous persistent messaging with NSer...
 
UK VPS
UK VPSUK VPS
UK VPS
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page Apps
 
ReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOMReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOM
 
Modern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a FoxModern Web Security, Lazy but Mindful Like a Fox
Modern Web Security, Lazy but Mindful Like a Fox
 
Russia vps
Russia vpsRussia vps
Russia vps
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
 
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red HatThe Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
 
Measurement and Management of SQL Server
Measurement and Management of SQL ServerMeasurement and Management of SQL Server
Measurement and Management of SQL Server
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiya
 
Windows communication foundation (part1) jaliya udagedara
Windows communication foundation (part1)    jaliya udagedaraWindows communication foundation (part1)    jaliya udagedara
Windows communication foundation (part1) jaliya udagedara
 
Magento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed OptimizationMagento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed Optimization
 

Similar to Rigadevdays - Communication in a microservice architecture

Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
Rick Hightower
 

Similar to Rigadevdays - Communication in a microservice architecture (20)

Devit - forget about http requests
Devit  -  forget about http requestsDevit  -  forget about http requests
Devit - forget about http requests
 
Introduction-to-Cloud-Computing.pdf
Introduction-to-Cloud-Computing.pdfIntroduction-to-Cloud-Computing.pdf
Introduction-to-Cloud-Computing.pdf
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Simple Solutions for Complex Problems
Simple Solutions for Complex ProblemsSimple Solutions for Complex Problems
Simple Solutions for Complex Problems
 
Simple Solutions for Complex Problems
Simple Solutions for Complex Problems Simple Solutions for Complex Problems
Simple Solutions for Complex Problems
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challenges
 
Designing microservices part2
Designing microservices part2Designing microservices part2
Designing microservices part2
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupSimple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
 
Dotnetfest forget about http
Dotnetfest   forget about httpDotnetfest   forget about http
Dotnetfest forget about http
 
Microservices Design and Best Practices on AWS
Microservices Design and Best Practices on AWSMicroservices Design and Best Practices on AWS
Microservices Design and Best Practices on AWS
 
Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15Microservices for java architects it-symposium-2015-09-15
Microservices for java architects it-symposium-2015-09-15
 
Iot cloud service v2.0
Iot cloud service v2.0Iot cloud service v2.0
Iot cloud service v2.0
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Getting out of the monolith hell
Getting out of the monolith hellGetting out of the monolith hell
Getting out of the monolith hell
 
Understanding System Design and Architecture Blueprints of Efficiency
Understanding System Design and Architecture Blueprints of EfficiencyUnderstanding System Design and Architecture Blueprints of Efficiency
Understanding System Design and Architecture Blueprints of Efficiency
 
Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...
 
Tech talk microservices debugging
Tech talk microservices debuggingTech talk microservices debugging
Tech talk microservices debugging
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Rigadevdays - Communication in a microservice architecture