SlideShare a Scribd company logo
1 of 39
Download to read offline
Scalability truths and
serverless architectures
why it is harder with stateful, data-driven systems
regunathb
I’ll talk about
● Scalability truths
● Event driven systems/architecture (EDA)
● Complexity of maintaining State in EDA
● Stateful EDA = Workflow
● Serverless architecture - why it is useful, Primitives
● Design for a Serverless Stateful EDA platform
● The Flux project
Part 1 - Scalability truths
Things you hear
● Our platform is on the Cloud and we can scale seamlessly, often implying:
○ No impact on Performance - user perceived latencies
○ No impact on Data - all transactions are committed, data is durable and consistent
● We follow SOA and our services are Distributed across XX numbers of
servers, often implying:
○ Our services are Stateless
○ Workloads are mostly identical and therefore can be serviced by any server
○ Our systems can keep up with the growth in available memory & compute
○ Network bandwidth is not a constraint & data transfer within the DC is a non-issue
○ There is no need for Consensus (or) there are no faulty processes
“There is no such thing as a "stateless" architecture; it's just someone else's problem”
Truths
ACID 1.0
Atomicity
Consistency
Isolation
Durability
ACID 2.0
Associative
Commutative
Idempotent
Distributed
with Scale
● Full Transaction support
● No Data Staleness
● Strict Ordering
● Zero Data Loss
● Limited Transaction support
● Eventually Consistent
● Relaxed Ordering
● High Availability
Jonas Boner (CTO Lightbend)
“A distributed system is one in which the failure of a computer you didn't even know existed
can render your own computer unusable.” Lamport
State Management
State in e-Commerce systems
● Stateless (not logged in) enables caching of content
○ But, items go out of stock
○ Problems around data consistency
● Challenges in being Stateful
○ Availability takes a hit; Share-nothing is not feasible
○ Problem of Consensus when data gets replicated
○ Need for Data durability and guaranteed execution
■ Move from Fail-fast to Succeed-at-any-cost
Part 2 - Event Driven Systems
● Events represent Facts
● Events are Immutable
● Events can be triggers for Actions
● Receive and React to Events/Facts
● Publish new Facts to the rest of the world
● Invert the Control Flow - minimizing coupling
and increasing autonomy
Events Event driven services
Event driven Finite State Machine (FSM)
Current State Input Next State Output
Locked coin Unlocked Unlock turnstile so customer can push through
Locked push Locked None
Unlocked coin Unlocked None
Unlocked push Locked When customer has pushed through, lock turnstile
(Source: Wikipedia)
an abstract machine that can be in exactly one of a finite
number of states at any given time
Stateful EDA = Workflow
Events may be:
● User actions
○ E.g. Item packed
● Messages from Messaging middleware
○ E.g. Offer go-live
● Database state change of entities
○ E.g. Order created
“Set of Tasks that execute Sequentially or
Concurrently; and are triggered by Events”
Flux
● An Asynchronous, Distributed and Reliable state machine based orchestrator
● Used to build Stateful event-driven apps and workflows.
● Simple Primitives and Deployment dependencies
● Available as a Hosted Service at Flipkart & as a stand-alone library
○ Users : Accounting, Seller Platform, Compliance & Document generation, FinTech etc.
● Stateful Serverless(mostly) platform
● Open Source : https://github.com/flipkart-incubator/flux
Flux use case - Doctor tele-consultation
Deployed on AWS
Flux use case - Scheduling Health check-ups
Feature Set
State Management
Async and Distributed processing
Fork & Join
Parallel processing
Correlation Id support
Retriable Errors
Configurable Retries & Timeouts
Versioning of workflows
At least once guarantees
Idempotency at workflow level
External and Scheduled events
Cancellation of ongoing Workflow
Metrics & Audit
Dynamic conditional branching
Observability - Individual FSM
Observability - Task state transitions
Part 3 - Stateful & Serverless
Serverless platform
● Simple primitives (Functions)
○ outputType handler-name(inputType input, Context context) {...........}
○ @FunctionName("hello")

