Domain Events in Distributed Architecture
-
Upload
michal-lukaszewski -
Category
Technology
-
view
264 -
download
0
Transcript of Domain Events in Distributed Architecture
Domain Events in Distributed Architecture
Michał Łukaszewski
/m_lukaszewski
How to pretend that our application is reliable and fast and still get paid
Basics
Reasons
Methods
Events
Dark places
Rules
Basics
Performance Budget0.1 sec – human response to changes
2 sec – impatience
3 sec – 30% leaves a page
10 sec - users forget what they want to do (a short-term memory feature)
GUI
Action
Domain A Domain B
Responder
Renderer
Reasons
Performance issues
Performance issues
Performance issues
Application integration
Premature optimization
Overengineering
https://twitter.com/ziobrando/status/741186560373186560
Methods
http://www.pc-freak.net/blog/vertical-horizontal-server-services-scaling-vertical-horizontal-hardware-scaling/
Bigger is better?
Optimization
3 rules of optimization
Extract bottleneck to a service
Don’t
Don’t yet
Measure before do anything
3 rules of optimization
voilà
Events
Calling remote services
Calling remote services
You know nothing about state of remote service
but you want to use it aspart of real-time processing
Async everything
Event is a fact from the past
Event cannot be ordered
UserCommandRegisteredAddBlogPost
BlogPostAddedSendNotification
Domain events
Domain event is something that happened that
domain experts care about.Wise anonymous
Domain events
And now what?
Confirmation of action has been sent
Dark places
What the heck can I answer to a user?
Receiving messages in a right order
Sending messages in a right order
Sending messages in a right order
Concurrency conflicts
https://speakerdeck.com/ulff/event-sourcing-in-php
Concurrency conflicts
• You have no idea where conflict will rise• But you have to handle it
Events sequence
When, how and how many times we should inform a user
about progress?
UserCommandRegisteredAddBlogPost
BlogPostAddedSendNotification
Complex event trigger Distributed Dependency Hell
Complex event trigger Distributed Dependency Hell
Who the heck sent this s..t?!
Who the heck sent this s..t?!
• How to confirm–A sender–If message was sent–Is data are valid
QoS
FIFO
QoS
• How to–Mark an event as important
*by type*–Mark an event as important
*because source*–Mark some events as important
*because business logic*
There is no „the right way”
Know your enemy.
Rules
#1
I don’t know• how many of you are listening• in what order you will finish your
job• what you will return (and when)
#2
Event is a fact, not a wish.
#3
Event (data) have to be small and serializable.
#4
Each event has its own source.
#5
Don't model an event for a specific handler
Thanks!
?
Credits• https://speakerdeck.com/mat3u/domain-events-czyli-jak-radzic-sobie-z-rzeczywistoscia• https://speakerdeck.com/ulff/event-sourcing-in-php• http://blog.best.net.pl/16-key-points-wydajnosc-w-budowaniu-aplikacji-internetowych/• https://www.linkedin.com/profile/portfolio?id=31205064&authType=name&authToken=YnLc&med
iaID=51178139&trk=landing_share• http://danielwhittaker.me/2014/09/29/handling-concurrency-issues-cqrs-event-sourced-system/