SlideShare a Scribd company logo
● Event Sourcing
● CQRS
● LMAX Disruptor
High Performance Bulletproof Architecture
Event Sourcing
Event Sourcing (Pros)
● ONLY model that never loses data
o You never know how you'd use your data tomorrow
o You can add/remove features like there were out there all
this time
o Perfect for Big Data
● Events (facts) are never ever removed or updated
o Easily proves your audit log is correct
o Protects from superuser attack
● Business asks for it!
Cart
Items
Shipping
Information
Traditional Data Structure (DTO or a STATE!)
Cart
Created
Event Stream
2 Items
Added
1 Item
Removed
Shipping
Information
Added
● Events are FACTS! They are never deleted from the system
● Events are what creates the current state
● Depending on your business requirement you might have different
view of the same event stream (different states)
● Any possible data can be projected from event stream
Event Sourcing (Pros) II
● Best traceability and debuggability (time machine)
● Move to the past and get the state as it was
● Easily evolve domain
● No more mapping objects to tables
● Smoke testing
● Super easy to test
● Scale Easily
● High Availability
● Cost!
Current State - Aggregates (Domain Model)
Typical test (any behaviour can be tested like this!)
Event Sourcing (Cons)
● Weird at first
● Event / Command confusion
● Side effects on event reply
● You either do it all
or not doing at all
Java 8 Stream (uppercase sort and print)
Java 8 Stream (count all strings starting with “b”)
Streams in Reactive Programming
In Rx every data source is a Stream!
Streams in Reactive Programming
Streams in Reactive Programming
CQRS
Tipical architecture
UI
BUSINESS
LOGIC Storage
Write
Read
Tipical architecture
CQRS (Pros)
● PERFORMANCE!!!
o Command side is optimized for writes
 keep the current state in memory
 you only really need ACTUAL CONSISTENCY in write side
o Query side is optimized for reads
 Takes advantage of EVENTUAL CONSISTENCY
● Naturally easy to scale linearly
o Scale only what you need
● Polyglot persistence
o Forget SQL queries, forget joins, forget mapping objects to tables
● Efficiency
o Simple commodity hardware might take a huge load
CQRS (Cons)
● Makes you choose between command or query
o You either write or read (but you can workaround it)
Questions?
Disruptor by LMAX
Why Concurrency is HARD?
CPU structure
False sharing (hidden contention)
Java Concurrency
● Locks
● Queues
● Synchronization
● Contention
and other scary things
Disruptor Concurrency
● Non
● BLOCKING
● Contention Free
● CONCURRENCY !!!
Disruptor Structure
LMAX Architecture
Disruptor (Pros)
● Performance of course
● Holly BATCHING!!!
● Mechanical Sympathy
● Optionally GC Free
● Prevents False Sharing
● Easy to compose dependant consumers (concurrency)
● Synchronization free code in consumers
● Data Structure (not a frickin framework!!!)
● Fits werry well with CQRS and ES
Disruptor (Pros)
● Thread affinity (for more performance/throughput)
● Different strategies for Consumers (busy spin, sleep)
● Single/Multiple producer strategy
Disruptor (Cons)
● Weird at first (again)
● Different approach to concurrency
● Hard to understand how the performance is achieved
Avoid useless processing (disrupter can batch)
Disruptor Implementation (simplified)
Why power of 2?
lets look at some assembly code
Assembly of publish(..) the memory barrier
No locks at all ( Atomic.lazySet )
Ring Buffer customizations
● Producer strategies
○ Single producer
○ Multiple producer
● Wait Strategies
○ Sleeping Wait
○ Yielding Wait
○ Busy Spin
ES + CQRS + DISRUPTOR + EVENTSTORE
The (almost) perfect architecture
Command
Bus
Command side
commands *
(1) Replication
(2) Journalling
(3) Unmarshalling
Command Business
Logic [1,2,3]
COMMAND DOMAIN MODEL
events *
Command Store
Event
Bus
Query side
events * (1)
(2) Journalling
(3) Unmarshalling
Query Business Logic
[1,2]
QUERY DOMAIN MODEL
(1) Replication
Denormalized Data
Storage
queries * (n)
*
Event Store
With pleasure develop colleagues!!!
The END!
Links for Event Sourcing and CQRS
● First video you need to watch about ES and CQRS
https://www.youtube.com/watch?v=JHGkaShoyNs
● a good webinar about microservice architecture and CQRS
http://plainoldobjects.com/presentations/building-and-deploying-microservices-with-event-sourcing-
cqrs-and-docker/
● eventstore is a database designed by Greg himself (the guy in first video), he also puts a lot of
information about ES and CQRS in docs http://docs.geteventstore.com/introduction/event-
sourcing-basics/
● practical video showcase (8 hours but worth it) http://www.viddler.com/v/dc528842
Links for LMAX Disruptor
● https://www.youtube.com/watch?v=DCdGlxBbKU4
● https://www.youtube.com/watch?v=KrWxle6U10M
● https://www.youtube.com/watch?v=IsGBA9KEtTM
● http://martinfowler.com/articles/lmax.html
● https://www.youtube.com/watch?v=eTeWxZvlCZ8
And some stuff about high performance Java code
● https://www.youtube.com/watch?v=NEG8tMn36VQ
● https://www.youtube.com/watch?v=t49bfPLp0B0
● http://www.slideshare.net/PeterLawrey/writing-and-testing-high-frequency-trading-engines-in-java
● https://www.youtube.com/watch?v=ih-IZHpxFkY

