PRESENTED BY
PRESENTED BY
Hello, I’m Bobby Calderwood!
Software Engineer @Cognitect for 4+ years, Consulting and Datomic
Distinguished Engineer @CapitalOne for 3+ years, helping redesign and move
mission-critical banking systems to the cloud
Founder @Evident_Systems, helping smaller banks redesign and move mission-
critical banking systems to the cloud
Meet with me! http://meet.evident.systems/founder
PRESENTED BY
Agenda:
1 Story of a real customer system
Event-Sourcing + Redis + Clojure(Script) = Joy
2 But why that architecture?
A quick primer on CQRS + Event Sourcing using Redis Streams and Clojure(Script)
3 Demo system
Let’s pretend we have to build a system, and then modify it with an asynchronous integration
PRESENTED BY
Major automobile manufacturer
Greenfield system for new capability, political proving ground for stack and process
Highly asynchronous image processing and significant UI display/manipulation
Possible need for data re-processing/re-play, undo/redo, audit, and sharing with other
teams
We decided to architect it using Event Sourcing on Streaming Data using Redis,
and implemented in Clojure(Script)
Solving a customer problem
PRESENTED BY
But why that architecture?!?
PRESENTED BY
At very least, we knew we had to
process images asynchronously
We suspected that we’d need to
keep this pipeline flexible, to try
different processing steps and
techniques
We knew we’d need to convey the
results of this pipeline back to the
UI (the oft-forgotten participant in
the distributed system)
To facilitate our asynchronous processing pipeline
PRESENTED BY
Integration among “object/entity-oriented” microservices becomes complex and
burdensome
• Balkanization of data stores
• Data “owner” determines data access pattern
• Non-determinism == impossibility of reasoning about system:
– state
– causality/time
– modes of failure
Because HTTP APIs aren’t enough
Redis Streams for Event-Driven Microservices
PRESENTED BY
Request/response protocols face a fundamental epistemological problem
• What is happening, anything new?
• When should I check for new data?
• Who’s responsible to tell me?
Because HTTP APIs aren’t enough
PRESENTED BY
Event Sourcing provides “as-of”
consistency across distributed
participants (Online Event Processing)
Streaming Data protocols convey new
data/events to interested participants
(subscribers)
Any participant can simulate synchrony
and consistency by blocking and waiting
for a specific event
Event Sourcing + Streaming Data Facilitate Distributed Consistency
Image by Alan Light CC BY-SA 3.0
PRESENTED BY
Cross-cutting concerns need access to your application’s data
• Analytics
• Audit/Compliance/Governance
• Systems Integration
And they don’t want to ETL out of your database…
• Lossy, due to your app’s worldview and assumptions
• Latent
• Requires coordination with you (“we’ll add it to the backlog”)
• Complex
Event Sourcing + Streaming Data Enable Cooperation without Coordination
PRESENTED BY
Only one way to cause change to a bounded context
• Send a Command to its API
Two ways to read from a bounded context:
• Listen to its Event stream
– create your own Read Models from one or more Event Streams
– or maybe incorporate subset of Events into your own Event stream
• Ask Queries of its Read Models
CQRS Separates Action from Perception
Redis Streams for Event-Driven Microservices
Nasa, Public Domain
PRESENTED BY
Why Redis?
(for streaming data)
PRESENTED BY
Redis is ubiquitous: you (or your customer) already has it in the stack
Redis is battle-tested, and Ops is comfortable with it
Redis is (often) easier to operate than Kafka (with some tradeoffs)
Redis is Already There, and Just Works
PRESENTED BY
After Kafka popularized the stream data structure, Salvatore noticed gap in
Redis, as he described: http://antirez.com/news/114
Existing data structures got almost there
• Sorted Sets: memory hungry, clients can’t block awaiting new records, order
not stable
• Lists: linear time to scan, can’t seek to specific position, no fan-out to multiple
consumers
• Pub/Sub: doesn’t maintain history, can’t do windowed aggregation, etc.
Streams maintain queryable history, and efficiently convey to subscribers
Redis Provides Streams
PRESENTED BY
XADD — Produce to a Stream
XRANGE, XREVRANGE — Query stream per range of existing offsets, non-
blocking, batch-ish
XREAD — Optionally-blocking read (conveys novelty), realtime-ish
XREADGROUP — Optionally-blocking read by a group of consumers, ack-ing
messages to advance consumer offset (but watch message ordering!)
But How to Redis Stream?
https://redis.io/topics/streams-intro
PRESENTED BY
Why Clojure?
PRESENTED BY
Clojure is a fantastic all-purpose programming language whose functional
programming philosophy aligns well with event sourcing, streaming data
We needed to build all components quickly, with a small team of Clojurists:
• UI in ClojureScript
– React + Reagent + re-frame
– Access to JavaScript libraries with Clojure language semantics
• HTTP API in Clojure + Pedestal (+ GraphQL via Lacinia)
• Workers in Clojure
Clojure’s core.async library provide in-process semantics aligned with streaming
data
Clojure(Script) is powerful and full-stack
PRESENTED BY
Very solid, simple Redis client
Generated from Redis artifacts
Stays close to Redis semantics
https://github.com/ptaoussanis/carmine/
Clojure has Carmine
PRESENTED BY
Let’s Build a Demo System!
PRESENTED BY
Store Front Web/Mobile App
How Customers order online, pick up in store
Easy enough, but…
Baristas have to make the drinks
How to coordinate their work?
Should we notify the customers when their order is ready?
Later we discover that managers must monitor inventory levels!
Curiouser and Curiouser!
A Coffee Shop
Redis Streams for Event-Driven Microservices
PRESENTED BY
Demo System In Action
PRESENTED BY
Build APIs from an immutable log of business events
Using CQRS + Event Sourcing via Redis Streams https://redis.io/topics/streams-intro
Online Event Processing, Martin Kleppmann et. al. https://queue.acm.org/detail.cfm?id=3321612
Try Clojure and ClojureScript https://clojure.org/
Check out the demo app! https://github.com/bobby/redisconf19-demo
Conclusion
Thank you!
Thank you!

