SlideShare a Scribd company logo
1 of 22
Thoughts on
Transactions
Chained transactions for scaling ACID
@billynewport
@billynewport
1
Agenda
 Explain scenario
 Implement using a single database
 Explain concurrency issues under load
 Implement using a sharded database
 Implement using WebSphere eXtreme Scale and
chained transactions
@billynewport
2
Scenario
 Large eCommerce web site
 Problem is order checkout
 We track inventory levels for each SKU
 Orders during checkout need to adjust available
inventory.
@billynewport
3
Shopping cart metrics
 Millions of SKUs
 Cart size of 5 items for electronics/big ticket items
 Cart size of 20 items for clothing
 Expect concurrent load of 2500 checkouts per second
@billynewport
4
Database
 Begin
 For each item in cart
 Select for update where sku = item.sku
 Decrement available sku level
 If not available then rollback…
 Update level where sku = item.sku
 Commit
Cart items randomly distributed amongst all 2m items, lots
of concurrency.
Simple enough, right? All is good?
@billynewport
5
Problem: cabbage patch dolls
 Cabbage patch dolls are popular this fall…
@billynewport
6
Database killers!
 The dolls cause major
concurrency problems
 Lots of row level locks
 Contention on doll rows
 Possible table lock escalation
 App server thread issues
 Connection pools empty
 Then DEATH!
 They aren’t sweet and cuddly any
more…
@billynewport
7
Database killers
 We need a way to get locks to decrement inventory
 But, we don’t want to hold the lock for very long
 Bigger carts make the problem worse, all the locks held
for longer
 Ideally, hold locks for constant time
 Any contentious items make problem worse
@billynewport
8
Solution
 Hold lock on inventory rows for as short a time as
possible
 Decouple this from size of cart.
 How?
@billynewport
9
Chained transactions
 Programmers think of transactions in synchronous
terms.
 Begin / Do Work / Hold locks / Commit
 Easy to program, bad for concurrency.
@billynewport
10
Inspiration
 Microsoft had COM objects with apartment model
threading.
 Modern Actor support is similar. Some state with a
mailbox.
 BPEL supports flows with compensation
 Data meets actors is a good analogy
 Send a message (cart) to a group of actors identified
using their keys with a compensator
@billynewport
11
Alternative
 We need to think asynchronously in terms of flows with
compensation
 Map of <SKU Key/SKU Amount>
 Brick:
 Do
{ code to reduce inventory level for SKU }
 Undo
{ code to increase level inventory for SKU }
 Provide Map with do/undo bricks
 Easy to program, great concurrency.
@billynewport
12
Transactions and sharded
stores
 Option 1: Write transaction to one shard then
spread out asynchronously
 Option 2: 2 phase commit
 Option 3: Chained transactions
@billynewport
13
Transactions and sharded
stores
 Option 1: Write transaction to one shard then spread
out asynchronously
 Option 2: 2 phase commit
 Option 3: Chained transactions
@billynewport
14
Transactions and sharded
stores
 Option 1: Write transaction to one shard then spread
out asynchronously
 Option 2: 2 phase commit
 Option 3: Chained transactions
@billynewport
15
Implementation
 1PC only required
 Data store supporting
 Row locks
 Row oriented data
 Integrated FIFO messaging
 IBM WebSphere eXtreme Scale provides these
capabilities.
@billynewport
16
Implementation
 Application makes map and code bricks
 Submits transaction as an asynchronous job.
 Uses a Future to check on job outcome.
 Do blocks can trigger flow reversal if a problem occurs.
 Invoke undo block for each completed step
@billynewport
17
Mechanism
 Loop
 Receive message for actor key
 Process it
 Send modified cart to next ‘sku’ using local ‘transmit q’
 Commit transaction
 Background thread pushes messages in transmit q to
the destination shards using exactly once semantics.
@billynewport
18
Performance
 A single logical transaction will be slower than a 1PC
DBMS implementation.
 However, under concurrent load then it will deliver:
 Higher throughput
 Better response times
 Thru better contention management
 Each ‘SKU’ only locked for a very short period
@billynewport
19
Generalization
 This could be thought of as a workflow engine.
 But, a big difference here is that a workflow engine usually
talks with a remote store.
 Here:
 the flow state is the MESSAGE
 It moves around to where the data is for the next step
 Using a MESSAGE for flow state rather than a database
means it scales linearly.
 The message ‘store’ is integrated and scales with the data
store.
@billynewport
20
Architecture Comparison
Conventional Message oriented
@billynewport
21
Flow
DB
Appl
DB
Msg
Store
BP
Engi
ne
BP
Engi
ne
BP
Engine
Flow
State
Flow
Edge
= Msg
Integrated
Msg/Data store
Appl
DB
Write
behind
Integrated
Msg/Data store
Integrated
Msg/Data store
Sample implementation
 Coming soon.
 Running in lab
 Working with several eCommerce customers looking to