More Related Content

What's hot

Yet another introduction to Linux RCU
Yet another introduction to Linux RCUYet another introduction to Linux RCU
Yet another introduction to Linux RCU
Viller Hsiao
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
Mahendra M
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
Pradeep Kumar TS
 
RCU
RCURCU
Workshop@naha_val3
Workshop@naha_val3Workshop@naha_val3
Workshop@naha_val3
Shusaku Fukumine
 
Java 8 고급 (4/6)
Java 8 고급 (4/6)Java 8 고급 (4/6)
Java 8 고급 (4/6)
Kyung Koo Yoon
 
Rust: Reach Further
Rust: Reach FurtherRust: Reach Further
Rust: Reach Further
nikomatsakis
 
Real world blockchains
Real world blockchainsReal world blockchains
Real world blockchains
Dmitry Meshkov
 
Beginners guide-concurrency
Beginners guide-concurrencyBeginners guide-concurrency
Beginners guide-concurrency
Michael Barker
 
FOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerFOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the corner
Andrey Vagin
 
От sysV к systemd
От sysV к systemdОт sysV к systemd
От sysV к systemd
Denis Kovalev
 
The Silence of the Canaries
The Silence of the CanariesThe Silence of the Canaries
The Silence of the Canaries
Kernel TLV
 
LCA13: Common Clk Framework DVFS Roadmap
LCA13: Common Clk Framework DVFS RoadmapLCA13: Common Clk Framework DVFS Roadmap
LCA13: Common Clk Framework DVFS Roadmap
Linaro
 
zmq.rs - A brief history of concurrency in Rust
zmq.rs - A brief history of concurrency in Rustzmq.rs - A brief history of concurrency in Rust
zmq.rs - A brief history of concurrency in Rust
Fantix King 王川
 
Open ZFS Keynote (public)
Open ZFS Keynote (public)Open ZFS Keynote (public)
Open ZFS Keynote (public)
Dustin Kirkland
 
Concurrency: Rubies, Plural
Concurrency: Rubies, PluralConcurrency: Rubies, Plural
Concurrency: Rubies, Plural
Eleanor McHugh
 
Concurrency: Rubies, plural
Concurrency: Rubies, pluralConcurrency: Rubies, plural
Concurrency: Rubies, plural
ehuard
 
Prerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrencyPrerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrency
Viller Hsiao
 
Non-DIY* Logging
Non-DIY* LoggingNon-DIY* Logging
Non-DIY* Logging
ESUG
 
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Gavin Guo
 

What's hot (20)

Yet another introduction to Linux RCU
Yet another introduction to Linux RCUYet another introduction to Linux RCU
Yet another introduction to Linux RCU
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
RCU
RCURCU
RCU
 
Workshop@naha_val3
Workshop@naha_val3Workshop@naha_val3
Workshop@naha_val3
 
Java 8 고급 (4/6)
Java 8 고급 (4/6)Java 8 고급 (4/6)
Java 8 고급 (4/6)
 
Rust: Reach Further
Rust: Reach FurtherRust: Reach Further
Rust: Reach Further
 
