SlideShare une entreprise Scribd logo
1  sur  41
“Hitchhiker” systems
Distributed computing for pennies
Duncan Jones
💬 @Merrion
Agenda
• Sources of cost
• Introduction to “event sourcing”
• Example code
• Introduction to Azure storage and Azure Event Grid
• Overview of a proposed system architecture
• Lessons learned
• Q & A
Caveats
Sources of cost
Fixed costs Overprovisioning
Introduction to “event sourcing”
Opened
Account
Deposited
Money
Withdrew Money Closed Account
$10.00 $10.00Margaret
00002
Event Type Action
Opened
Account
Skip
Deposited
Money
Increase balance by $
Withdrew
Money
Decrease balance by $
Event sourcing on Azure functions
code example
Open a new account
Each account number must be unique
Initial deposit amount (optional)
Beneficiary name (optional)
Open a new account
https://retailbankazurefunctionapp.azurewebsites.net/api/OpenAccount/A001B123
456C
DOMAIN ENTITY TYPE INSTANCE
Open a new account
Open a new account
Open a new account
Open a new account
Open a new account
Make a deposit
Target account for the deposit must exist
Deposit amount
Source of the deposit (optional)
Make a deposit
Make a deposit
Get the balance
The account number to get the balance from must exist
As of date (optional)
Get the balance
TYPE OF PROJECTION TO RUN
Balance projection
Get the balance
SEQUENCE NUMBER OF LAST EVENT PROCESSED
Get the balance
Make a withdrawal
Target account number for the withdrawal must exist
Balance must be greater than or equal to the withdrawal amount
Withdrawal amount
Concurrency crocodile!
Make a withdrawal
Make a withdrawal
Make a withdrawal
Introduction to Azure Storage
Cosmos Db
Append Blob
Tables
Files
Introduction to Event Grid
Always on
At-least once delivery
Overview of an example system
League Race
Runner
Query
Query
Query
Command
Command
Command
Handling a command
Durable Function Orchestration
Command
Validations
Append
Event(s)
Command orchestrator
Trigger
Orchestration
Validate
Parameters
Append
Event
Send
Notifications
Command orchestrator
Trigger
Orchestration
Validate
Parameters
Append
Event
Send
Notifications
Command orchestrator
Trigger
Orchestration
Validate
Parameters
Append
Event
Send
Notifications
Command orchestrator
Trigger
Orchestration
Validate
Parameters
Append
Event
Send
Notifications
Handling a query
Durable Function Orchestration
Run
Projection(s)
Return
Results
Query
Validations
Query orchestrator
Trigger
Orchestration
Validate
Parameters
Request
Projections
Run
Projections
Send Results
Query orchestrator
Trigger
Orchestration
Validate
Parameters
Request
Projections
Run
Projections
Send Results
Notifications and inter-domain
communication
Lessons learned
Don’t assume. Measure!
Invest time in design
Read your writes
Costs
<
Azure functions
Blob storage
Event Grid
<£1 / day
Questions?
@Merrion
Code and architecture recap
Event Grid function triggers
Query orchestration Command orchestration
Event streams and projections
Fan-out
https://github.com/MerrionComputing/AzureFunctions-TheLongRun-Leagues
https://github.com/MerrionComputing/EventsSourcing-on-Azure-Functions

Contenu connexe

Similaire à Distributed computing for pennies on Azure

LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena
LevelsConf 2018 Event Sourcing - Dasith WijesiriwardenaLevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena
LevelsConf 2018 Event Sourcing - Dasith WijesiriwardenaDasith Wijesiriwardena
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)guiwoda
 
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...Brian Andrzejewski
 
Oracle grants accounting 11
Oracle grants accounting 11Oracle grants accounting 11
Oracle grants accounting 11Naveen Reddy
 
Oracle grants accounting 11
Oracle grants accounting 11Oracle grants accounting 11
Oracle grants accounting 11Naveen Reddy
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Chris Richardson
 
(ISM402) Cost Optimization at Scale
(ISM402) Cost Optimization at Scale(ISM402) Cost Optimization at Scale
(ISM402) Cost Optimization at ScaleAmazon Web Services
 
