SlideShare a Scribd company logo
Microservices in a
Streaming World
There are many good reasons for
building service-based systems
• Loose Coupling
• Bounded Contexts
• Autonomy
• Ease of scaling
• Composability
But when we do,
we’re building a distributed system
This can be a bit tricky
Monolithic & Centralised
Approaches
Shared, mutable state
Decentralisation
Microservices for a Streaming World
Stream Processing is
a bit different
batch analytics => real time => at scale => accurately
and comes with an
interesting toolset
Stream Processing
Toolset
Business Applications
Some fundamental
patterns of distributed
systems
Request / Response
Mediator / Workflow
Request/Response
Event Driven
Async / Fire and Forget
Event Based
• Simple
• Synchronous
• Event Driven
• Good decoupling
• Requires Broker
• Fire & Forget
• Polling
• Full decoupling
Request/Response vs.
SOA / Microservices
Message Broker
Event Based Request/Response
Combinations
Event-
Based
Request/
Response
Combinations
Withdraw 

£100
Account

Service
General

Ledger
Customer

Statements
Fraud

Detection
Check 

Funds
Async Message Broker
I need
moneyReST
Services generally eschew
shared, mutable state
How do we put these
things together?
Request/Response
Request/Response
Request
Response
ReST
Request/Response
+ Registry
Registry
Request
Response
ReST
Asynchronous and
Event-Based
Communication
Queues
Point to Point
Service A Service B
Load Balancing
Instance 2
Instance 1
Single message allocation has scalability issues
Batched Allocation
Instance 1
Instance 2
Throughput!
Lose Ordering Guarantees
Fail!
Instance 1
Instance 2
Topics
Topics are Broadcast
Consumer
Consumer
Broker broadcast
Topics Retain Ordering
Trades
Buys
Sells
Broker Instance 1
Instance 2
Even when services fail
Trades
Buys
Sells
Fail!
Broker
We retain ordering, but we have to detect & reprovision
Instance 1
Instance 2
A Few Implications
Queues Lose Ordering
Guarantees at Scale
Fail!
Worker 1
Worker 2
Trades
Buys
Sells
Topics don’t provide
availability
Broker
Trades
Buys
Sells
Messages are Transient
Broker
Is there another way?
A Distributed Log
Kafka is one example
Think back to the queue
example
Batch
Batch
Shard on the way in
Each shard is a queue
Strong Ordering (in shard). Good concurrency.
Each consuming service is assigned
a “personal set” of queues
each little queue is sent to only one service in a group
Services instances naturally
rebalance on failure
Service instance dies, data is redirected,
ordering guarantees remain
Very Scalable, Very High
Throughput
Sharded In, Sharded Out
Reduces to a globally
ordered queue
Fault Tolerance
The Log
Single seek & scan
Append
only
messages don’t need to be transient!
Cleaning the Log
Delete old segments
Cleaning the Log
Delete old versions that share the same key
K1
K1
K1
K2
K2
K2
K1
V1
V1
V2
V3
V2
V4
V3
• Scalable multiprocessing
• Strong partition-based ordering
• Efficient data retention
• Always on
So how is this useful
for microservices?
Build ‘Always On’ Services
Rely on Fault
Tolerant Broker
Load Balance Services
Load Balance Services
(with strong ordering)
Fault Tolerant Services
Services automatically
fail over
(retaining ordering)
Services can return back to
old messages in the log
Rewind & Replay
Compacted Topics are
Interesting
K1
K1
K1
K2
K2
K2
K1
V1
V1
V2
V3
V2
V4
V3
Lets take a little
example
Getting Exchange Rates
Exchange

Rate

Service
USD/GBP = 0.71
EUR/GBP = 0.77
USD/INR = 67.7
USD/AUD = 1.38
EUR/JPY = 114.41
…
I

need 

exchange 

rates!
Option1: Request Response
rate for USD/GBP?
0.71
Exchange

Rate

Service
I 

need 

exchange 

rates!
Option 2: Publish Subscribe
Exchange

Rate

Service
Accumulate current state
ETL
I

need 

exchange 

rates!
Option 3: Accumulate in
Compacted Stream
Exchange