implement soon.
 Soon to be published on github as sample code.
@billynewport
22

More Related Content

Similar to Using chained transactions for maximum concurrency under load (QCONSF 2010)

MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...
MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...
MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...MongoDB
 
Exactly Once Delivery with Kafka - Kafka Tel-Aviv Meetup
Exactly Once Delivery with Kafka - Kafka Tel-Aviv MeetupExactly Once Delivery with Kafka - Kafka Tel-Aviv Meetup
Exactly Once Delivery with Kafka - Kafka Tel-Aviv MeetupNatan Silnitsky
 
Microservices Coordination using Saga
Microservices Coordination using SagaMicroservices Coordination using Saga
Microservices Coordination using SagaEran Levy
 
Building Event-Driven Services with Apache Kafka
Building Event-Driven Services with Apache KafkaBuilding Event-Driven Services with Apache Kafka
Building Event-Driven Services with Apache Kafkaconfluent
 
ngSummit 2017: Angular meets Redux
ngSummit 2017: Angular meets ReduxngSummit 2017: Angular meets Redux
ngSummit 2017: Angular meets ReduxMichał Michalczuk
 
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2:  Building Event-Driven Services with Apache KafkaEvent Driven Services Part 2:  Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2: Building Event-Driven Services with Apache KafkaBen Stopford
 
Supercharge Your Applications
Supercharge Your ApplicationsSupercharge Your Applications
Supercharge Your ApplicationsSean Boiling
 
Effective Akka v2
Effective Akka v2Effective Akka v2
Effective Akka v2shinolajla
 
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...MongoDB
 
SOA, Microservices and Event Driven Architecture
SOA, Microservices and Event Driven ArchitectureSOA, Microservices and Event Driven Architecture
SOA, Microservices and Event Driven ArchitectureJeppe Cramon
 
Advanced web application architecture Way2Web
Advanced web application architecture Way2WebAdvanced web application architecture Way2Web
Advanced web application architecture Way2WebMatthias Noback
 
Building Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBuilding Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBen Stopford
 
Real-Time Stats for Candy Box
Real-Time Stats for Candy Box  Real-Time Stats for Candy Box
Real-Time Stats for Candy Box PubNub
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystemconfluent
 
10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven MicroservicesBen Stopford
 
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with ScyllaiFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with ScyllaScyllaDB
 
No More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureNo More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureConSanFrancisco123
 
Cost architecting for Windows Azure - NDC2011
Cost architecting for Windows Azure - NDC2011Cost architecting for Windows Azure - NDC2011
Cost architecting for Windows Azure - NDC2011Maarten Balliauw
 

Similar to Using chained transactions for maximum concurrency under load (QCONSF 2010) (20)

MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...
MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...
MongoDB World 2019: Distributed Transactions: With Great Power Comes Great Re...
 
Exactly Once Delivery with Kafka - Kafka Tel-Aviv Meetup
Exactly Once Delivery with Kafka - Kafka Tel-Aviv MeetupExactly Once Delivery with Kafka - Kafka Tel-Aviv Meetup
Exactly Once Delivery with Kafka - Kafka Tel-Aviv Meetup
 
Microservices Coordination using Saga
Microservices Coordination using SagaMicroservices Coordination using Saga
Microservices Coordination using Saga
 
Building Event-Driven Services with Apache Kafka
Building Event-Driven Services with Apache KafkaBuilding Event-Driven Services with Apache Kafka
Building Event-Driven Services with Apache Kafka
 
ngSummit 2017: Angular meets Redux
ngSummit 2017: Angular meets ReduxngSummit 2017: Angular meets Redux
ngSummit 2017: Angular meets Redux
 
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2:  Building Event-Driven Services with Apache KafkaEvent Driven Services Part 2:  Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
 
Supercharge Your Applications
Supercharge Your ApplicationsSupercharge Your Applications
Supercharge Your Applications
 
Effective Akka v2
Effective Akka v2Effective Akka v2
Effective Akka v2
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
 
SOA, Microservices and Event Driven Architecture
SOA, Microservices and Event Driven ArchitectureSOA, Microservices and Event Driven Architecture
SOA, Microservices and Event Driven Architecture
 
Advanced web application architecture Way2Web
Advanced web application architecture Way2WebAdvanced web application architecture Way2Web
Advanced web application architecture Way2Web
 
Building Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBuilding Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka Streams
 
Real-Time Stats for Candy Box
Real-Time Stats for Candy Box  Real-Time Stats for Candy Box
Real-Time Stats for Candy Box
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystem
 
Bloom plseminar-sp15
Bloom plseminar-sp15Bloom plseminar-sp15
Bloom plseminar-sp15
 
10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices
 
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with ScyllaiFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
 
No More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureNo More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application Infrastructure
 
