SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 30 day free trial to unlock unlimited reading.
Irakli Nadareishvili - O'Reilly SACon 2018, London
Irakli Nadareishvili - O'Reilly SACon 2018, London
1.
Asynchronicity in Microservices
Three Main Forms of Asynchronicity – Understanding the Patterns
O’Reilly SACon, London, October 2018
Irakli Nadareishvili
Sr. Director, Shared Technology, Capital One.
2.
Irakli Nadareishvili
Senior Director, SharedTech, Capital One
• API & Microservices Governance
• Capital One’s Developer Tooling
• Co-author of “Microservice Architecture”
inadarei
3.
11
“Speed and Safety at Scale and in Harmony”
Need for coordination is why we constantly
compromise between speed and safety.
Microservices Way:
inadarei
4.
Microservicesclosethealignmentloop!
AgileProcess:
Operations:
Product:
DevOps & CI/CID
Lean Product Dev
Pattern: Thinking In Small Batches
Architecture: Microservices
inadarei
5.
Data:Batch-sizeIsaStrongPredictorofPerformance
Source: Accelerate, by Nicole Forsgren, PhD, Jez Humble, and Gene Kim
10.
1010Confidential
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.
Common solutions:
• Promises, async/await & coroutines
• Publish/Subscribe Queues
• Webhooks
• Reactive Programming
• Akka Actor Model
14.
Reactive Programming
14
Higher-level abstraction over messaging using Observables and functional programming.
15.
Publish/Subscribe Queues
15
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.
Example:
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
6. …
16.
Webhooks – HTTP Callbacks with Payload
16
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.
17.
Akka Actor Model
17
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
message, can:
1. Send messages to other actors
2. Create new actors
3. Define message-processing
behavior.
18.
Akka Actor Model - Clustering
18
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
20.
Data Analytics & Machine Learning Applications
20
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/
21.
Data Lake
21
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/
28.
Projections
28
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
29.
Tooling
29
Event Store:
1. EventStore https://eventstore.org/
2. Cassandra
3. Any DB capable of storing many
rows of data .
Read Model:
1. ElasticSearch
2. PostgreSQL
3. Anything optimized for the kind of queries you want to run.