public HttpResponseMessage<String> hello(

@HttpTrigger(name = "req", methods = {"get", "post"}, authLevel = AuthorizationLevel.ANONYMOUS)
HttpRequestMessage<Optional<String>> request,

final ExecutionContext context) {............. }
● No Server management
● Flexible scaling
● Automated High availability
● Observability
Stateful Serverless platform
AWS Step Functions (JSON DSL)
Retries Parallel (Fork)
Stateful Serverless platform
AWS Step Functions (Java API)
Parallel (Fork)
Flux Programming Primitives
WorkFlow
Task
Deployment Unit
Each Deployment Unit is loaded into Flux node using a separate class loader
● Guarantees atleast-once execution of Tasks
○ Using durable states, transitions, events
● Local retries for timed-out executions and on Retriable exception
○ For @Task instances with ‘retries’ and ‘timeout’ attribute values - Retries executed on the same Flux
node
● Global retries for stalled state transitions using Redriver
○ For @Task instances with ‘retries’ and ‘timeout’ attribute values - Retries executed on any of the Flux
cluster nodes
Fault tolerance
Observability - Live cluster state
Observability - Aggregated Metrics per Workflow
JMX metrics from Flux code and client code
Flux Design
Tech choices
Requirement Options
Execution Isolation Separate JVMs, Thread Bulk-heading, Deployment Unit
Execution runtime Akka Cluster, JVMs with coordination(ZK)
State data store MySQL, HBase
Retries Local (Actor Supervisor hierarchy), Global (Cluster-wide scheduler)
Node placement, Coordination Akka Gossip protocol, ZK
Deployment unit, Wiring/DI Guice, Separate Classloader, Java Module System
Metrics & Monitoring JMX, Hystrix, Metrics timeseries
Timeouts, Failure detection Hystrix
Flux Software components
Java
Google Guice
- Dependency Injection
Polyguice
- Lifecycle Management
Jetty
- API & UI servers
Akka
- Queueing & Retries
Hystrix
- Circuit breaker
- Timeouts
- Metrics
MySQL
- Data persistence
Deployment - Managed Environment
Deployment - Isolated Execution Environment
Additional Reading
● Microsoft Service Fabric - Distributed platform for building Stateful micro
services
● The Tail at Scale - by Jeff Dean et.al - Building Latency tail-tolerant systems
Thank You
Questions?
Additional slides
Invoking a workflow from Client
Events
Few Rules
● All params and return values should implement Event
interface
● Stateless Classes
● Immutable event objects in workflow method
● Workflow method must return void
When a seller initiated pack, we need to call and update various systems. Downstream systems involved are
1. Vendor Assignor - this generates a tracking id which has to be shown on the label printed on the shipment.
2. Accounting - to generate invoices and various other accounting entries
3. Doc Service - this creates a PDF consisting of the label and the invoice which has to be printed and attached in the shipment.
4. Logistics Compliance Engine - to generate various government forms required when a shipment has to cross state borders.
Flux orchestration is used in above scenarios.
Use Cases - Seller Fulfilment Service
Testability
● Unit and Integration Testing
○ As workflows are written in Java, Unit and Integration testing would be similar to writing them
for any other Java code
● Debugging through IDE
○ You can attach a debugger to Flux process to debug the workflow while development. Find
more details about it on https://github.com/flipkart-incubator/flux/wiki/Examples.
● Toggling between Async and Sync
○ Removing “FluxClientInterceptorModule” from your Guice Injector lets your code to run in
Sync mode. With this you can toggle between Async and Sync whenever you want.
State Machine Definition

More Related Content

What's hot

Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...
Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...
Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...ScyllaDB
 
VoltDB : A Technical Overview
VoltDB : A Technical OverviewVoltDB : A Technical Overview
VoltDB : A Technical OverviewTim Callaghan
 
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"Fwdays
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsDataStax
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Membase Meetup 2010
Membase Meetup 2010Membase Meetup 2010
Membase Meetup 2010Membase
 
In Search of Database Nirvana: Challenges of Delivering HTAP
In Search of Database Nirvana: Challenges of Delivering HTAPIn Search of Database Nirvana: Challenges of Delivering HTAP
In Search of Database Nirvana: Challenges of Delivering HTAPHBaseCon
 
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevMigration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevAltinity Ltd
 
Stream processing at Hotstar
Stream processing at HotstarStream processing at Hotstar
Stream processing at HotstarKafkaZone
 
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
FOSSASIA 2016 - 7 Tips to design web centric high-performance applicationsFOSSASIA 2016 - 7 Tips to design web centric high-performance applications
FOSSASIA 2016 - 7 Tips to design web centric high-performance applicationsAshnikbiz
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon
 
Vitalii Bondarenko "Machine Learning on Fast Data"
Vitalii Bondarenko "Machine Learning on Fast Data"Vitalii Bondarenko "Machine Learning on Fast Data"
Vitalii Bondarenko "Machine Learning on Fast Data"DataConf
 
Migrating to postgresql
Migrating to postgresqlMigrating to postgresql
Migrating to postgresqlbotsplash.com
 
