SlideShare una empresa de Scribd logo
1 de 22
07 July 2018 | Dasith Wijes
Event Sourcing
Event sourcing workflow
> Audit trails, Sumerian clay tablets and Blockchain
> Advantages over storing state
> Simple form of CQRS, contrasting it to a monolith
> Command side and read side
> How event sourcing fits in
Command Query Responsibility Segregation
> Shopping catalogue example
What is Domain Driven Design?
“In order to create good software, you have to
know what that software is all about. You cannot
create a banking software system unless you have
a good understanding of what banking is all about,
one must understand the domain of banking”
– Eric Evans
What is Event Sourcing?
Use an append-only store to record the full
series of events that describe actions taken on
data in a domain, rather than storing just the
current state.
Event Sourcing Examples
Sumerian clay
tablets
Transactional systems (i.e. Stock)
Accounting ledger
Database transaction log
Source control systems
Blockchain = Event Sourcing + Public Store + Decentralized
Scenario
You are the team lead of a small team of developers at a
start-up company building an Amazon competitor. Your
product is gaining traction and you expect a lot more users
in the next few months.
• The customers are complaining of slow response times &
crashes during peak times.
• Come up with a plan to make your application more
performant.
• Think about your deployment and scaling strategy.
We Have a Monolith
A monolithic application has a single code
base and a single build system which
builds and deploys the entire application
(and dependencies). Modules may be
divided as business features or technical
features.
Scenario Continued
Monolithic Application
 Big and complex code base
 Hard onboarding process for new
developers
 Hidden coupling and complexity
 Single build pipeline
 Release cycle is long
 Scaling up is very expensive
 Performance issues
 Application is offline when
deploying new version
Symptoms A solution path
• CRM
• Online Store
• Supplier
• Stock
• Accounts
• Reports
 Identify which parts of the system
are used the most
 Logically separate those parts
 Deploying the separated parts
independently
 Scale the required parts
independently
Thought Experiment
You are managing a coffee shop and have 2
employees who work alternate shifts.
• Anna who is a great barista but is slow at
operating the cash register.
• Sam who doesn’t make great coffee but is fast at
operating the register.
• More people are coming to the store and you
want a strategy to reduce wait times for
customers.
CQRS to the Rescue
“CQRS stands for Command Query
Responsibility Segregation. At its heart is the
notion that you can use a different model to
update information than the model you use to
read information”
– Martin Fowler
Simple CQRS Solution
Without CQRS
ShoppingCatalogueService
+ AddItem(itemInfo): void
+ UpdateItem(item): void
+ RemoveItem(item): void
+ Search(criteria): Decimal
+ Browse(category): items[]
+ SetDiscount(item): void
With CQRS
ShoppingCatalogueReadService
+ Search(criteria): Decimal
+ Browse(category): items[]
ShoppingCatalogueWriteService
+ AddItem(itemInfo): void
+ UpdateItem(item): void
+ RemoveItem(item): void
+ SetDiscount(item): void
MonolithicApplication
Updated Scenario
You have successfully managed to logically separate your
Online-Store module to writes (commands) and reads
(queries).
• It’s become clear that “data models” used for write vs
read are different.
• Investigate whether it is possible to deploy those as
separate applications and have separate data models/
storage mechanisms.
CQRS Solution Evolved
What if we build and deploy them
independently?
ShoppingCatalogueReadService
+ Search(criteria): Decimal
+ Browse(category): items[]
ShoppingCatalogueWriteService
+ AddItem(itemInfo): void
+ UpdateItem(item): void
+ RemoveItem(item): void
+ SetDiscount(item): void
We get a solution that has…
 Independent scalability
 Manageable codebases
But what about…
 Shared storage?
 Transactions + Locks?
 Dependency availability?
CQRS Solution Using Event Sourcing
ShoppingCatalogueReadService
+ Search(criteria): Decimal
+ Browse(category): items[]
ShoppingCatalogueWriteService
+ AddItem(itemInfo): void
+ UpdateItem(item): void
+ RemoveItem(item): void
+ SetDiscount(item): void
Domain Events
Event Database
(Append Only)
Read Model Database
Subscribers
listening to events
Queue
Storing an event
publishes it to the
queue
Query
Command
Update Read
Model
A Bit More About
Event Sourcing And CQRS
 Event Sourcing is naturally CQRS
 But… not all CQRS solutions are event sourced
 CQRS is not an end goal
 Event Sourcing is a natural functional model
State GetNewState(State oldState, Event lastEvent) {
return (oldState + lastEvent);
}
Key Benefits of Event Sourcing
• Ability to track all changes done to the domain
 Rebuild your state to a point in time