More Related Content

PDF
5 Factors When Selecting a High Performance, Low Latency Database
PDF
Apache airflow
PDF
Kappa vs Lambda Architectures and Technology Comparison
PDF
MongoDB at Baidu
DOCX
Data engineer perfomance appraisal 2
PDF
Google Cloud Dataflow
PPTX
Where is my bottleneck? Performance troubleshooting in Flink
PPTX
Building a Virtual Data Lake with Apache Arrow
5 Factors When Selecting a High Performance, Low Latency Database
Apache airflow
Kappa vs Lambda Architectures and Technology Comparison
MongoDB at Baidu
Data engineer perfomance appraisal 2
Google Cloud Dataflow
Where is my bottleneck? Performance troubleshooting in Flink
Building a Virtual Data Lake with Apache Arrow

What's hot (20)

PDF
Microservices & API Gateways
PDF
ksqlDB: A Stream-Relational Database System
PDF
Scaling your Data Pipelines with Apache Spark on Kubernetes
PDF
PySpark Best Practices
PDF
Apache Airflow
PDF
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
PPTX
Autoscaling Flink with Reactive Mode
PDF
How Netflix Tunes EC2 Instances for Performance
PDF
Introducing Apache Airflow and how we are using it
PDF
Airflow presentation
PDF
Reliable and Scalable Data Ingestion at Airbnb
PDF
Airflow for Beginners
PDF
Building an analytics workflow using Apache Airflow
PPTX
Evening out the uneven: dealing with skew in Flink
PPTX
Apache Flink Training: DataStream API Part 1 Basic
PDF
MongoDB vs. Postgres Benchmarks
 
PPTX
Apache Airflow overview
PDF
Unified MLOps: Feature Stores & Model Deployment
PDF
Platform Engineering
PPTX
Apache Kafka - Patterns anti-patterns
Microservices & API Gateways
ksqlDB: A Stream-Relational Database System
Scaling your Data Pipelines with Apache Spark on Kubernetes
PySpark Best Practices
Apache Airflow
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Autoscaling Flink with Reactive Mode
How Netflix Tunes EC2 Instances for Performance
Introducing Apache Airflow and how we are using it
Airflow presentation
Reliable and Scalable Data Ingestion at Airbnb
Airflow for Beginners
Building an analytics workflow using Apache Airflow
Evening out the uneven: dealing with skew in Flink
Apache Flink Training: DataStream API Part 1 Basic
MongoDB vs. Postgres Benchmarks
 
Apache Airflow overview
Unified MLOps: Feature Stores & Model Deployment
Platform Engineering
Apache Kafka - Patterns anti-patterns
Ad

Similar to Redis Streams for Event-Driven Microservices (20)