Data Platform in the Cloud
Data Platform in the CloudData Platform in the Cloud
Data Platform in the CloudAmihay Zer-Kavod
 
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)MongoDB
 

What's hot (20)

In-Memory DataBase
In-Memory DataBaseIn-Memory DataBase
In-Memory DataBase
 
Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...
Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...
Scylla Summit 2018: Adventures in AdTech: Processing 50 Billion User Profiles...
 
VoltDB : A Technical Overview
VoltDB : A Technical OverviewVoltDB : A Technical Overview
VoltDB : A Technical Overview
 
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
 
Hadoop and friends
Hadoop and friendsHadoop and friends
Hadoop and friends
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
Membase Meetup 2010
Membase Meetup 2010Membase Meetup 2010
Membase Meetup 2010
 
In Search of Database Nirvana: Challenges of Delivering HTAP
In Search of Database Nirvana: Challenges of Delivering HTAPIn Search of Database Nirvana: Challenges of Delivering HTAP
In Search of Database Nirvana: Challenges of Delivering HTAP
 
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevMigration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
 
Stream processing at Hotstar
Stream processing at HotstarStream processing at Hotstar
Stream processing at Hotstar
 
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
FOSSASIA 2016 - 7 Tips to design web centric high-performance applicationsFOSSASIA 2016 - 7 Tips to design web centric high-performance applications
FOSSASIA 2016 - 7 Tips to design web centric high-performance applications
 
Gcp data engineer
Gcp data engineerGcp data engineer
Gcp data engineer
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
 
Vitalii Bondarenko "Machine Learning on Fast Data"
Vitalii Bondarenko "Machine Learning on Fast Data"Vitalii Bondarenko "Machine Learning on Fast Data"
Vitalii Bondarenko "Machine Learning on Fast Data"
 
Key-Value NoSQL Database
Key-Value NoSQL DatabaseKey-Value NoSQL Database
Key-Value NoSQL Database
 
Migrating to postgresql
Migrating to postgresqlMigrating to postgresql
Migrating to postgresql
 
Data Platform in the Cloud
Data Platform in the CloudData Platform in the Cloud
Data Platform in the Cloud
 
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)
MongoDB as a Data Warehouse: Time Series and Device History Data (Medtronic)
 
Horizon for Big Data
Horizon for Big DataHorizon for Big Data
Horizon for Big Data
 

Similar to Scalability truths and serverless architectures

Let's get to know the Data Streaming
Let's get to know the Data StreamingLet's get to know the Data Streaming
Let's get to know the Data StreamingKnoldus Inc.
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event SourcingMike Bild
 
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uberconfluent
 
Event-driven serverless functions with Next.js and Inngest
Event-driven serverless functions with Next.js and InngestEvent-driven serverless functions with Next.js and Inngest
Event-driven serverless functions with Next.js and InngestDan Farrelly
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMSkoolkampus
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive MicroservicesRick Hightower
 
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)Codit
 
WF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsWF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsOleh Zheleznyak
 
Serverless Event Streaming with Pulsar Functions
Serverless Event Streaming with Pulsar FunctionsServerless Event Streaming with Pulsar Functions
Serverless Event Streaming with Pulsar FunctionsStreamNative
 
Increasing agility with php and kafka
Increasing agility with php and kafkaIncreasing agility with php and kafka
Increasing agility with php and kafkaMike Bywater
 
Workflows via Event driven architecture
Workflows via Event driven architectureWorkflows via Event driven architecture
Workflows via Event driven architectureMilan Patel
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...confluent
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appNeil Avery
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartShyam Kumar Akirala
 
ScaleFast Grid And Flow
ScaleFast Grid And FlowScaleFast Grid And Flow
ScaleFast Grid And FlowDevelops Ltd
 
Stream and Batch Processing in the Cloud with Data Microservices
Stream and Batch Processing in the Cloud with Data MicroservicesStream and Batch Processing in the Cloud with Data Microservices
Stream and Batch Processing in the Cloud with Data Microservicesmarius_bogoevici
 
Introduction to Apache Apex - CoDS 2016
Introduction to Apache Apex - CoDS 2016Introduction to Apache Apex - CoDS 2016
Introduction to Apache Apex - CoDS 2016Bhupesh Chawda
 
Real-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexReal-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexApache Apex
 
The future of serverless is STATE!
The future of serverless is STATE!The future of serverless is STATE!
The future of serverless is STATE!Ryan Knight
 

Similar to Scalability truths and serverless architectures (20)

Let's get to know the Data Streaming
Let's get to know the Data StreamingLet's get to know the Data Streaming
Let's get to know the Data Streaming
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
 