• Less coupling between read and write sides
 Reduction of impedance mismatch
 Many world views
 Independent scalability
• Easier to debug
Some Pitfalls When Using Event Sourcing
• Unfamiliar concept to many
• External systems / dependencies
• Eventual consistency
• Event schema changes
What Did We Learn?
• Event Sourcing And Command Query
Responsibility Segregation
• What they are?
• When to apply them?
• Key advantages
• Disadvantages
• Basic event sourcing workflow
Want More?
• My blog: dasith.me
• ES ‘reference framework’ for .NET: NEventLite
(Search: NEventLite on NuGet or GitHub)
• Domain Driven Design – Eric Evans
• Greg Young on YouTube
• DDD/CQRS Google Group
• ES database: eventstore.org
Thank you!
@dasiths
dasith.me

Más contenido relacionado

La actualidad más candente

Solving Business Problems with Machine Learning in SAP Analytics Cloud
Solving Business Problems with Machine Learning in SAP Analytics CloudSolving Business Problems with Machine Learning in SAP Analytics Cloud
Solving Business Problems with Machine Learning in SAP Analytics CloudExtentia Information Technology
 
Open Blueprint for Real-Time Analytics with In-Stream Processing
Open Blueprint for Real-Time Analytics with In-Stream ProcessingOpen Blueprint for Real-Time Analytics with In-Stream Processing
Open Blueprint for Real-Time Analytics with In-Stream ProcessingGrid Dynamics
 
247 overviewmongodbevening-bangalore
247 overviewmongodbevening-bangalore247 overviewmongodbevening-bangalore
247 overviewmongodbevening-bangaloreMongoDB APAC
 
Introduction to Big Data using AWS Services
Introduction to Big Data using AWS ServicesIntroduction to Big Data using AWS Services
Introduction to Big Data using AWS ServicesAnjani Phuyal
 
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE) Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE) Guido Schmutz
 
Workshop 2: Building a streaming data platform on AWS
Workshop 2: Building a streaming data platform on AWSWorkshop 2: Building a streaming data platform on AWS
Workshop 2: Building a streaming data platform on AWSAmazon Web Services
 
7 Benefits Of QuickBooks EnterPrise Hosting
7 Benefits Of QuickBooks EnterPrise Hosting7 Benefits Of QuickBooks EnterPrise Hosting
7 Benefits Of QuickBooks EnterPrise HostingSouraj Sarkar
 
How to get Real-Time Value from your IoT Data - Datastax
How to get Real-Time Value from your IoT Data - DatastaxHow to get Real-Time Value from your IoT Data - Datastax
How to get Real-Time Value from your IoT Data - DatastaxDataStax
 
Managing Smart Meter with DataStax DSE
Managing Smart Meter with DataStax DSEManaging Smart Meter with DataStax DSE
Managing Smart Meter with DataStax DSEDataStax
 
Denodo DataFest 2017: Enabling Single View of Entities with Microservices
Denodo DataFest 2017: Enabling Single View of Entities with MicroservicesDenodo DataFest 2017: Enabling Single View of Entities with Microservices
Denodo DataFest 2017: Enabling Single View of Entities with MicroservicesDenodo
 
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data Delivery
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data DeliveryDenodo DataFest 2017: Modern Data Architectures Need Real-time Data Delivery
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data DeliveryDenodo
 
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 Analytics
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 AnalyticsWSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 Analytics
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 AnalyticsWSO2
 
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with AnalyticsWSO2
 

La actualidad más candente (15)

Solving Business Problems with Machine Learning in SAP Analytics Cloud
Solving Business Problems with Machine Learning in SAP Analytics CloudSolving Business Problems with Machine Learning in SAP Analytics Cloud
Solving Business Problems with Machine Learning in SAP Analytics Cloud
 
Open Blueprint for Real-Time Analytics with In-Stream Processing
Open Blueprint for Real-Time Analytics with In-Stream ProcessingOpen Blueprint for Real-Time Analytics with In-Stream Processing
Open Blueprint for Real-Time Analytics with In-Stream Processing
 
247 overviewmongodbevening-bangalore
247 overviewmongodbevening-bangalore247 overviewmongodbevening-bangalore
247 overviewmongodbevening-bangalore
 
Introduction to Big Data using AWS Services
Introduction to Big Data using AWS ServicesIntroduction to Big Data using AWS Services
Introduction to Big Data using AWS Services
 
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE) Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
 
Workshop 2: Building a streaming data platform on AWS
Workshop 2: Building a streaming data platform on AWSWorkshop 2: Building a streaming data platform on AWS
Workshop 2: Building a streaming data platform on AWS
 