Rate

Service
Get all exchange
rates
Publish to clients
USD/GBP = 0.71
EUR/GBP = 0.77
USD/INR = 67.7
USD/AUD = 1.38
EUR/JPY = 114.41
…
Broker retains
latest versions
Publish all rate events
Is it a stream or is it a table?
transitory stateful
Datasets can live in the broker!
trades books
risk results
ex-

rates
Service Backbone
Scalable, Fault Tolerant, Concurrent, Strongly Ordered, Stateful
… lets add in stream
processing
Max(price)

From orders

where ccy=‘GBP’

over 1 day window

emitting every second
What is stream processing?
Continuous Queries.
What is stream processing
engine?
Data
Index
Query

Engine
Query

Engine
vs
Database
Finite, well defined source
Stream Processor
Infinite, poorly defined source
Windowing
For unordered or unpredictable streams
Sliding

Fixed

(tumbling)
Features: similar to
database query engine
JoinFilter
Aggr-

egate
View
Window
KStreams & KTables
stream
Compacted

stream
Join
Streaming Data
Stored Data
KStream
KTable
A little example…
Buying Lunch Abroad
Payments

Service
Exchange

Rates

Service
Buy
Notification 

Service

Amount in ££
$$
$$
Text Message: ££
$$
Request-Response Option
Payments

Service
Exchange

Rates

Service
Buy
Amount in ££
Join etc
Text Message: ££
Iterative join
over the network
ETL Option
Payments

Service
Exchange

Rates

Service
Buy
Amount in ££
ETL
ETL
Join etc
Text Message: ££
Stream Processor Option
Payments

Service
Exchange

Rates

Service
Buy
Stream

Processor
join

etc
Text Message: ££
Buying Lunch Abroad
Payments
Exchange

Rates
Looks like

a table

(compacted

stream)
Looks like 

an infinite 

stream
KStream
KTable
Buying Lunch Abroad
Payments
Exchange

Rates
• Filter(ccy<>’GBP’)
• Join on ccy
• Calculate GBP
• Send text message
buffering
Local DB (fast joins)
Topic
Compacted

Topic
KStream
pre-populate
KTables can also be written to
- they’re backed by the broker
Manage
intermediary
state
KStream
KTable
Topic
Compacted

Topic
Scales Out (MPP)
These tools are pretty
handy
for managing decentralised services
Talk our own data model
Data

Stream
View
Query
Handle Unpredictability
9am 5pm
Late trades
Joining Services
Payments
Exchange

Rates
Join
Duality between Stream and
Table
Join
KStream
KTable
More Complex Use Cases
Trades Valuations
Books Customers
General
Ledger
trades books
risk results
ex-

rates
Practical mechanism for managing data
intensive, loosely coupled services
• Stateful streams live
inside the Log
• Data extracted quickly!
• Fast, local joins, over
large datasets
• HA pre-caching
• Manage intermediary
state
• Just a simple library
(over Kafka)
There is much more to
stream processing
it is grounded in the world of big-data analytics
Simple Approaches
Just a library (over Kafka)
Keeping Services
Consistent
Big Global Bag of 

State in the Sky
Problem: No BGBSS
How to you provide the
accuracy of this
In this?
Centralised vs Federated
Centralised
consistency model
Distributed
consistency model
One problem is failure
Duplicate messages are
inevitable
have I seen
this before?
Make Services Idempotent
try 1
try 2
try 3
try 4
Stream processors have to
solve this problem
Exactly Once
not available in Kafka… yet
So what do we have?
Use Both Approaches
Event-
Based
Request/
Response
Queued Delivery System
Ordered queue
Scales Horizontally
Scales Horizontally
Scales Horizontally
Scales Horizontally
Built In Fault Tolerance
Runs Always On
For Services Too
Scales Horizontally
Load Balance
continue through failure
Scales Horizontally
with history stored in the Log
Scales Horizontally
Extending to any number of
services
Scales Horizontally
With any data throughput
Scales Horizontally
With any data throughput
Scales Horizontally
With any data throughput
Scales Horizontally
powerful tools
for slicing and
dicing streams
Scales Horizontally
the declarative
processing of
data
join
filter
aggregate
at any
throughput
Scales Horizontally
leveraging
fast local
persistence
Scales Horizontally
backed up to
the log
Scales Horizontally
easily join
streaming
services
Blend
KStreams
and KTables
trades books
risk results
ex-