Real world blockchains
Real world blockchainsReal world blockchains
Real world blockchains
 
Beginners guide-concurrency
Beginners guide-concurrencyBeginners guide-concurrency
Beginners guide-concurrency
 
FOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerFOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the corner
 
От sysV к systemd
От sysV к systemdОт sysV к systemd
От sysV к systemd
 
The Silence of the Canaries
The Silence of the CanariesThe Silence of the Canaries
The Silence of the Canaries
 
LCA13: Common Clk Framework DVFS Roadmap
LCA13: Common Clk Framework DVFS RoadmapLCA13: Common Clk Framework DVFS Roadmap
LCA13: Common Clk Framework DVFS Roadmap
 
zmq.rs - A brief history of concurrency in Rust
zmq.rs - A brief history of concurrency in Rustzmq.rs - A brief history of concurrency in Rust
zmq.rs - A brief history of concurrency in Rust
 
Open ZFS Keynote (public)
Open ZFS Keynote (public)Open ZFS Keynote (public)
Open ZFS Keynote (public)
 
Concurrency: Rubies, Plural
Concurrency: Rubies, PluralConcurrency: Rubies, Plural
Concurrency: Rubies, Plural
 
Concurrency: Rubies, plural
Concurrency: Rubies, pluralConcurrency: Rubies, plural
Concurrency: Rubies, plural
 
Prerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrencyPrerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrency
 
Non-DIY* Logging
Non-DIY* LoggingNon-DIY* Logging
Non-DIY* Logging
 
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
 

Viewers also liked

Cqrs journey guide
Cqrs journey guideCqrs journey guide
Cqrs journey guide
Steve Xu
 
CQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainabilityCQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainability
Christopher Bennage
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - en
Eric De Carufel
 
DDD-Enabling Architectures with EventStore
DDD-Enabling Architectures with EventStoreDDD-Enabling Architectures with EventStore
DDD-Enabling Architectures with EventStore
SzymonPobiega
 
Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3
Jonathan Oliver
 
Event Sourcing + CQRS
Event Sourcing + CQRSEvent Sourcing + CQRS
Event Sourcing + CQRS
Bryan Reinero
 
Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015
Anthony Brown
 
Brown bag eventdrivenmicroservices-cqrs
Brown bag  eventdrivenmicroservices-cqrsBrown bag  eventdrivenmicroservices-cqrs
Brown bag eventdrivenmicroservices-cqrs
Vikash Kodati
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databases
Javier García Magna
 
Akka.net versus microsoft orleans
Akka.net versus microsoft orleansAkka.net versus microsoft orleans
Akka.net versus microsoft orleans
Bill Tulloch
 
CQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NETCQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NET
David Hoerster
 

Viewers also liked (11)

Cqrs journey guide
Cqrs journey guideCqrs journey guide
Cqrs journey guide
 
CQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainabilityCQRS: high availability, scabaility, and maintainability
CQRS: high availability, scabaility, and maintainability
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - en
 
DDD-Enabling Architectures with EventStore
DDD-Enabling Architectures with EventStoreDDD-Enabling Architectures with EventStore
DDD-Enabling Architectures with EventStore
 
Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3Europe Virtual ALT.NET - EventStore v3
Europe Virtual ALT.NET - EventStore v3
 
Event Sourcing + CQRS
Event Sourcing + CQRSEvent Sourcing + CQRS
Event Sourcing + CQRS
 
Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015
 
Brown bag eventdrivenmicroservices-cqrs
Brown bag  eventdrivenmicroservices-cqrsBrown bag  eventdrivenmicroservices-cqrs
Brown bag eventdrivenmicroservices-cqrs
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databases
 
Akka.net versus microsoft orleans
Akka.net versus microsoft orleansAkka.net versus microsoft orleans
Akka.net versus microsoft orleans
 
CQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NETCQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NET
 

Similar to Barcamp presentation

Reactive mistakes - ScalaDays Chicago 2017
Reactive mistakes -  ScalaDays Chicago 2017Reactive mistakes -  ScalaDays Chicago 2017
Reactive mistakes - ScalaDays Chicago 2017
Petr Zapletal
 
Exadata
ExadataExadata
Exadata
talek
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
NETWAYS
 
All the ways to (not) break your database in production
All the ways to (not) break your database in productionAll the ways to (not) break your database in production
All the ways to (not) break your database in production
Rotem Tamir
 