PDF
Using Redis Streams To Build Event Driven Microservices And User Interface In...
PDF
Streaming Visualization
PDF
REST full API Design
PDF
Introduction to Stream Processing
PDF
Confluent Partner Tech Talk with Reply
PPTX
Data to Consumer : end to end middleware capabilities
PDF
Build Event-Driven Microservices with Confluent Cloud Workshop #1
PDF
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
PDF
apidays LIVE Australia 2020 - The Evolution of APIs: Events and the AsyncAPI ...
PDF
Message Driven and Event Sourcing
PPTX
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
PPTX
A Connector, A Container and an API Walk into a Bar… Microservices Edition
PPTX
A Connector, A Container and an API Walk into a Bar… Microservices Edition
PDF
Introduction to Streaming Analytics
PDF
The Why and How of Applications with APIs and microservices
PDF
Introduction to Stream Processing
PDF
Introduction to Stream Processing
PDF
Stream Processing – Concepts and Frameworks
PPTX
RTP Bluemix Meetup April 20th 2016
PDF
Google Cloud Next '22 Recap: Serverless & Data edition
Using Redis Streams To Build Event Driven Microservices And User Interface In...
Streaming Visualization
REST full API Design
Introduction to Stream Processing
Confluent Partner Tech Talk with Reply
Data to Consumer : end to end middleware capabilities
Build Event-Driven Microservices with Confluent Cloud Workshop #1
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
apidays LIVE Australia 2020 - The Evolution of APIs: Events and the AsyncAPI ...
Message Driven and Event Sourcing
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
A Connector, A Container and an API Walk into a Bar… Microservices Edition
A Connector, A Container and an API Walk into a Bar… Microservices Edition
Introduction to Streaming Analytics
The Why and How of Applications with APIs and microservices
Introduction to Stream Processing
Introduction to Stream Processing
Stream Processing – Concepts and Frameworks
RTP Bluemix Meetup April 20th 2016
Google Cloud Next '22 Recap: Serverless & Data edition
Ad

More from Redis Labs (20)

PPTX
Redis Day Bangalore 2020 - Session state caching with redis
PPTX
Protecting Your API with Redis by Jane Paek - Redis Day Seattle 2020
PPTX
The Happy Marriage of Redis and Protobuf by Scott Haines of Twilio - Redis Da...
PPTX
SQL, Redis and Kubernetes by Paul Stanton of Windocks - Redis Day Seattle 2020
PPTX
Rust and Redis - Solving Problems for Kubernetes by Ravi Jagannathan of VMwar...
PPTX
Redis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
PPTX
Practical Use Cases for ACLs in Redis 6 by Jamie Scott - Redis Day Seattle 2020
PPTX
Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020
PPTX
Leveraging Redis for System Monitoring by Adam McCormick of SBG - Redis Day S...
PPTX
JSON in Redis - When to use RedisJSON by Jay Won of Coupang - Redis Day Seatt...
PPTX
Highly Available Persistent Session Management Service by Mohamed Elmergawi o...
PPTX
Anatomy of a Redis Command by Madelyn Olson of Amazon Web Services - Redis Da...
PPTX
Building a Multi-dimensional Analytics Engine with RedisGraph by Matthew Goos...
PPTX
RediSearch 1.6 by Pieter Cailliau - Redis Day Bangalore 2020
PPTX
RedisGraph 2.0 by Pieter Cailliau - Redis Day Bangalore 2020
PPTX
RedisTimeSeries 1.2 by Pieter Cailliau - Redis Day Bangalore 2020
PPTX
RedisAI 0.9 by Sherin Thomas of Tensorwerk - Redis Day Bangalore 2020
PPTX
Rate-Limiting 30 Million requests by Vijay Lakshminarayanan and Girish Koundi...
PDF
Three Pillars of Observability by Rajalakshmi Raji Srinivasan of Site24x7 Zoh...
PPTX
Solving Complex Scaling Problems by Prashant Kumar and Abhishek Jain of Myntr...
Redis Day Bangalore 2020 - Session state caching with redis
Protecting Your API with Redis by Jane Paek - Redis Day Seattle 2020
The Happy Marriage of Redis and Protobuf by Scott Haines of Twilio - Redis Da...
SQL, Redis and Kubernetes by Paul Stanton of Windocks - Redis Day Seattle 2020
Rust and Redis - Solving Problems for Kubernetes by Ravi Jagannathan of VMwar...
Redis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
Practical Use Cases for ACLs in Redis 6 by Jamie Scott - Redis Day Seattle 2020
Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020
Leveraging Redis for System Monitoring by Adam McCormick of SBG - Redis Day S...
JSON in Redis - When to use RedisJSON by Jay Won of Coupang - Redis Day Seatt...
Highly Available Persistent Session Management Service by Mohamed Elmergawi o...
Anatomy of a Redis Command by Madelyn Olson of Amazon Web Services - Redis Da...
Building a Multi-dimensional Analytics Engine with RedisGraph by Matthew Goos...
RediSearch 1.6 by Pieter Cailliau - Redis Day Bangalore 2020
RedisGraph 2.0 by Pieter Cailliau - Redis Day Bangalore 2020
RedisTimeSeries 1.2 by Pieter Cailliau - Redis Day Bangalore 2020
RedisAI 0.9 by Sherin Thomas of Tensorwerk - Redis Day Bangalore 2020
Rate-Limiting 30 Million requests by Vijay Lakshminarayanan and Girish Koundi...
Three Pillars of Observability by Rajalakshmi Raji Srinivasan of Site24x7 Zoh...
Solving Complex Scaling Problems by Prashant Kumar and Abhishek Jain of Myntr...