7 Benefits Of QuickBooks EnterPrise Hosting
7 Benefits Of QuickBooks EnterPrise Hosting7 Benefits Of QuickBooks EnterPrise Hosting
7 Benefits Of QuickBooks EnterPrise Hosting
 
How to get Real-Time Value from your IoT Data - Datastax
How to get Real-Time Value from your IoT Data - DatastaxHow to get Real-Time Value from your IoT Data - Datastax
How to get Real-Time Value from your IoT Data - Datastax
 
Managing Smart Meter with DataStax DSE
Managing Smart Meter with DataStax DSEManaging Smart Meter with DataStax DSE
Managing Smart Meter with DataStax DSE
 
Denodo DataFest 2017: Enabling Single View of Entities with Microservices
Denodo DataFest 2017: Enabling Single View of Entities with MicroservicesDenodo DataFest 2017: Enabling Single View of Entities with Microservices
Denodo DataFest 2017: Enabling Single View of Entities with Microservices
 
Kogo
KogoKogo
Kogo
 
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data Delivery
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data DeliveryDenodo DataFest 2017: Modern Data Architectures Need Real-time Data Delivery
Denodo DataFest 2017: Modern Data Architectures Need Real-time Data Delivery
 
Hybrid IT: Legg Mason
Hybrid IT: Legg MasonHybrid IT: Legg Mason
Hybrid IT: Legg Mason
 
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 Analytics
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 AnalyticsWSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 Analytics
WSO2Con USA 2017: Discover Data That Matters: Deep Dive into WSO2 Analytics
 
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
 

Similar a LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena

Digital_IOT_(Microsoft_Solution).pdf
Digital_IOT_(Microsoft_Solution).pdfDigital_IOT_(Microsoft_Solution).pdf
Digital_IOT_(Microsoft_Solution).pdfssuserd23711
 
Web Analytics Wednesday Melbourne Meet Up
Web Analytics Wednesday Melbourne Meet UpWeb Analytics Wednesday Melbourne Meet Up
Web Analytics Wednesday Melbourne Meet UpNarbeh Yousefian
 
Levelling up your data infrastructure
Levelling up your data infrastructureLevelling up your data infrastructure
Levelling up your data infrastructureSimon Belak
 
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스Amazon Web Services Korea
 
AWS Webcast - Sales Productivity Solutions with MicroStrategy and Redshift
AWS Webcast - Sales Productivity Solutions with MicroStrategy and RedshiftAWS Webcast - Sales Productivity Solutions with MicroStrategy and Redshift
AWS Webcast - Sales Productivity Solutions with MicroStrategy and RedshiftAmazon Web Services
 
AWS Summit Seoul 2015 - AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...
AWS Summit Seoul 2015 -  AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...AWS Summit Seoul 2015 -  AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...
AWS Summit Seoul 2015 - AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...Amazon Web Services Korea
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...Amazon Web Services
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServicesDavid Walker
 
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...confluent
 
WSO2Con USA 2015: The Needs of Next Generation Giants
WSO2Con USA 2015: The Needs of Next Generation GiantsWSO2Con USA 2015: The Needs of Next Generation Giants
WSO2Con USA 2015: The Needs of Next Generation GiantsWSO2
 
2016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V42016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V4Janani Eshwaran
 
2016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V42016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V4Janani Eshwaran
 
Log insight 3.3 customer presentation
Log insight 3.3 customer presentationLog insight 3.3 customer presentation
Log insight 3.3 customer presentationDavid Pasek
 
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysWhat is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysNEWYORKSYS-IT SOLUTIONS
 
Platforming the Major Analytic Use Cases for Modern Engineering
Platforming the Major Analytic Use Cases for Modern EngineeringPlatforming the Major Analytic Use Cases for Modern Engineering
Platforming the Major Analytic Use Cases for Modern EngineeringDATAVERSITY
 
Jazz for Service Management
Jazz for Service ManagementJazz for Service Management
Jazz for Service ManagementIBM Danmark
 
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...Amazon Web Services
 
ADV Slides: Comparing the Enterprise Analytic Solutions
ADV Slides: Comparing the Enterprise Analytic SolutionsADV Slides: Comparing the Enterprise Analytic Solutions
ADV Slides: Comparing the Enterprise Analytic SolutionsDATAVERSITY
 
Network Solution
Network SolutionNetwork Solution
Network Solutionchris20854
 

Similar a LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena (20)

Digital_IOT_(Microsoft_Solution).pdf
Digital_IOT_(Microsoft_Solution).pdfDigital_IOT_(Microsoft_Solution).pdf
Digital_IOT_(Microsoft_Solution).pdf
 