Building and deploying microservices with event sourcing, CQRS and Docker (QC...
Building and deploying microservices with event sourcing, CQRS and Docker (QC...Building and deploying microservices with event sourcing, CQRS and Docker (QC...
Building and deploying microservices with event sourcing, CQRS and Docker (QC...Chris Richardson
 
Updated syllabus of financial accounting
Updated syllabus of financial accountingUpdated syllabus of financial accounting
Updated syllabus of financial accountingKishan Bora
 
PayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessPayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessAduci
 
Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Chris Richardson
 
Learn Adobe analytics basics - Conversion variables
Learn Adobe analytics basics - Conversion variablesLearn Adobe analytics basics - Conversion variables
Learn Adobe analytics basics - Conversion variablesArunkumar Sundaram
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right wayThibaud Desodt
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabadCss Founder
 
Introduction to Event Sourcing,CQRS and Axon
Introduction to Event Sourcing,CQRS and AxonIntroduction to Event Sourcing,CQRS and Axon
Introduction to Event Sourcing,CQRS and AxonPetar Zrinščak
 
Wrangling Multiple AWS Accounts with AWS Organizations
Wrangling Multiple AWS Accounts with AWS OrganizationsWrangling Multiple AWS Accounts with AWS Organizations
Wrangling Multiple AWS Accounts with AWS OrganizationsAmazon Web Services
 
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018Amazon Web Services
 

Similaire à Distributed computing for pennies on Azure (20)

Oops
OopsOops
Oops
 
LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena
LevelsConf 2018 Event Sourcing - Dasith WijesiriwardenaLevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena
LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)
 
Introduction to-ddd
Introduction to-dddIntroduction to-ddd
Introduction to-ddd
 
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...
AWS ReInvent 2020: SEC313 - A security operator’s guide to practical AWS Clou...
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Oracle grants accounting 11
Oracle grants accounting 11Oracle grants accounting 11
Oracle grants accounting 11
 
Oracle grants accounting 11
Oracle grants accounting 11Oracle grants accounting 11
Oracle grants accounting 11
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)
 
(ISM402) Cost Optimization at Scale
(ISM402) Cost Optimization at Scale(ISM402) Cost Optimization at Scale
(ISM402) Cost Optimization at Scale
 
Building and deploying microservices with event sourcing, CQRS and Docker (QC...
Building and deploying microservices with event sourcing, CQRS and Docker (QC...Building and deploying microservices with event sourcing, CQRS and Docker (QC...
Building and deploying microservices with event sourcing, CQRS and Docker (QC...
 
Updated syllabus of financial accounting
Updated syllabus of financial accountingUpdated syllabus of financial accounting
Updated syllabus of financial accounting
 
PayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving BusinessPayPal Dev Con 2009 Driving Business
PayPal Dev Con 2009 Driving Business
 
Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)
 
Learn Adobe analytics basics - Conversion variables
Learn Adobe analytics basics - Conversion variablesLearn Adobe analytics basics - Conversion variables
Learn Adobe analytics basics - Conversion variables
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabad
 
Introduction to Event Sourcing,CQRS and Axon
Introduction to Event Sourcing,CQRS and AxonIntroduction to Event Sourcing,CQRS and Axon
Introduction to Event Sourcing,CQRS and Axon
 
Wrangling Multiple AWS Accounts with AWS Organizations
Wrangling Multiple AWS Accounts with AWS OrganizationsWrangling Multiple AWS Accounts with AWS Organizations
Wrangling Multiple AWS Accounts with AWS Organizations
 
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018
Reactive Microservices with AWS Lambda (SRV201-R1) - AWS re:Invent 2018
 

Plus de Duncan Jones

Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDDDuncan Jones
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven DesignDuncan Jones
 
Serverless cqrs using azure event grid
Serverless cqrs using azure event gridServerless cqrs using azure event grid
Serverless cqrs using azure event gridDuncan Jones
 
Event sourcing continued
Event sourcing continuedEvent sourcing continued
Event sourcing continuedDuncan Jones
 
Event sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowEvent sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowDuncan Jones
 
Event sourcing from wtf to why to wow
Event sourcing   from wtf to why to wowEvent sourcing   from wtf to why to wow
Event sourcing from wtf to why to wowDuncan Jones
 
Crud or event sourcing
Crud or event sourcingCrud or event sourcing
Crud or event sourcingDuncan Jones
 
cqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azurecqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows AzureDuncan Jones
 
event sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowevent sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowDuncan Jones
 
Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Duncan Jones
 
Cqrs and the cloud
Cqrs and the cloudCqrs and the cloud
Cqrs and the cloudDuncan Jones
 

Plus de Duncan Jones (16)

State o' yer WAN
State o' yer WANState o' yer WAN
State o' yer WAN
 
Boxcar computing
Boxcar computingBoxcar computing
Boxcar computing
 
Boxcar computing
Boxcar computingBoxcar computing
Boxcar computing
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Serverless cqrs using azure event grid
Serverless cqrs using azure event gridServerless cqrs using azure event grid
Serverless cqrs using azure event grid
 
Event sourcing continued
Event sourcing continuedEvent sourcing continued
Event sourcing continued
 
Event sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wowEvent sourcing - from wtf to why to wow
Event sourcing - from wtf to why to wow
 
3 myths of it
3 myths of it3 myths of it
3 myths of it
 
Event sourcing from wtf to why to wow
Event sourcing   from wtf to why to wowEvent sourcing   from wtf to why to wow
Event sourcing from wtf to why to wow
 
Crud or event sourcing
Crud or event sourcingCrud or event sourcing
Crud or event sourcing
 
cqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azurecqrs and event sourcing on Windows Azure
cqrs and event sourcing on Windows Azure
 
event sourcing - from wtf to why to wow
event sourcing - from wtf to why to wowevent sourcing - from wtf to why to wow
event sourcing - from wtf to why to wow
 
CQRS on Azure
CQRS on AzureCQRS on Azure
CQRS on Azure
 
Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1Printing-a-NET-developers-guide-Part1
Printing-a-NET-developers-guide-Part1
 
Cqrs and the cloud
Cqrs and the cloudCqrs and the cloud
Cqrs and the cloud
 

Dernier

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Dernier (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Distributed computing for pennies on Azure

Notes de l'éditeur

  1. Good morning and thank you very much. My name is Duncan Jones and my twitter handle (probably the easiest way to contract me) is @Merrion My thesis is something I am calling “Hitchhiker” systems which is to say systems optimised towards lowering cost
  2. First I need to discuss where cost comes from, in the context of cloud computing. Then briefly explain event sourcing because the solution I have put together makes extensive use of this (and I will explain why at the same time) Then the environment in which this is to be hosted – using the Azure Event Grid, Durable Serverless functions and Azure storage. Then I will walk through the way the architecture hangs together Finally I’ll wrap up with lessons learned and Q&A
  3. The system I am describing here is best suited to non critical or occasional/burst use scenarios rather than enterprise critical systems and is tuned toward minimising cost rather than maximised performance. It is also an experiment rather than a definitive textbook example. To manage expectations, what I am looking for is an equivalent to what Blogs did for micropublishing in applications.
  4. There are two main sources of cost that we need to address with regard to cloud hosted systems: The first is always-on systems, for example virtual machines, for which a cost arises regardless of use. The second is overprovisioning, where we have to reserve more processing power than we are using so that we are able to ramp-up to match rapidly increasing demand. Azure serverless functions address these two sources of cost “out of the box”
  5. Event sourcing is a way of storing data, not as the current state of the entity (as in active state) but rather as a sequential history of all the events that have occurred to an entity. This history is implemented as an append only event stream. It places the onus on getting “state” onto the system that is reading the data which has to run a projection over the event stream. This is done by (and is the responsibility of) the process that needs that state, either to report it or to use it in a business decision. This allows us to eliminate one of the “always on” fixed costs – the state consistency management system (or database to use the more common term).
  6. Design / constraints An account can only be created once - therefore if an event stream already exists for the account, do not create a new one or append an account opened event.
  7. When the serverless function is triggered the account number is taken from the URL and is used to instantiate a new eventstream variable for that bank account.
  8. 1) To enforce the constraint that an account must be new we can first check the event stream does not exist, but also we can pass in a constraint that when writing the first event the event stream must be new.
  9. In addition, the same function is able to append more than one event onto the event stream if that makes business sense Here I am adding a deposit event if the account is opened with an initial deposit and a beneficiary set event if the beneficiary name is provided to the open new account function
  10. The event stream created is stored in the Azure blob storage under a path made of Domain name -> Entity Type
  11. Each blob also has metadata set for the properties of the event stream
  12. The data for each event are in JSON and wrapped in the event context (Projections only access the data inside the event instance but the outer wrapper is useful for debugging etc)
  13. Design / constraints Depositing money is the simplest of all operations - we simply need to be sure that the account exists.
  14. Making a deposit is the simplest function – we simply populate a money deposited event and append it to the event stream for the given bank account. We check the bank account exists first in case the user has incorrectly entered their account number
  15. The deposit event is appended to the stream. Importantly the state (current balance etc.) of the bank account is not stored in the event
  16. Design / constraints To get the balance of the account we need to run a projection over the bank account event stream which handles the money deposited event and the money withdrawn event to give the balance as at a given point.
  17. To run a projection we need to specify the domain, entity type and instance identity of the event stream we are going to run the projection over, and also we need to specify the class of the projection to run.
  18. The projection is a very simple piece of code that says what events it will handle (by implementing the IHandleEventType interface) and then has a method to be called each time an instance of that event type is encountered in the event stream. In this case a money deposited event increases the account balance and a money withdrawn event decreases it.
  19. The projection is run and when it has processed all the events in the event stream the value is returned. 1) Every projection also has a Current Sequence Number property that tells you the number of the last event in the stream that it read
  20. Resulting event stream
  21. Design / constraints Withdrawing money requires running the balance projection to make sure that the account has the funds available to withdraw and only if it does, post the withdrawal event. When posting the withdrawal event we pass in the sequence number returned by the projection and if any other events have been written to the event stream since then an error is thrown and our withdrawal event is not appended.
  22. Azure function
  23. 1) By passing in the sequence number we got from the projection we can tell the AppendEvent method to throw an exception if the actual top sequence of the event stream is higher than that when it comes to write the event – this prevents a concurrency error if another thread appends a withdrawal while you are so doing.
  24. The result of this is that we are prevented from withdrawing more money than we have in the account.
  25. For a more larger and/or complicated system I would recommend using CosmsosDb. For smaller scale systems there are three other options. For the more read –biased application I would recommend either Azure Table storage or Azure Files – and for a write-biased system I would recommend the Azure AppendBlob storage. This matches very well the “event sourcing” architecture discussed earlier.
  26. Event grid is “always listening” – if it receives a notification it can trigger an invocation (“wake up”) of the azure function(s) subscribing to it. Event grid will retry sending to a subscription if the send does not succeed – if they fail for 24 hours then the message will be put in a “deal letter” location. Events will be delivered at least once – but possibly more than once, so you should code defensively for that possibility
  27. The demonstration system is for organising an amateur running organisation. It is split into three domains – the league domain being anything to do with the overall organisation of leagues, The race domain being to do with an individual race, The runner domain being relating to the runner and their interaction with the organisation. Importantly there is no privileged communication between the domains – the interface available to each other is the same interface publicly available outside.
  28. A command is issued to the system through an event grid topic. The parameters required to perform the command as well as any authorisation tokens and externally supplied unique identifier are supplied in the payload to this event grid topic. When a message is received by the topic it triggers a serverless function to handle the command. This uses the durable function framework to call activities that perform each step in turn and, if all is OK, appends 1 or more events to the event streams of the entities updated by the command. As well as the built in durable function orchestration which is backed by a table the command has its own event stream in which the progress is logged.
  29. The orchestration function has an [OrchestrationTrigger] attribute and durable orchestration through which the details of what kicked off the orchestration can be found
  30. The orchestration calls out to Activity methods which do the actual work of each step
  31. Events are appended to the appropriate EventStream in order to record what the command has done – effectively what has changed
  32. An independent sub orchestration is fired off that does all the work to do with notifying other domains of this command’s action
  33. A query is handled in a similar manner but in addition to the parameters you also pass in a return address to which the results of the query should be returned. This could be, for instance, a webhook or an azure storage location to drop a file into. This allows the query to be executed asynchronously. The query runs projections over the event streams of the entities it is getting data for and then performs any aggregation needed over these before returning the results.
  34. Projection requests are written to the query event stream so we can see what work has been done and what is outstanding in running the query Projections themselves can then be run in parallel by using durable functions “fan-out” mechanism. Once all the projections are complete any totting up steps could run.
  35. Projection requests are written to the query event stream so we can see what work has been done and what is outstanding in running the query Projections themselves can then be run in parallel by using durable functions “fan-out” mechanism. Once all the projections are complete any totting up steps could run.
  36. Domains communicate directly with each other by these commands and queries Domains can also raise notifications that other domains or indeed other processes can subscribe to. (These notifications are tagged with the “as of date” and “as of sequence number” information so that the subscriber can determine if it has already received this notification before.)
  37. Because serverless computing is no less susceptible to the “sunk cost fallacy” it is worth investing time in design before getting started coding. It is a mistake to allow the rapid spin-up time of serverless functions as an excuse not to do some design work. I would recommend looking at things like event storming as a way to do this. If you are dealing with a system that needs to be able to survive being spun down without the worry of data loss requires being rigorous about reading your won writes – i.e. making sure any state change is persisted before it is used.
  38. Event Grid for the reliable messaging between domains (and with the outside world) – this allows us to stitch together domains with publish-subscribe, which means we can easily extend the system. Serverless function hosting for dynamic scaling. Durable Function Orchestration for the long running processes that handle the commands and queries. Durable functions fan out/fan in for processes that can run in parallel. Azure AppendBlob storage to store the data at rest in event streams.