F#unctional Toronto Users Group presentation. Broadcast and handle the updates instead of asking for information, get scalability availability and fault tolerance in return.
2. ABOUT ME
Eugene Tolmachev
Principal Architect @ Prolucid
Developing software for over 20 years
Open source contributor:
• FsStorm maintainer
• Bitlore author
• FsUnit
• Dapper
• MassTransit
• Nowin
Storm + F#
3. SCALE OUT & AVAILABILITY
Storm + F#
UI Backend DB
A = Aui Abe Adb
5. ASK VS TELL
Storm + F#
Model
Price
Risk Date
getRisk(date)
risk
date
getModel(date) model
Stack:
…
getPrice
getRisk
getModel
…
• Easy to start with
• Composed at design-time
• Fault handling: on the caller
• Challenging to cache
• Fragile integration
6. EVENTS (FIRE-N-FORGET)
Implemented via Store-and-forward messaging
Represent a summary of a change
Self-contained*
Time-relevant, not time-sensitive
Uniquely identifiable
• Tracing/correlation
• Idempotency
Storm + F#
7. ASK VS TELL
Storm + F#
• Upfront setup
• Can compose at runtime
• Fault handling: Compensations
• Caching – unnecessary
• Can evolve independently
• Embarrassingly parallel
Price
Risk
DateModel
modelUpdated(m,date)
riskUpdated(r,m,date)
newDay(date)
newDay(date)
calculate
Model
calculate
Risk
calculate
Price
generate
Date
Multiple Stacks:
8. MICRO-SERVICES
Services encapsulate
• Business-logic
• Can evolve independently as long as the surface API remains the same
Services control the context
• Persistence
• Security
• Performance
Micro-services
+ Do one thing only, do it well
- Introduce latency
- Deployment/management overhead
Storm + F#
9. THERMOSTAT ALERT
Storm + F#
Sensor
is up
Sensor
value
Settings
updated
Write down
raw data
Evaluate against
the threshold
Send notification
Read all
sensors
Write down
the settings
Write down
the result
10. APACHE STORM
Runs on JRE
Storm
• Spouts: throttled
• Streams: default and named
• Tuples: anchored or not
• Bolts: input – on demand/output – at will
• Grouping (affinity): all, shuffle, fields, direct
Storm multilang protocol:
• JSON over stdin/stdout
• Components: a process per instance
Storm CLI, to start:
• storm dev-zookeeper (runtime coordination)
• storm nimbus (management/api)
• storm supervisor (runs components)
• storm ui (optionally, http://localhost:8080)
Storm + F#