Web Analytics Wednesday Melbourne Meet Up
Web Analytics Wednesday Melbourne Meet UpWeb Analytics Wednesday Melbourne Meet Up
Web Analytics Wednesday Melbourne Meet Up
 
Levelling up your data infrastructure
Levelling up your data infrastructureLevelling up your data infrastructure
Levelling up your data infrastructure
 
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스
클라우드에서의 데이터 웨어하우징 & 비즈니스 인텔리전스
 
AWS Webcast - Sales Productivity Solutions with MicroStrategy and Redshift
AWS Webcast - Sales Productivity Solutions with MicroStrategy and RedshiftAWS Webcast - Sales Productivity Solutions with MicroStrategy and Redshift
AWS Webcast - Sales Productivity Solutions with MicroStrategy and Redshift
 
AWS Summit Seoul 2015 - AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...
AWS Summit Seoul 2015 -  AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...AWS Summit Seoul 2015 -  AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...
AWS Summit Seoul 2015 - AWS 최신 서비스 살펴보기 - Aurora, Lambda, EFS, Machine Learn...
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServices
 
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...
Data Management & Warehousing (David Walker, ex-World Pay) 2019 Confluent Str...
 
WSO2Con USA 2015: The Needs of Next Generation Giants
WSO2Con USA 2015: The Needs of Next Generation GiantsWSO2Con USA 2015: The Needs of Next Generation Giants
WSO2Con USA 2015: The Needs of Next Generation Giants
 
2016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V42016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V4
 
2016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V42016 DSG Webinar Azure HDInsight 2 V4
2016 DSG Webinar Azure HDInsight 2 V4
 
Log insight 3.3 customer presentation
Log insight 3.3 customer presentationLog insight 3.3 customer presentation
Log insight 3.3 customer presentation
 
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysWhat is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
 
VAS - VMware CMP
VAS - VMware CMPVAS - VMware CMP
VAS - VMware CMP
 
Platforming the Major Analytic Use Cases for Modern Engineering
Platforming the Major Analytic Use Cases for Modern EngineeringPlatforming the Major Analytic Use Cases for Modern Engineering
Platforming the Major Analytic Use Cases for Modern Engineering
 
Jazz for Service Management
Jazz for Service ManagementJazz for Service Management
Jazz for Service Management
 
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...
AWS December 2015 Webinar Series - Strategies to Quantify TCO & Optimize Cost...
 
ADV Slides: Comparing the Enterprise Analytic Solutions
ADV Slides: Comparing the Enterprise Analytic SolutionsADV Slides: Comparing the Enterprise Analytic Solutions
ADV Slides: Comparing the Enterprise Analytic Solutions
 
Network Solution
Network SolutionNetwork Solution
Network Solution
 

Último

WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 