Event-driven serverless functions with Next.js and Inngest
Event-driven serverless functions with Next.js and InngestEvent-driven serverless functions with Next.js and Inngest
Event-driven serverless functions with Next.js and Inngest
 
24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS24. Advanced Transaction Processing in DBMS
24. Advanced Transaction Processing in DBMS
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive Microservices
 
Apache flink
Apache flinkApache flink
Apache flink
 
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)
Azure Service Fabric: notes from the field (Sam Vanhoute @Integrate 2016)
 
WF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsWF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systems
 
Serverless Event Streaming with Pulsar Functions
Serverless Event Streaming with Pulsar FunctionsServerless Event Streaming with Pulsar Functions
Serverless Event Streaming with Pulsar Functions
 
Increasing agility with php and kafka
Increasing agility with php and kafkaIncreasing agility with php and kafka
Increasing agility with php and kafka
 
Workflows via Event driven architecture
Workflows via Event driven architectureWorkflows via Event driven architecture
Workflows via Event driven architecture
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
 
ScaleFast Grid And Flow
ScaleFast Grid And FlowScaleFast Grid And Flow
ScaleFast Grid And Flow
 
Stream and Batch Processing in the Cloud with Data Microservices
Stream and Batch Processing in the Cloud with Data MicroservicesStream and Batch Processing in the Cloud with Data Microservices
Stream and Batch Processing in the Cloud with Data Microservices
 
Introduction to Apache Apex - CoDS 2016
Introduction to Apache Apex - CoDS 2016Introduction to Apache Apex - CoDS 2016
Introduction to Apache Apex - CoDS 2016
 
Real-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexReal-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache Apex
 