Migrate to Microservices Judiciously!
Migrate to Microservices Judiciously!Migrate to Microservices Judiciously!
Migrate to Microservices Judiciously!
pflueras
 
[WSO2Con EU 2018] Architecting for a Container Native Environment
[WSO2Con EU 2018] Architecting for a Container Native Environment[WSO2Con EU 2018] Architecting for a Container Native Environment
[WSO2Con EU 2018] Architecting for a Container Native Environment
WSO2
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
Wei Shan Ang
 
Java under the hood
Java under the hoodJava under the hood
Java under the hood
Vachagan Balayan
 
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Martin Spier
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
FromDual GmbH
 
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Hernan Costante
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
Krivoy Rog IT Community
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®
confluent
 
Log Management Systems
Log Management SystemsLog Management Systems
Log Management Systems
Mehdi Hamidi
 
Distributed real time stream processing- why and how
Distributed real time stream processing- why and howDistributed real time stream processing- why and how
Distributed real time stream processing- why and how
Petr Zapletal
 
Design Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System ArchitectureDesign Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System Architecture
Inductive Automation
 
MySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdfMySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdf
YunusShaikh49
 
Caching in (DevoxxUK 2013)
Caching in (DevoxxUK 2013)Caching in (DevoxxUK 2013)
Caching in (DevoxxUK 2013)
RichardWarburton
 
Speeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using StarlingSpeeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using Starling
Erik Osterman
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
orablue11
 

Similar to Barcamp presentation (20)

Reactive mistakes - ScalaDays Chicago 2017
Reactive mistakes -  ScalaDays Chicago 2017Reactive mistakes -  ScalaDays Chicago 2017
Reactive mistakes - ScalaDays Chicago 2017
 
Exadata
ExadataExadata
Exadata
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
 
All the ways to (not) break your database in production
All the ways to (not) break your database in productionAll the ways to (not) break your database in production
All the ways to (not) break your database in production
 
Migrate to Microservices Judiciously!
Migrate to Microservices Judiciously!Migrate to Microservices Judiciously!
Migrate to Microservices Judiciously!
 
[WSO2Con EU 2018] Architecting for a Container Native Environment
[WSO2Con EU 2018] Architecting for a Container Native Environment[WSO2Con EU 2018] Architecting for a Container Native Environment
[WSO2Con EU 2018] Architecting for a Container Native Environment
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Java under the hood
Java under the hoodJava under the hood
Java under the hood
 
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
 
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®
 
Log Management Systems
Log Management SystemsLog Management Systems
Log Management Systems
 
Distributed real time stream processing- why and how
Distributed real time stream processing- why and howDistributed real time stream processing- why and how
Distributed real time stream processing- why and how
 
Design Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System ArchitectureDesign Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System Architecture
 
MySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdfMySQL HA Orchestrator Proxysql Consul.pdf
MySQL HA Orchestrator Proxysql Consul.pdf
 
Caching in (DevoxxUK 2013)
Caching in (DevoxxUK 2013)Caching in (DevoxxUK 2013)
Caching in (DevoxxUK 2013)
 
Speeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using StarlingSpeeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using Starling
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
 

Recently uploaded

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 

Recently uploaded (20)

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 