Último (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 

LevelsConf 2018 Event Sourcing - Dasith Wijesiriwardena

  • 1. 07 July 2018 | Dasith Wijes
  • 2. Event Sourcing Event sourcing workflow > Audit trails, Sumerian clay tablets and Blockchain > Advantages over storing state > Simple form of CQRS, contrasting it to a monolith > Command side and read side > How event sourcing fits in Command Query Responsibility Segregation > Shopping catalogue example
  • 3. What is Domain Driven Design? “In order to create good software, you have to know what that software is all about. You cannot create a banking software system unless you have a good understanding of what banking is all about, one must understand the domain of banking” – Eric Evans
  • 4. What is Event Sourcing? Use an append-only store to record the full series of events that describe actions taken on data in a domain, rather than storing just the current state.
  • 5. Event Sourcing Examples Sumerian clay tablets Transactional systems (i.e. Stock) Accounting ledger Database transaction log Source control systems
  • 6. Blockchain = Event Sourcing + Public Store + Decentralized
  • 7. Scenario You are the team lead of a small team of developers at a start-up company building an Amazon competitor. Your product is gaining traction and you expect a lot more users in the next few months. • The customers are complaining of slow response times & crashes during peak times. • Come up with a plan to make your application more performant. • Think about your deployment and scaling strategy.
  • 8. We Have a Monolith A monolithic application has a single code base and a single build system which builds and deploys the entire application (and dependencies). Modules may be divided as business features or technical features.
  • 9. Scenario Continued Monolithic Application  Big and complex code base  Hard onboarding process for new developers  Hidden coupling and complexity  Single build pipeline  Release cycle is long  Scaling up is very expensive  Performance issues  Application is offline when deploying new version Symptoms A solution path • CRM • Online Store • Supplier • Stock • Accounts • Reports  Identify which parts of the system are used the most  Logically separate those parts  Deploying the separated parts independently  Scale the required parts independently
  • 10. Thought Experiment You are managing a coffee shop and have 2 employees who work alternate shifts. • Anna who is a great barista but is slow at operating the cash register. • Sam who doesn’t make great coffee but is fast at operating the register. • More people are coming to the store and you want a strategy to reduce wait times for customers.
  • 11. CQRS to the Rescue “CQRS stands for Command Query Responsibility Segregation. At its heart is the notion that you can use a different model to update information than the model you use to read information” – Martin Fowler
  • 12. Simple CQRS Solution Without CQRS ShoppingCatalogueService + AddItem(itemInfo): void + UpdateItem(item): void + RemoveItem(item): void + Search(criteria): Decimal + Browse(category): items[] + SetDiscount(item): void With CQRS ShoppingCatalogueReadService + Search(criteria): Decimal + Browse(category): items[] ShoppingCatalogueWriteService + AddItem(itemInfo): void + UpdateItem(item): void + RemoveItem(item): void + SetDiscount(item): void MonolithicApplication
  • 13. Updated Scenario You have successfully managed to logically separate your Online-Store module to writes (commands) and reads (queries). • It’s become clear that “data models” used for write vs read are different. • Investigate whether it is possible to deploy those as separate applications and have separate data models/ storage mechanisms.
  • 14. CQRS Solution Evolved What if we build and deploy them independently? ShoppingCatalogueReadService + Search(criteria): Decimal + Browse(category): items[] ShoppingCatalogueWriteService + AddItem(itemInfo): void + UpdateItem(item): void + RemoveItem(item): void + SetDiscount(item): void We get a solution that has…  Independent scalability  Manageable codebases But what about…  Shared storage?  Transactions + Locks?  Dependency availability?
  • 15.
  • 16. CQRS Solution Using Event Sourcing ShoppingCatalogueReadService + Search(criteria): Decimal + Browse(category): items[] ShoppingCatalogueWriteService + AddItem(itemInfo): void + UpdateItem(item): void + RemoveItem(item): void + SetDiscount(item): void Domain Events Event Database (Append Only) Read Model Database Subscribers listening to events Queue Storing an event publishes it to the queue Query Command Update Read Model
  • 17. A Bit More About Event Sourcing And CQRS  Event Sourcing is naturally CQRS  But… not all CQRS solutions are event sourced  CQRS is not an end goal  Event Sourcing is a natural functional model State GetNewState(State oldState, Event lastEvent) { return (oldState + lastEvent); }
  • 18. Key Benefits of Event Sourcing • Ability to track all changes done to the domain  Rebuild your state to a point in time • Less coupling between read and write sides  Reduction of impedance mismatch  Many world views  Independent scalability • Easier to debug
  • 19. Some Pitfalls When Using Event Sourcing • Unfamiliar concept to many • External systems / dependencies • Eventual consistency • Event schema changes
  • 20. What Did We Learn? • Event Sourcing And Command Query Responsibility Segregation • What they are? • When to apply them? • Key advantages • Disadvantages • Basic event sourcing workflow
  • 21. Want More? • My blog: dasith.me • ES ‘reference framework’ for .NET: NEventLite (Search: NEventLite on NuGet or GitHub) • Domain Driven Design – Eric Evans • Greg Young on YouTube • DDD/CQRS Google Group • ES database: eventstore.org

Notas del editor

  1. CQRS and ES are concepts that have roots in DDD. The complexity at the heart of any software system isn’t in the architecture, user interface or in feature set. The complexity resides in understanding the domain. DDD introduces a common set of patterns and principles to model your domain in a way that reduces this complexity.
  2. In its most simple form, event sourcing is nothing but storing all the domain events so your state changes are represented as a series of actions. Auditability is the most key advantage event sourcing brings The bank balance example
  3. Blockchain based systems are “naturally event sourced”. Solves the audit and trust problems in a decentralized way.
  4. Easier to test and debug. Don’t have to deal with the availability of dependencies.
  5. Anything that changes the state of our system is considered a command while a Query is something that is used to just read state. What it is : A powerful tool that solves a very specific set of problems. What it’s not : A silver bullet for every problem domain.
  6. There is no perfect way to solve a problem. It always depends.
  7. CQRS is a stepping stone to an ES system Command Query Separation (CQRS is based on this) first introduced by Bertrand Meyer in 1988) Functionally ES state is a left fold of previous state
  8. ES is a application level architecture. If you use ES as a top level architecture like SOA you will end up with an event sourced monolith.