Irakli Nadareishvili - O'Reilly SACon 2018, London
Asynchronicity in Microservices
Three Main Forms of Asynchronicity – Understanding the Patterns
O’Reilly SACon, London, October 2018
Sr. Director, Shared Technology, Capital One.
Senior Director, SharedTech, Capital One
• API & Microservices Governance
• Capital One’s Developer Tooling
• Co-author of “Microservice Architecture”
“Speed and Safety at Scale and in Harmony”
Need for coordination is why we constantly
compromise between speed and safety.
DevOps & CI/CID
Lean Product Dev
Pattern: Thinking In Small Batches
Source: Accelerate, by Nicole Forsgren, PhD, Jez Humble, and Gene Kim
Any type of asynchronous job execution, where
caller doesn’t have to wait for a response in a
blocking way, increases scalability and resiliency
of the system, granted: typically at the expense
of increased complexity.
• Promises, async/await & coroutines
• Publish/Subscribe Queues
• Reactive Programming
• Akka Actor Model
Higher-level abstraction over messaging using Observables and functional programming.
Senders generate events, receivers are workers able and interested in processing those
Graphics source: https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589781(v=pandp.10)
Pub/Sub provides significantly superior level of flexibility, in
that: multiple kinds of receivers, implemented with
heterogenous tech stack can subscribe to the same events
using a uniform approach and implementation.
1. Message: loan application submitted
2. Received by fraud-check worker
3. Received by credit-check worker
4. Received by AML-check worker
5. Received by OFAC-check worker
Webhooks – HTTP Callbacks with Payload
W3C Standard: WebSub https://www.w3.org/TR/websub/
Graphics source: https://www.w3.org/TR/websub/#high-level-protocol-flow
WebSub allows abstracting Pub/Sub model away from
specific, non-web protocols used by concrete message
broker systems and projecting the interactions onto the
standard HTTP layer, with main benefit being ubiquitous
familiarity with the protocol, built-in caching and internet-
level scalability features.
Akka Actor Model
Actor Model-based abstraction for concurrent and distributed systems, primarily in Scala and Java
Diagram source: https://doc.akka.io/docs/akka/2.5/guide/actors-intro.html
“Everything is an Actor” model to concurrency by
Carl Hewitt (1973).
Actor is an entity that, in response to a
1. Send messages to other actors
2. Create new actors
3. Define message-processing
Akka Actor Model - Clustering
Akka provides gossip-based HA cluster impl. with advanced features like sharding & persistence.
Diagram source: https://doc.akka.io/docs/akka/2.5/common/cluster.html#intro
Data Analytics & Machine Learning Applications
Could be powered by Kafka Streams configured/optimized differently from their pub/sub usage
Diagram source: https://www.confluent.io/blog/build-deploy-scalable-machine-learning-production-apache-kafka/
Business-relevant data streamed into a Data Lake from all data/event sources
Diagram source: https://aws.amazon.com/big-data/datalakes-and-analytics/what-is-a-data-lake/
Give us current state based on events, and are as simple as: function (state, event)
“In Event Sourcing, current state is a left-fold of previous behaviors” – Greg Young
1. EventStore https://eventstore.org/
3. Any DB capable of storing many
rows of data .
3. Anything optimized for the kind of queries you want to run.