Barcamp presentation

  • 1. ● Event Sourcing ● CQRS ● LMAX Disruptor High Performance Bulletproof Architecture
  • 3. Event Sourcing (Pros) ● ONLY model that never loses data o You never know how you'd use your data tomorrow o You can add/remove features like there were out there all this time o Perfect for Big Data ● Events (facts) are never ever removed or updated o Easily proves your audit log is correct o Protects from superuser attack ● Business asks for it!
  • 5. Cart Created Event Stream 2 Items Added 1 Item Removed Shipping Information Added ● Events are FACTS! They are never deleted from the system ● Events are what creates the current state ● Depending on your business requirement you might have different view of the same event stream (different states) ● Any possible data can be projected from event stream
  • 6. Event Sourcing (Pros) II ● Best traceability and debuggability (time machine) ● Move to the past and get the state as it was ● Easily evolve domain ● No more mapping objects to tables ● Smoke testing ● Super easy to test ● Scale Easily ● High Availability ● Cost!
  • 7. Current State - Aggregates (Domain Model)
  • 8. Typical test (any behaviour can be tested like this!)
  • 9. Event Sourcing (Cons) ● Weird at first ● Event / Command confusion ● Side effects on event reply ● You either do it all or not doing at all
  • 10. Java 8 Stream (uppercase sort and print)
  • 11. Java 8 Stream (count all strings starting with “b”)
  • 12. Streams in Reactive Programming In Rx every data source is a Stream!
  • 13. Streams in Reactive Programming
  • 14. Streams in Reactive Programming
  • 15. CQRS
  • 18. CQRS (Pros) ● PERFORMANCE!!! o Command side is optimized for writes  keep the current state in memory  you only really need ACTUAL CONSISTENCY in write side o Query side is optimized for reads  Takes advantage of EVENTUAL CONSISTENCY ● Naturally easy to scale linearly o Scale only what you need ● Polyglot persistence o Forget SQL queries, forget joins, forget mapping objects to tables ● Efficiency o Simple commodity hardware might take a huge load
  • 19. CQRS (Cons) ● Makes you choose between command or query o You either write or read (but you can workaround it)
  • 24. False sharing (hidden contention)
  • 25. Java Concurrency ● Locks ● Queues ● Synchronization ● Contention and other scary things
  • 26. Disruptor Concurrency ● Non ● BLOCKING ● Contention Free ● CONCURRENCY !!!
  • 29. Disruptor (Pros) ● Performance of course ● Holly BATCHING!!! ● Mechanical Sympathy ● Optionally GC Free ● Prevents False Sharing ● Easy to compose dependant consumers (concurrency) ● Synchronization free code in consumers ● Data Structure (not a frickin framework!!!) ● Fits werry well with CQRS and ES
  • 30. Disruptor (Pros) ● Thread affinity (for more performance/throughput) ● Different strategies for Consumers (busy spin, sleep) ● Single/Multiple producer strategy
  • 31. Disruptor (Cons) ● Weird at first (again) ● Different approach to concurrency ● Hard to understand how the performance is achieved
  • 32. Avoid useless processing (disrupter can batch)
  • 35. lets look at some assembly code
  • 36. Assembly of publish(..) the memory barrier
  • 37. No locks at all ( Atomic.lazySet )
  • 38. Ring Buffer customizations ● Producer strategies ○ Single producer ○ Multiple producer ● Wait Strategies ○ Sleeping Wait ○ Yielding Wait ○ Busy Spin
  • 39. ES + CQRS + DISRUPTOR + EVENTSTORE The (almost) perfect architecture
  • 40. Command Bus Command side commands * (1) Replication (2) Journalling (3) Unmarshalling Command Business Logic [1,2,3] COMMAND DOMAIN MODEL events * Command Store
  • 41. Event Bus Query side events * (1) (2) Journalling (3) Unmarshalling Query Business Logic [1,2] QUERY DOMAIN MODEL (1) Replication Denormalized Data Storage queries * (n) * Event Store
  • 42. With pleasure develop colleagues!!! The END!
  • 43. Links for Event Sourcing and CQRS ● First video you need to watch about ES and CQRS https://www.youtube.com/watch?v=JHGkaShoyNs ● a good webinar about microservice architecture and CQRS http://plainoldobjects.com/presentations/building-and-deploying-microservices-with-event-sourcing- cqrs-and-docker/ ● eventstore is a database designed by Greg himself (the guy in first video), he also puts a lot of information about ES and CQRS in docs http://docs.geteventstore.com/introduction/event- sourcing-basics/ ● practical video showcase (8 hours but worth it) http://www.viddler.com/v/dc528842
  • 44. Links for LMAX Disruptor ● https://www.youtube.com/watch?v=DCdGlxBbKU4 ● https://www.youtube.com/watch?v=KrWxle6U10M ● https://www.youtube.com/watch?v=IsGBA9KEtTM ● http://martinfowler.com/articles/lmax.html ● https://www.youtube.com/watch?v=eTeWxZvlCZ8
  • 45. And some stuff about high performance Java code ● https://www.youtube.com/watch?v=NEG8tMn36VQ ● https://www.youtube.com/watch?v=t49bfPLp0B0 ● http://www.slideshare.net/PeterLawrey/writing-and-testing-high-frequency-trading-engines-in-java ● https://www.youtube.com/watch?v=ih-IZHpxFkY