Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture...
Transcript of Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture...
![Page 1: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/1.jpg)
Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks
AMUSE Project
Gururaj Maddodi, Slinger Jansen, and Michiel Overeem
![Page 2: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/2.jpg)
Introduction
Unlike traditional software frameworks, Event Sourcing framework is dynamic in Performance Engineering sense in that each request can have different resource demands
The requests in Event Sourcing systems have to replay all the change to the state (called events) to execute, which causes requests to have different resource demands
In this paper an approach to model this behavior along with two possible architecture is investigated
![Page 3: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/3.jpg)
Research Method
Software Performance Engineering (SPE) Methodology, Describe Software Execution Model (UML sequence diagram, Execution graph …)
to
Derive System Execution Model (Queuing network, Process algebra…)
Use measurements to fill the individual components of the model which could then be used to predict performance metrics of the overall system
![Page 4: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/4.jpg)
Event Sourcing (and possible architectures)
Single Aggregate
Multiple Aggregate
![Page 5: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/5.jpg)
Layered Queuing Networks
Queuing theory is the mathematical study of the congestion and delays of waiting for requests
QN models do not account for software contention, i.e. stations are not considered as both client and servers
Layered Queuing Networks simulate systems with communication between the stations
![Page 6: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/6.jpg)
Layered Queuing Networks
m - Multiplicityd - discipline
m - Multiplicityd - discipline
Service Demand - SDelay - Z
Avg. no. of calls - c
![Page 7: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/7.jpg)
Modeling Components
CPU and disk as processors representing actual hardware resources
Aggregates as task/s with entries containing resource demands only on the CPU processor as it only works on the events available in memory
Event and Command Handlers as tasks containing only delays and no resource demands as they just redirect requests
Event store or database that has resource demand on CPU processor and also connects to disk processor through disk task
Disk task to simulate disk handlers for different requests
![Page 8: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/8.jpg)
System Execution Model (Single Aggreegate)
![Page 9: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/9.jpg)
System Execution Model (Multiple Aggreegate)
![Page 10: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/10.jpg)
Measuring Service Demands
Service demand is the time that a specific request class spends at the resource that is servicing it
Queuing theory specifies rules to calculate it Little’s Law Utilization Law (specific case of Little’s Law) Forced Flow Law
![Page 11: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/11.jpg)
Utilization Law
Utilization law:Dc,i = Uc,i / Xc
Uc,i – utilization at the station/s at a resource
Xc – Throughput of whole system
![Page 12: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/12.jpg)
Forced Flow Law
Forced Flow LawVc,i = Xc,i / Xc
Vc,i – no. of visits at station iXc,i – Throughput at station i
Dc,i = Vc,i * Sc,i
Sc,i – service time per visit at station i
![Page 13: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/13.jpg)
Measurement Tools
![Page 14: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/14.jpg)
Performance Monitor
Counters that can be used: % CPU idle % disk time Disk tps
% CPU SQL Server instance Transactions/sec Write transactions/sec
Overall throughput Request processing time
![Page 15: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/15.jpg)
Applying Queuing Theory Laws
Calculate service demand for CPU resourceCPU Utilization / Overall throughput
Service demand for disk resource Disk Utilization / Overall throughput
OrDisk tps / Overall throughput * service time / request
![Page 16: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/16.jpg)
Applying Queuing Theory Laws
Service demand for CPU resource only DBCPU Utilization of DB / Overall throughput
Application Service Demand = total execution time – DB service demand
Remaining from the total execution time is delay
![Page 17: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/17.jpg)
Measurement vs. Prediction
![Page 18: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/18.jpg)
Measurement vs. Prediction
![Page 19: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/19.jpg)
Conclusion and Future Work
Event Sourcing systems can be modeled by spreading out the resource demand of the request with largest number of events evenly across entire life cycle of aggregate
The two possible architectures can be simulated by separating out tasks such as aggregate and event store so that separate queues handle the requests
Future work envisioned is using the modeling technique described here and applying it on larger systems
![Page 20: Aggregate Architecture Simulation in Event-Sourcing Applications … · Aggregate Architecture Simulation in Event-Sourcing Applications using Layered Queuing Networks. AMUSE Project](https://reader035.fdocuments.in/reader035/viewer/2022070812/5f0bad147e708231d431abba/html5/thumbnails/20.jpg)