The future of serverless is STATE!
The future of serverless is STATE!The future of serverless is STATE!
The future of serverless is STATE!
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Scalability truths and serverless architectures

  • 1. Scalability truths and serverless architectures why it is harder with stateful, data-driven systems regunathb
  • 2. I’ll talk about ● Scalability truths ● Event driven systems/architecture (EDA) ● Complexity of maintaining State in EDA ● Stateful EDA = Workflow ● Serverless architecture - why it is useful, Primitives ● Design for a Serverless Stateful EDA platform ● The Flux project
  • 3. Part 1 - Scalability truths
  • 4. Things you hear ● Our platform is on the Cloud and we can scale seamlessly, often implying: ○ No impact on Performance - user perceived latencies ○ No impact on Data - all transactions are committed, data is durable and consistent ● We follow SOA and our services are Distributed across XX numbers of servers, often implying: ○ Our services are Stateless ○ Workloads are mostly identical and therefore can be serviced by any server ○ Our systems can keep up with the growth in available memory & compute ○ Network bandwidth is not a constraint & data transfer within the DC is a non-issue ○ There is no need for Consensus (or) there are no faulty processes
  • 5. “There is no such thing as a "stateless" architecture; it's just someone else's problem” Truths ACID 1.0 Atomicity Consistency Isolation Durability ACID 2.0 Associative Commutative Idempotent Distributed with Scale ● Full Transaction support ● No Data Staleness ● Strict Ordering ● Zero Data Loss ● Limited Transaction support ● Eventually Consistent ● Relaxed Ordering ● High Availability Jonas Boner (CTO Lightbend) “A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable.” Lamport State Management
  • 6. State in e-Commerce systems ● Stateless (not logged in) enables caching of content ○ But, items go out of stock ○ Problems around data consistency ● Challenges in being Stateful ○ Availability takes a hit; Share-nothing is not feasible ○ Problem of Consensus when data gets replicated ○ Need for Data durability and guaranteed execution ■ Move from Fail-fast to Succeed-at-any-cost
  • 7. Part 2 - Event Driven Systems
  • 8. ● Events represent Facts ● Events are Immutable ● Events can be triggers for Actions ● Receive and React to Events/Facts ● Publish new Facts to the rest of the world ● Invert the Control Flow - minimizing coupling and increasing autonomy Events Event driven services
  • 9. Event driven Finite State Machine (FSM) Current State Input Next State Output Locked coin Unlocked Unlock turnstile so customer can push through Locked push Locked None Unlocked coin Unlocked None Unlocked push Locked When customer has pushed through, lock turnstile (Source: Wikipedia) an abstract machine that can be in exactly one of a finite number of states at any given time
  • 10. Stateful EDA = Workflow Events may be: ● User actions ○ E.g. Item packed ● Messages from Messaging middleware ○ E.g. Offer go-live ● Database state change of entities ○ E.g. Order created “Set of Tasks that execute Sequentially or Concurrently; and are triggered by Events”
  • 11. Flux ● An Asynchronous, Distributed and Reliable state machine based orchestrator ● Used to build Stateful event-driven apps and workflows. ● Simple Primitives and Deployment dependencies ● Available as a Hosted Service at Flipkart & as a stand-alone library ○ Users : Accounting, Seller Platform, Compliance & Document generation, FinTech etc. ● Stateful Serverless(mostly) platform ● Open Source : https://github.com/flipkart-incubator/flux
  • 12. Flux use case - Doctor tele-consultation Deployed on AWS
  • 13. Flux use case - Scheduling Health check-ups
  • 14. Feature Set State Management Async and Distributed processing Fork & Join Parallel processing Correlation Id support Retriable Errors Configurable Retries & Timeouts Versioning of workflows At least once guarantees Idempotency at workflow level External and Scheduled events Cancellation of ongoing Workflow Metrics & Audit Dynamic conditional branching
  • 16. Observability - Task state transitions
  • 17. Part 3 - Stateful & Serverless
  • 18. Serverless platform ● Simple primitives (Functions) ○ outputType handler-name(inputType input, Context context) {...........} ○ @FunctionName("hello")
 public HttpResponseMessage<String> hello(
 @HttpTrigger(name = "req", methods = {"get", "post"}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
 final ExecutionContext context) {............. } ● No Server management ● Flexible scaling ● Automated High availability ● Observability
  • 19. Stateful Serverless platform AWS Step Functions (JSON DSL) Retries Parallel (Fork)
  • 20. Stateful Serverless platform AWS Step Functions (Java API) Parallel (Fork)
  • 22. Deployment Unit Each Deployment Unit is loaded into Flux node using a separate class loader
  • 23. ● Guarantees atleast-once execution of Tasks ○ Using durable states, transitions, events ● Local retries for timed-out executions and on Retriable exception ○ For @Task instances with ‘retries’ and ‘timeout’ attribute values - Retries executed on the same Flux node ● Global retries for stalled state transitions using Redriver ○ For @Task instances with ‘retries’ and ‘timeout’ attribute values - Retries executed on any of the Flux cluster nodes Fault tolerance
  • 24. Observability - Live cluster state
  • 25. Observability - Aggregated Metrics per Workflow JMX metrics from Flux code and client code
  • 27. Tech choices Requirement Options Execution Isolation Separate JVMs, Thread Bulk-heading, Deployment Unit Execution runtime Akka Cluster, JVMs with coordination(ZK) State data store MySQL, HBase Retries Local (Actor Supervisor hierarchy), Global (Cluster-wide scheduler) Node placement, Coordination Akka Gossip protocol, ZK Deployment unit, Wiring/DI Guice, Separate Classloader, Java Module System Metrics & Monitoring JMX, Hystrix, Metrics timeseries Timeouts, Failure detection Hystrix
  • 28. Flux Software components Java Google Guice - Dependency Injection Polyguice - Lifecycle Management Jetty - API & UI servers Akka - Queueing & Retries Hystrix - Circuit breaker - Timeouts - Metrics MySQL - Data persistence
  • 29. Deployment - Managed Environment
  • 30. Deployment - Isolated Execution Environment
  • 31. Additional Reading ● Microsoft Service Fabric - Distributed platform for building Stateful micro services ● The Tail at Scale - by Jeff Dean et.al - Building Latency tail-tolerant systems
  • 34. Invoking a workflow from Client
  • 36. Few Rules ● All params and return values should implement Event interface ● Stateless Classes ● Immutable event objects in workflow method ● Workflow method must return void
  • 37. When a seller initiated pack, we need to call and update various systems. Downstream systems involved are 1. Vendor Assignor - this generates a tracking id which has to be shown on the label printed on the shipment. 2. Accounting - to generate invoices and various other accounting entries 3. Doc Service - this creates a PDF consisting of the label and the invoice which has to be printed and attached in the shipment. 4. Logistics Compliance Engine - to generate various government forms required when a shipment has to cross state borders. Flux orchestration is used in above scenarios. Use Cases - Seller Fulfilment Service
  • 38. Testability ● Unit and Integration Testing ○ As workflows are written in Java, Unit and Integration testing would be similar to writing them for any other Java code ● Debugging through IDE ○ You can attach a debugger to Flux process to debug the workflow while development. Find more details about it on https://github.com/flipkart-incubator/flux/wiki/Examples. ● Toggling between Async and Sync ○ Removing “FluxClientInterceptorModule” from your Guice Injector lets your code to run in Sync mode. With this you can toggle between Async and Sync whenever you want.