rates
with data living
in the stream
but retaining
loose coupling
trades books
risk results
ex-

rates
Scales Horizontally
with strong ordering and
repeatability guarantees
(eventually)
so…
Microservices push us away
from shared, mutable state
Big Global Bag of 

State in the Sky
Away from BGBSS’s
This means data is
increasingly remote
Sure, you can collect it all
copy copy
copy
copy
copy
copy
copy
ETL
ETL
ETL ETL
ETL
ETL
can be a lot of work
Or you can look it all up
get
get
get
get
get
get
get
get, get, 

get, get
but that doesn’t scale well
(with system complexity or with data throughput)
Better to embrace
decentralistion
We need a decentralised
toolset to do this
trades books
risk results
ex-

rates
Keep it simple,
Keep it moving

More Related Content

PPT
The Architect's Two Hats
PDF
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
PDF
The return of big iron?
PDF
Data Pipelines with Apache Kafka
PDF
Balancing Replication and Partitioning in a Distributed Java Database
PDF
Putting the Micro into Microservices with Stateful Stream Processing
PDF
Azure and cloud design patterns
PPTX
Scaling Systems: Architectures that grow
The Architect's Two Hats
Beyond The Data Grid: Coherence, Normalisation, Joins and Linear Scalability
The return of big iron?
Data Pipelines with Apache Kafka
Balancing Replication and Partitioning in a Distributed Java Database
Putting the Micro into Microservices with Stateful Stream Processing
Azure and cloud design patterns
Scaling Systems: Architectures that grow

What's hot (20)

PDF
Storing and processing data with the wso2 platform
PPTX
Scaling Systems: Architectures that Grow
PDF
Event Driven-Architecture from a Scalability perspective
PPTX
Natural Laws of Software Performance
PDF
10 Tricks to Ensure Your Oracle Coherence Cluster is Not a "Black Box" in Pro...
PPTX
Scalable Web Architecture and Distributed Systems
PPTX
Patterns of enterprise application architecture
PPT
Azure Cloud Patterns
PPTX
Oracle Coherence
PDF
The Data Dichotomy- Rethinking the Way We Treat Data and Services
PPTX
Webinar: Eventual Consistency != Hopeful Consistency
PDF
Confluent Messaging Modernization Forum
PPTX
Oracle Coherence Strategy and Roadmap (OpenWorld, September 2014)
PPTX
PPTX
CQRS & EVS with MongoDb
PPTX
Database Virtualization: The Next Wave of Big Data
PDF
Devoxx London 2017 - Rethinking Services With Stateful Streams
PPTX
Increase Profits with Better Vehicle Listing Data
PPTX
Blockchain for the DBA and Data Professional
PDF
HBaseCon 2013: Real-Time Model Scoring in Recommender Systems
Storing and processing data with the wso2 platform
Scaling Systems: Architectures that Grow
Event Driven-Architecture from a Scalability perspective
Natural Laws of Software Performance
10 Tricks to Ensure Your Oracle Coherence Cluster is Not a "Black Box" in Pro...
Scalable Web Architecture and Distributed Systems
Patterns of enterprise application architecture
Azure Cloud Patterns
Oracle Coherence
The Data Dichotomy- Rethinking the Way We Treat Data and Services
Webinar: Eventual Consistency != Hopeful Consistency
Confluent Messaging Modernization Forum
Oracle Coherence Strategy and Roadmap (OpenWorld, September 2014)
CQRS & EVS with MongoDb
Database Virtualization: The Next Wave of Big Data
Devoxx London 2017 - Rethinking Services With Stateful Streams
Increase Profits with Better Vehicle Listing Data
Blockchain for the DBA and Data Professional
HBaseCon 2013: Real-Time Model Scoring in Recommender Systems
Ad

Similar to Microservices for a Streaming World (20)

