Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Distributed Events
Search
Stijn Volders
May 12, 2016
Technology
0
45
Distributed Events
Slides of the presentation I gave at the NCrafts conference in Paris on 12 May (
www.ncrafts.io
)
Stijn Volders
May 12, 2016
Tweet
Share
More Decks by Stijn Volders
See All by Stijn Volders
DDD Basics - Context Mapping
one75
1
360
Introduction to RavenDB
one75
1
140
Other Decks in Technology
See All in Technology
Databricks Free Edition講座 データエンジニアリング編
taka_aki
0
2.7k
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
2
910
OCI技術資料 : OS管理ハブ 概要
ocise
2
4.1k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
920
ALB「証明書上限問題」からの脱却
nishiokashinji
0
210
CQRS/ESになぜアクターモデルが必要なのか
j5ik2o
0
1.2k
#22 CA × atmaCup 3rd 1st Place Solution
yumizu
1
220
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
迷わない!AI×MCP連携のリファレンスアーキテクチャ完全ガイド
cdataj
0
570
Data Intelligence on Lakehouse Paradigm
scotthsieh825
0
160
田舎で20年スクラム(後編):一個人が企業で長期戦アジャイルに挑む意味
chinmo
1
1.5k
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
0
31k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
210
Tell your own story through comics
letsgokoyo
1
790
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
Paper Plane
katiecoart
PRO
0
45k
My Coaching Mixtape
mlcsv
0
26
The SEO identity crisis: Don't let AI make you average
varn
0
51
Site-Speed That Sticks
csswizardry
13
1k
Deep Space Network (abreviated)
tonyrice
0
34
Optimizing for Happiness
mojombo
379
70k
It's Worth the Effort
3n
188
29k
Leo the Paperboy
mayatellez
3
1.3k
Transcript
Stijn Volders Freelance .net consultant Loves complex problems (that can
be solved with software) @one75 https://www.linkedin.com/in/stijnvolders
[email protected]
Distributed Events A case study from the trenches
Agenda • ReTiBo • The “Green List” concept • Synchronization
with events • Scaling with HTTP • Questions
Problem space
Problem space
Problem space
Problem space
Problem space ReTiBo (Registration, Ticketing, Board computer) • User registration
• Travel information (trip duration, available connections,...) • Traffic jams, deviations,...
Problem space 4500 driver consoles
Problem space 12000 validators
Green List
Problem space Synchronization
Problem space over 3G
Problem space
Solution
Solution • Inspired by ATOM • Based on immutable events
• ASP.NET Web API • nginx
Solution • No power = no connection • During (school)
holidays: 5 to 20% not in use
Solution
Synchronisation GET api/streams/greenlist/current now past Green separator: event Black separator:
page
Synchronisation { “links”: [ { “uri”: “api/streams/greenlist/current”, “Rel”: “self” },
{ “uri”: “api/streams/greenlist/2015/4/14?page=2”, “Rel”: “previous” } ], “items”: [{...},{...}], }
Synchronisation GET api/streams/greenlist/2015/4/14?page=2 now past
Synchronisation GET api/streams/greenlist/2015/4/14?page=1 now past
Synchronisation GET api/streams/greenlist/2015/4/13?page=9 now past Colored box: already in local
datastore
Synchronisation past now
Synchronisation past now
Synchronisation Why backwards?
Synchronisation when([SomePatternMatch], function(state, event) { return new state; }); (http://docs.geteventstore.com/introduction/event-sourcing-basics/)
Scaling
Scaling
Scaling Archived events • Cache-Control: max-age=31363200 (somewhere near a year)
Scaling Current window • Cache-Control: max-age=3000
Scaling
Scaling Given • Nothing is cached • A 5 minute
interval • 16500 devices
Scaling 198 000 connections / hour 198 000 database hits
/ hour
Scaling
Scaling Given • A 5 minute cache • A 5
minute interval • 16500 devices
Scaling 6 connections 6 database hits
Scaling 33 000 times less...
Scaling
Scaling
Bandwith 3G, remember?
Bandwidth HTTP to the rescue (again) • ETags • Cache
validation • Conditional requests
Bandwidth
Bandwidth Number time… • 600kb payload for a page of
1000 items • 16h of activity (6am - 10pm) • Sync every 5 minutes
Bandwidth Number time… • 7.2 mb every hour (per device)
• 110 mb after 16 hours (per device) • 1.8 TB for all devices each day
Bandwidth
Bandwidth Number time… (conditional requests) • Most greenlist events are
created by night (batch) • 1 request in the morning = almost always updated (HTTP 200 OK) • 1 update per hour
Bandwidth Number time… (conditional requests) • 600 kb every hour
(per device) • ~10 mb after 16 hours (per device) • 165 GB for all devices each day
Measure!
Wrapping it up • Expose immutable events • Start at
the end and follow “previous” • Replay the events chronologically • Conditional requests
Questions? @one75 https://www.linkedin.com/in/stijnvolders
[email protected]
Thank you! @one75 https://www.linkedin.com/in/stijnvolders
[email protected]