Recently uploaded (20)

PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PPTX
Information-Technology-in-Human-Society (2).pptx
PDF
Addressing the challenges of harmonizing law and artificial intelligence tech...
PDF
Fitaura: AI & Machine Learning Powered Fitness Tracker
PPTX
CRM(Customer Relationship Managmnet) Presentation
PPTX
maintenance powerrpoint for adaprive and preventive
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Chapter 1: computer maintenance and troubleshooting
PDF
Human Computer Interaction Miterm Lesson
PDF
Advancements in abstractive text summarization: a deep learning approach
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PPT
Storage Area Network Best Practices from HP
PPT
Overviiew on Intellectual property right
PDF
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
Internet of Things (IoT) – Definition, Types, and Uses
PDF
Decision Optimization - From Theory to Practice
PDF
Ebook - The Future of AI A Comprehensive Guide.pdf
PDF
Optimizing bioinformatics applications: a novel approach with human protein d...
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
Report in SIP_Distance_Learning_Technology_Impact.pptx
Information-Technology-in-Human-Society (2).pptx
Addressing the challenges of harmonizing law and artificial intelligence tech...
Fitaura: AI & Machine Learning Powered Fitness Tracker
CRM(Customer Relationship Managmnet) Presentation
maintenance powerrpoint for adaprive and preventive
Build automations faster and more reliably with UiPath ScreenPlay
Chapter 1: computer maintenance and troubleshooting
Human Computer Interaction Miterm Lesson
Advancements in abstractive text summarization: a deep learning approach
NewMind AI Journal Monthly Chronicles - August 2025
Storage Area Network Best Practices from HP
Overviiew on Intellectual property right
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Internet of Things (IoT) – Definition, Types, and Uses
Decision Optimization - From Theory to Practice
Ebook - The Future of AI A Comprehensive Guide.pdf
Optimizing bioinformatics applications: a novel approach with human protein d...