PPTX
Patterns of Distributed Application Design
PDF
Patterns of Distributed Application Design
PDF
Scaling systems using change propagation across data stores
PPT
ScalabilityAvailability
PPTX
Service Mesh CTO Forum (Draft 3)
PPTX
Introduction to Microservices
PPTX
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
 
PDF
Petabytes and Nanoseconds
PDF
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
PDF
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
PPTX
Fort Lauderdale Tech Talks - The Future is the Cloud
PPTX
Event Driven Architectures
PDF
Event-Driven Architectures Done Right | Tim Berglund, Confluent
PPTX
Azure architecture design patterns - proven solutions to common challenges
PDF
Data Consitency Patterns in Cloud Native Applications
PDF
Events in a microservices architecture
PDF
Microservices for java architects it-symposium-2015-09-15
PPTX
Tef con2016 (1)
PPTX
Event Driven Microservices architecture
PDF
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
Patterns of Distributed Application Design
Patterns of Distributed Application Design
Scaling systems using change propagation across data stores
ScalabilityAvailability
Service Mesh CTO Forum (Draft 3)
Introduction to Microservices
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
 
Petabytes and Nanoseconds
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
Fort Lauderdale Tech Talks - The Future is the Cloud
Event Driven Architectures
Event-Driven Architectures Done Right | Tim Berglund, Confluent
Azure architecture design patterns - proven solutions to common challenges
Data Consitency Patterns in Cloud Native Applications
Events in a microservices architecture
Microservices for java architects it-symposium-2015-09-15
Tef con2016 (1)
Event Driven Microservices architecture
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
Ad

More from Ben Stopford (20)

PPTX
10 Principals for Effective Event-Driven Microservices with Apache Kafka
PPTX
10 Principals for Effective Event Driven Microservices
PDF
The Future of Streaming: Global Apps, Event Stores and Serverless
PDF
A Global Source of Truth for the Microservices Generation
PDF
Building Event Driven Services with Kafka Streams
PDF
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with Streams
PDF
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
PDF
Building Event Driven Services with Stateful Streams
PDF
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
PDF
Event Driven Services Part 1: The Data Dichotomy
PDF
Event Driven Services Part 3: Putting the Micro into Microservices with State...
PDF
Strata Software Architecture NY: The Data Dichotomy
PDF
The Power of the Log
PDF
Streaming, Database & Distributed Systems Bridging the Divide
PDF
JAX London Slides
PDF
A little bit of clojure
PPTX
Big iron 2 (published)
PDF
Big Data & the Enterprise
PDF
Where Does Big Data Meet Big Database - QCon 2012
PPTX
Advanced databases ben stopford
10 Principals for Effective Event-Driven Microservices with Apache Kafka
10 Principals for Effective Event Driven Microservices
The Future of Streaming: Global Apps, Event Stores and Serverless
A Global Source of Truth for the Microservices Generation
Building Event Driven Services with Kafka Streams
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with Streams
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
Building Event Driven Services with Stateful Streams
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
Event Driven Services Part 1: The Data Dichotomy
Event Driven Services Part 3: Putting the Micro into Microservices with State...
Strata Software Architecture NY: The Data Dichotomy
The Power of the Log
Streaming, Database & Distributed Systems Bridging the Divide
JAX London Slides
A little bit of clojure
Big iron 2 (published)
Big Data & the Enterprise
Where Does Big Data Meet Big Database - QCon 2012
Advanced databases ben stopford

Recently uploaded (20)

PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
L1 - Introduction to python Backend.pptx
PDF
Cost to Outsource Software Development in 2025
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
medical staffing services at VALiNTRY
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Transform Your Business with a Software ERP System
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Digital Systems & Binary Numbers (comprehensive )
Design an Analysis of Algorithms II-SECS-1021-03
CHAPTER 2 - PM Management and IT Context
L1 - Introduction to python Backend.pptx
Cost to Outsource Software Development in 2025
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
medical staffing services at VALiNTRY
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Complete Guide to Website Development in Malaysia for SMEs
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Transform Your Business with a Software ERP System
Designing Intelligence for the Shop Floor.pdf
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Monitoring Stack: Grafana, Loki & Promtail
Digital Systems & Binary Numbers (comprehensive )

Microservices for a Streaming World