Cost architecting for Windows Azure - NDC2011
Cost architecting for Windows Azure - NDC2011Cost architecting for Windows Azure - NDC2011
Cost architecting for Windows Azure - NDC2011
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Using chained transactions for maximum concurrency under load (QCONSF 2010)

  • 1. Thoughts on Transactions Chained transactions for scaling ACID @billynewport @billynewport 1
  • 2. Agenda  Explain scenario  Implement using a single database  Explain concurrency issues under load  Implement using a sharded database  Implement using WebSphere eXtreme Scale and chained transactions @billynewport 2
  • 3. Scenario  Large eCommerce web site  Problem is order checkout  We track inventory levels for each SKU  Orders during checkout need to adjust available inventory. @billynewport 3
  • 4. Shopping cart metrics  Millions of SKUs  Cart size of 5 items for electronics/big ticket items  Cart size of 20 items for clothing  Expect concurrent load of 2500 checkouts per second @billynewport 4
  • 5. Database  Begin  For each item in cart  Select for update where sku = item.sku  Decrement available sku level  If not available then rollback…  Update level where sku = item.sku  Commit Cart items randomly distributed amongst all 2m items, lots of concurrency. Simple enough, right? All is good? @billynewport 5
  • 6. Problem: cabbage patch dolls  Cabbage patch dolls are popular this fall… @billynewport 6
  • 7. Database killers!  The dolls cause major concurrency problems  Lots of row level locks  Contention on doll rows  Possible table lock escalation  App server thread issues  Connection pools empty  Then DEATH!  They aren’t sweet and cuddly any more… @billynewport 7
  • 8. Database killers  We need a way to get locks to decrement inventory  But, we don’t want to hold the lock for very long  Bigger carts make the problem worse, all the locks held for longer  Ideally, hold locks for constant time  Any contentious items make problem worse @billynewport 8
  • 9. Solution  Hold lock on inventory rows for as short a time as possible  Decouple this from size of cart.  How? @billynewport 9
  • 10. Chained transactions  Programmers think of transactions in synchronous terms.  Begin / Do Work / Hold locks / Commit  Easy to program, bad for concurrency. @billynewport 10
  • 11. Inspiration  Microsoft had COM objects with apartment model threading.  Modern Actor support is similar. Some state with a mailbox.  BPEL supports flows with compensation  Data meets actors is a good analogy  Send a message (cart) to a group of actors identified using their keys with a compensator @billynewport 11
  • 12. Alternative  We need to think asynchronously in terms of flows with compensation  Map of <SKU Key/SKU Amount>  Brick:  Do { code to reduce inventory level for SKU }  Undo { code to increase level inventory for SKU }  Provide Map with do/undo bricks  Easy to program, great concurrency. @billynewport 12
  • 13. Transactions and sharded stores  Option 1: Write transaction to one shard then spread out asynchronously  Option 2: 2 phase commit  Option 3: Chained transactions @billynewport 13
  • 14. Transactions and sharded stores  Option 1: Write transaction to one shard then spread out asynchronously  Option 2: 2 phase commit  Option 3: Chained transactions @billynewport 14
  • 15. Transactions and sharded stores  Option 1: Write transaction to one shard then spread out asynchronously  Option 2: 2 phase commit  Option 3: Chained transactions @billynewport 15
  • 16. Implementation  1PC only required  Data store supporting  Row locks  Row oriented data  Integrated FIFO messaging  IBM WebSphere eXtreme Scale provides these capabilities. @billynewport 16
  • 17. Implementation  Application makes map and code bricks  Submits transaction as an asynchronous job.  Uses a Future to check on job outcome.  Do blocks can trigger flow reversal if a problem occurs.  Invoke undo block for each completed step @billynewport 17
  • 18. Mechanism  Loop  Receive message for actor key  Process it  Send modified cart to next ‘sku’ using local ‘transmit q’  Commit transaction  Background thread pushes messages in transmit q to the destination shards using exactly once semantics. @billynewport 18
  • 19. Performance  A single logical transaction will be slower than a 1PC DBMS implementation.  However, under concurrent load then it will deliver:  Higher throughput  Better response times  Thru better contention management  Each ‘SKU’ only locked for a very short period @billynewport 19
  • 20. Generalization  This could be thought of as a workflow engine.  But, a big difference here is that a workflow engine usually talks with a remote store.  Here:  the flow state is the MESSAGE  It moves around to where the data is for the next step  Using a MESSAGE for flow state rather than a database means it scales linearly.  The message ‘store’ is integrated and scales with the data store. @billynewport 20
  • 21. Architecture Comparison Conventional Message oriented @billynewport 21 Flow DB Appl DB Msg Store BP Engi ne BP Engi ne BP Engine Flow State Flow Edge = Msg Integrated Msg/Data store Appl DB Write behind Integrated Msg/Data store Integrated Msg/Data store
  • 22. Sample implementation  Coming soon.  Running in lab  Working with several eCommerce customers looking to implement soon.  Soon to be published on github as sample code. @billynewport 22