Redis Streams for Event-Driven Microservices

  • 2. PRESENTED BY Hello, I’m Bobby Calderwood! Software Engineer @Cognitect for 4+ years, Consulting and Datomic Distinguished Engineer @CapitalOne for 3+ years, helping redesign and move mission-critical banking systems to the cloud Founder @Evident_Systems, helping smaller banks redesign and move mission- critical banking systems to the cloud Meet with me! http://meet.evident.systems/founder
  • 3. PRESENTED BY Agenda: 1 Story of a real customer system Event-Sourcing + Redis + Clojure(Script) = Joy 2 But why that architecture? A quick primer on CQRS + Event Sourcing using Redis Streams and Clojure(Script) 3 Demo system Let’s pretend we have to build a system, and then modify it with an asynchronous integration
  • 4. PRESENTED BY Major automobile manufacturer Greenfield system for new capability, political proving ground for stack and process Highly asynchronous image processing and significant UI display/manipulation Possible need for data re-processing/re-play, undo/redo, audit, and sharing with other teams We decided to architect it using Event Sourcing on Streaming Data using Redis, and implemented in Clojure(Script) Solving a customer problem
  • 5. PRESENTED BY But why that architecture?!?
  • 6. PRESENTED BY At very least, we knew we had to process images asynchronously We suspected that we’d need to keep this pipeline flexible, to try different processing steps and techniques We knew we’d need to convey the results of this pipeline back to the UI (the oft-forgotten participant in the distributed system) To facilitate our asynchronous processing pipeline
  • 7. PRESENTED BY Integration among “object/entity-oriented” microservices becomes complex and burdensome • Balkanization of data stores • Data “owner” determines data access pattern • Non-determinism == impossibility of reasoning about system: – state – causality/time – modes of failure Because HTTP APIs aren’t enough
  • 9. PRESENTED BY Request/response protocols face a fundamental epistemological problem • What is happening, anything new? • When should I check for new data? • Who’s responsible to tell me? Because HTTP APIs aren’t enough
  • 10. PRESENTED BY Event Sourcing provides “as-of” consistency across distributed participants (Online Event Processing) Streaming Data protocols convey new data/events to interested participants (subscribers) Any participant can simulate synchrony and consistency by blocking and waiting for a specific event Event Sourcing + Streaming Data Facilitate Distributed Consistency Image by Alan Light CC BY-SA 3.0
  • 11. PRESENTED BY Cross-cutting concerns need access to your application’s data • Analytics • Audit/Compliance/Governance • Systems Integration And they don’t want to ETL out of your database… • Lossy, due to your app’s worldview and assumptions • Latent • Requires coordination with you (“we’ll add it to the backlog”) • Complex Event Sourcing + Streaming Data Enable Cooperation without Coordination
  • 12. PRESENTED BY Only one way to cause change to a bounded context • Send a Command to its API Two ways to read from a bounded context: • Listen to its Event stream – create your own Read Models from one or more Event Streams – or maybe incorporate subset of Events into your own Event stream • Ask Queries of its Read Models CQRS Separates Action from Perception
  • 15. PRESENTED BY Why Redis? (for streaming data)
  • 16. PRESENTED BY Redis is ubiquitous: you (or your customer) already has it in the stack Redis is battle-tested, and Ops is comfortable with it Redis is (often) easier to operate than Kafka (with some tradeoffs) Redis is Already There, and Just Works
  • 17. PRESENTED BY After Kafka popularized the stream data structure, Salvatore noticed gap in Redis, as he described: http://antirez.com/news/114 Existing data structures got almost there • Sorted Sets: memory hungry, clients can’t block awaiting new records, order not stable • Lists: linear time to scan, can’t seek to specific position, no fan-out to multiple consumers • Pub/Sub: doesn’t maintain history, can’t do windowed aggregation, etc. Streams maintain queryable history, and efficiently convey to subscribers Redis Provides Streams
  • 18. PRESENTED BY XADD — Produce to a Stream XRANGE, XREVRANGE — Query stream per range of existing offsets, non- blocking, batch-ish XREAD — Optionally-blocking read (conveys novelty), realtime-ish XREADGROUP — Optionally-blocking read by a group of consumers, ack-ing messages to advance consumer offset (but watch message ordering!) But How to Redis Stream? https://redis.io/topics/streams-intro
  • 20. PRESENTED BY Clojure is a fantastic all-purpose programming language whose functional programming philosophy aligns well with event sourcing, streaming data We needed to build all components quickly, with a small team of Clojurists: • UI in ClojureScript – React + Reagent + re-frame – Access to JavaScript libraries with Clojure language semantics • HTTP API in Clojure + Pedestal (+ GraphQL via Lacinia) • Workers in Clojure Clojure’s core.async library provide in-process semantics aligned with streaming data Clojure(Script) is powerful and full-stack
  • 21. PRESENTED BY Very solid, simple Redis client Generated from Redis artifacts Stays close to Redis semantics https://github.com/ptaoussanis/carmine/ Clojure has Carmine
  • 22. PRESENTED BY Let’s Build a Demo System!
  • 23. PRESENTED BY Store Front Web/Mobile App How Customers order online, pick up in store Easy enough, but… Baristas have to make the drinks How to coordinate their work? Should we notify the customers when their order is ready? Later we discover that managers must monitor inventory levels! Curiouser and Curiouser! A Coffee Shop
  • 26. PRESENTED BY Build APIs from an immutable log of business events Using CQRS + Event Sourcing via Redis Streams https://redis.io/topics/streams-intro Online Event Processing, Martin Kleppmann et. al. https://queue.acm.org/detail.cfm?id=3321612 Try Clojure and ClojureScript https://clojure.org/ Check out the demo app! https://github.com/bobby/redisconf19-demo Conclusion

Editor's Notes

  • #12: "We'll add it to the backlog" is just the polite way of saying no. —Mark Dalgleish https://twitter.com/markdalgleish/status/1143411813465223168