SlideShare a Scribd company logo
1 of 57
Download to read offline
Scala Functional Message
Processing: LambdaFlow
John Nestor 47 Degrees
www.47deg.com
https://github.com/47deg/LambdaFlow
May 9, 2017
147deg.com
47deg.com © Copyright 2017 47 Degrees
Outline
• Introduction
• Examples
• Simple
• Windowing
• Indexing and Query
• Graph
• Temperature
• Page Rank
• Questions
2
Introduction
3
47deg.com © Copyright 2017 47 Degrees
Inspiration
• Wanted to build a reactive system using Akka clustering
• Don’t like Spark micro-batching, want message at a time
• Want a Scala functional DSL, like the Spark Scala DSL
4
47deg.com © Copyright 2017 47 Degrees
LambdaFlow
• Near-real-time message processing
• Message at a time
• Both set (create or update) and delete
• Written in Scala and Akka
• Two parts:
• Functional DSL
• Akka Cluster reactive implementation
5
47deg.com © Copyright 2017 47 Degrees
LambdaFlow Use Cases
• * Near real time streaming with infinite stream
• Finite streams
• Batch processing
• Input and outputs via
• files
• API
• Kafka
• …
6
47deg.com © Copyright 2017 47 Degrees
Possible Use Case
7
LambdaFlow
...
Kafka In 1
Kafka In 2
Kafka In M Kafka Out N
Kafka Out 2
Kafka Out 1
...
47deg.com © Copyright 2017 47 Degrees
Functional DSL
• Directed graph
• Strongly typed
• Graph nodes are actions
• Graph arcs are paths for message passing
• Graph can contain cycles
8
47deg.com © Copyright 2017 47 Degrees
Key-Value Model
• (most) Actions contain an in-memory Key-Value
HashMap[K,V]
• Two messages
• Set/Update Key:k1 to Value:v1
• Delete Key-Value pair for Key:k1
9
47deg.com © Copyright 2017 47 Degrees
Combining Actions
• Most actions have
• Input: used to set or delete keys in KV store
• Output: used to set or delete keys on next action
• Operation: maps KV of this action to KV of next action
10
47deg.com © Copyright 2017 47 Degrees
Functional Eventual Consistency
• Two Actions A1[K1,V1] and A2[K2,V2]
• Each have a KV store: A1.kv[K1,V1] and A2.kv[K2,V2]
• the output of A1 is the input to A2
• A1 has an operation A1.f that maps 

[K1,V1] => Set([K2,V2])
• If all changes to A1 are stopped, eventually
• A2.kv = A1.kv.flatMap(A1.f)
11
47deg.com © Copyright 2017 47 Degrees
Incremental Operation
• Suppose an action has k1->v1 and we now set k1->v2
• To update the next action
• Undo the effect of k1->v1
• Do the effect of k1->v2
12
47deg.com © Copyright 2017 47 Degrees
Incremental Operation Example
• Suppose action KV type is String=>String
• If we change “A”->”B” to “A”->”C”
• Operation example 1 (map): (k,v)=>(k+v,v+v)
• Delete “AB”->”BB”
• Set “AC”=> “CC”
• Operation example 2(mapvalue): (k,v) => (k,v+v)
• Delete “A” -> “BB” (not needed here)
• Set “A” -> “CC”
13
47deg.com © Copyright 2017 47 Degrees
Implementations
• Class based
• Uses method calls rather than actor messages
• Local Akka Actor based
• Akka Cluster Based
• Multinode
• Reactive: scalable, responsive, fault-tolerant
14
Simple Example
15
47deg.com © Copyright 2017 47 Degrees
Simple Example
• Input data:
• 8328 Tweets
• Look at input data (capture.json)
• Count number of tweets in each language
• Use method calls between actions
16
47deg.com © Copyright 2017 47 Degrees
Simple Example
17
(Lang,UID) => ()
Src
Sink
Reduce Sum Per Lang
Lang => Count
Map
UID => Lang
47deg.com © Copyright 2017 47 Degrees
Simple Example Code
val src = Source[String, String]("src")

val counts = Sink[String, Long]("counts")



val f1 = src

.map("map",(uid,lang)=>((uid,lang),()))

.reduce("red", _._2, (k, v) => 1L, LongSum)

.sink(counts)



run(f1)
18
47deg.com © Copyright 2017 47 Degrees
Source and Sink Actions
• Source[K,V]
• gets input from outside the graph (e.g. Kafka)
• outputs to other actions
• Sink[K,V]
• gets it input from other actions
• outputs to outside the graph (e.g. Kafka)
19
47deg.com © Copyright 2017 47 Degrees
Map Operation
• Action input type K,V
• Action output type KOUT,VOUT
• Action function type: (K,V)=>(KOUT,VOUT)
20
47deg.com © Copyright 2017 47 Degrees
Reduce Operation
• Action input type K,V
• Action output type KOUT,VOUT
• Grouping function type: K=>KOUT (many to one)
• Value function type: (K,V)=>VOUT
• Reduce operation type (VOUT,VOUT)=>VOUT
• commutative, associative and inverse (abelian group)
21
47deg.com © Copyright 2017 47 Degrees
Simple Example
• Run it (demo.simple)
• Look at code (Simple.scala)
22
Windowing Example
23
47deg.com © Copyright 2017 47 Degrees
Windowing Example
• Streaming Data
• 1000 Tweets
• sent in at ~20 per second
• each tweet expires after 20 seconds
• Count languages and find 20 most common words
• Uses local actor implementation
• Uses Vaadin based visualization tool
24
47deg.com © Copyright 2017 47 Degrees
Windowing Example
25
Lang
Count
Reduce Txt
Total Percent Words
Join
Map
FlatMap
MapReduce
Reduce
First
Map
47deg.com © Copyright 2017 47 Degrees
Windowing Example Code
val f1 = src

.reduce("red", _._1, (k, v) => 1L, LongSum)

.to(counts1, counts2)

.sink(counts)



val f2 = counts1

.reduce("red1", _ => List.empty[String], (k, v) => v, LongSum)

.map[String, Long]("map1", (k, v) => ("total", v))

.to(total1)

.sink(total)



val f3 = counts2

.join[String, Long, Unit, String, String]("product", total1, (s:String)=>(), (s:String)=>()) {

case (lang, count, t, total) => Set((lang, f"${count * 100 / total}%02d$PERCENT"))

}

.sink(percent)



val f4 = text

.flatMap("GetWords", (k, v) => {

val (text, uuid) = k

getWords(text)

.zipWithIndex

.map {

case (word, i) => ((word, uuid, i), ())

}

.toSet

})

.map("CountOrder", (word, count) => ((-count, word), ()))

.first("first", 20)

.map("CountOrder1", (k, v) => (k._2, f"${-k._1}%4d"))

.sink(words)
run(f1, f2, f3, f4)
26
47deg.com © Copyright 2017 47 Degrees
Labels,To and From
• Label[K,V]: used to connect an action output to another
action input
• .to[K,V]: send one input to multiple outputs (broadcast)
• .from[K,V]: combine multiple inputs to a single output
(union)
27
47deg.com © Copyright 2017 47 Degrees
FlatMap Action
• Action input type K,V
• Action output type KOUT,VOUT
• Action function type: (K,V)=>Set[(KOUT,VOUT)]
28
47deg.com © Copyright 2017 47 Degrees
First Action
• Action input type K,V
• Action output type K,V
• Count: a small integer
• Output at most count key-values
• those with the lowest keys
• requires type K be ordered
29
47deg.com © Copyright 2017 47 Degrees
Join Action
• Two inputs: K1,V1 and K2,V2
• Two key value stores
• Output types KOUT and VOUT
• Two mapping functions: K1=>K K2=>K (many to one)
• An operation
• Applied to each member of the product of KV pairs
from the two key stores with the same K value
• (K1,V1,K2,V2) => Set[(KOUT,VOUT)]
30
47deg.com © Copyright 2017 47 Degrees
Viewer
31
LambdaFlow
Remote Actor
FlowView
Vaadin
Web BrowserTweets
47deg.com © Copyright 2017 47 Degrees
Windowing Example
• Start up Vaadin viewer and web browser
• Run it (demo.TwitterFlow)
• Look at code (TwitterFlow.scala)
32
Index and Query
Example
33
47deg.com © Copyright 2017 47 Degrees
Index and Query Example
• Input data: Breweries
• look at breweries.data
• Build indexes
• set of breweries at a location (State/Country)
• set of breweries with a key word (in its description)
• use jline3 command hander
34
47deg.com © Copyright 2017 47 Degrees
Index Example
35
Breweries
Reduce
Names Places Words
Map FlatMap
Reduce
47deg.com © Copyright 2017 47 Degrees
Query
• words:Sink[String,Set[Int]]
• words.get(word) => Future[Option[Set[Id]]]
• breweries:Source[Int,String] : id->JsonString
• def name(json:String)=>name (extracts the brewery
name)
• breweries.get(id,name) => Future[Option[String]]
36
Graph Example
37
47deg.com © Copyright 2017 47 Degrees
Input Data:A Directed Graph
38
A
B
C
D
E
F
47deg.com © Copyright 2017 47 Degrees
Graph Example
• Note: there are two graphs
• The input data
• The graph of actions
• Output
• Number of distinct paths between two nodes
• Set of all cycles
• Loop in action graph for transitive closure
• Like recursive function
• Functional semantics is fixed point of loop
39
47deg.com © Copyright 2017 47 Degrees
Graph Transitive Closure
• Given
• route C -> E -> F
• link A -> C
• Form product (Common key = C)
• route C -> E -> F (routes starting at C)
• flipped link C -> A (links ending at C)
• Result
• route A -> C -> E -> F (goes back around loop!)
40
47deg.com © Copyright 2017 47 Degrees
Graph Example
41
Edges
Map
toPath
CyclesRoutes
Join
Link
Map
Route
Map
Invert
Filter
Cyles
Reduce
Count
47deg.com © Copyright 2017 47 Degrees
Graph Example
• Start Vaadin viewer and browser window
• Run example (demo.GraphCycle)
• showCycles
• Look at code
42
47deg.com © Copyright 2017 47 Degrees
Modified Graph
43
A
B
C
D
E
F
47deg.com © Copyright 2017 47 Degrees
Modify Graph
• set F A
• look at browser
• showCycles
• delete F A
• look at browser
• showCycles
44
Temperatures
45
47deg.com © Copyright 2017 47 Degrees
Temperature Grid
46
T1 T2 T3
T4 0,0 1,0 2,0 T7
T5 0,1 1,1 2,1 T8
T6 0,2 1,2 2,2 T9
T10 T11 T12
47deg.com © Copyright 2017 47 Degrees
Computation
47
U
L (U+D+L+R) / 4 R
D
47deg.com © Copyright 2017 47 Degrees
Temp Example
48
Edges
Temps
Map
FlatMap
1 => 4
Map
Reduce
4 => 1
Map
47deg.com © Copyright 2017 47 Degrees
Temperature Result
49
30 20 10
50 35 27 27 50
40 34 27 21 10
30 33 27 20 10
40 30 20
47deg.com © Copyright 2017 47 Degrees
Temperature Change
50
30 20 10
50/10 35/24 27/25 27/28 50
40 34/32 27/29 21/27 10
30 33/34 27/33 20/40 10/80
40 30 20
Page Rank
51
47deg.com © Copyright 2017 47 Degrees
Page Rank Data
52
A B
C
D
E
F
47deg.com © Copyright 2017 47 Degrees
Page Rank Example
53
Edges
Reduce
Rank
Join
Invert
Map
Initial Val
FlatMap
Map
Bias
Reduce
Join
Div by Cnt
Reduce
Sum
Map
Reduce
Select
47deg.com © Copyright 2017 47 Degrees
Page Rank Result
54
1.4 .60
.88
.28
.75
.47
Questions
55
47deg.com © Copyright 2017 47 Degrees
LambdaFlow and Kafka Common Properties
• JVM based
• Integrate with Kafka topics
• Key-value based
• One message at a time
• Operations: map, reduce, …
• Scalable and fault tolerant
• Open source
56
47deg.com © Copyright 2017 47 Degrees
LambdaFlow versus Kafka
57
LambdaFlow Kafka
Akka Cluster Zookeeper
Scala Java
Set/Delete Set
Functional Imperative

More Related Content

What's hot

Geant4 physics validation on the GRID
Geant4 physics validation on the GRIDGeant4 physics validation on the GRID
Geant4 physics validation on the GRIDGeorge Lestaris
 
Building Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreBuilding Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreLevi Fuller
 
Soap UI - Lesson45
Soap UI - Lesson45Soap UI - Lesson45
Soap UI - Lesson45Qualitest
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform ResearchVasil Remeniuk
 
The essential tools for test code quality improvement latest
The essential tools for test code quality improvement   latestThe essential tools for test code quality improvement   latest
The essential tools for test code quality improvement latestSergey Korol
 
Whats new in .NET for 2019
Whats new in .NET for 2019Whats new in .NET for 2019
Whats new in .NET for 2019Rory Preddy
 
Setting Up CircleCI Workflows for Your Salesforce Apps
Setting Up CircleCI Workflows for Your Salesforce AppsSetting Up CircleCI Workflows for Your Salesforce Apps
Setting Up CircleCI Workflows for Your Salesforce AppsDaniel Stange
 
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSOPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSMonica Beckwith
 
Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Michal Grman
 
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...COMAQA.BY
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineEduardo Piairo
 
Legacy Dependency Killer - Utah Code Camp 2014
Legacy Dependency Killer - Utah Code Camp 2014Legacy Dependency Killer - Utah Code Camp 2014
Legacy Dependency Killer - Utah Code Camp 2014dubmun
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to MasterC. M. Abdullah Khan
 
Coordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud ContractCoordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud ContractOmri Spector
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citruschristophd
 
Coscup 2013 : Continuous Integration on top of hadoop
Coscup 2013 : Continuous Integration on top of hadoopCoscup 2013 : Continuous Integration on top of hadoop
Coscup 2013 : Continuous Integration on top of hadoopWisely chen
 

What's hot (20)

Load test REST APIs using gatling
Load test REST APIs using gatlingLoad test REST APIs using gatling
Load test REST APIs using gatling
 
Geant4 physics validation on the GRID
Geant4 physics validation on the GRIDGeant4 physics validation on the GRID
Geant4 physics validation on the GRID
 
Building Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreBuilding Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET Core
 
Asynchronous apex
Asynchronous apexAsynchronous apex
Asynchronous apex
 
Soap UI - Lesson45
Soap UI - Lesson45Soap UI - Lesson45
Soap UI - Lesson45
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
The essential tools for test code quality improvement latest
The essential tools for test code quality improvement   latestThe essential tools for test code quality improvement   latest
The essential tools for test code quality improvement latest
 
Whats new in .NET for 2019
Whats new in .NET for 2019Whats new in .NET for 2019
Whats new in .NET for 2019
 
Setting Up CircleCI Workflows for Your Salesforce Apps
Setting Up CircleCI Workflows for Your Salesforce AppsSetting Up CircleCI Workflows for Your Salesforce Apps
Setting Up CircleCI Workflows for Your Salesforce Apps
 
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSOPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
 
Testing your code
Testing your codeTesting your code
Testing your code
 
Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)
 
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
 
Gatling
Gatling Gatling
Gatling
 
Legacy Dependency Killer - Utah Code Camp 2014
Legacy Dependency Killer - Utah Code Camp 2014Legacy Dependency Killer - Utah Code Camp 2014
Legacy Dependency Killer - Utah Code Camp 2014
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to Master
 
Coordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud ContractCoordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud Contract
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citrus
 
Coscup 2013 : Continuous Integration on top of hadoop
Coscup 2013 : Continuous Integration on top of hadoopCoscup 2013 : Continuous Integration on top of hadoop
Coscup 2013 : Continuous Integration on top of hadoop
 

Similar to LambdaFlow: Scala Functional Message Processing

Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!Autodesk
 
Introduction no sql solutions with couchbase and .net core
Introduction no sql solutions with couchbase and .net coreIntroduction no sql solutions with couchbase and .net core
Introduction no sql solutions with couchbase and .net coreBaris Ceviz
 
Technical Debt - SOTR14 - Clarkie
Technical Debt -  SOTR14 - ClarkieTechnical Debt -  SOTR14 - Clarkie
Technical Debt - SOTR14 - ClarkieAndrew Clarke
 
Cincom Roadmap ESUG2014
Cincom Roadmap ESUG2014Cincom Roadmap ESUG2014
Cincom Roadmap ESUG2014ESUG
 
LA Ember.js Meetup, Jan 2017
LA Ember.js Meetup, Jan 2017LA Ember.js Meetup, Jan 2017
LA Ember.js Meetup, Jan 2017Matthew Beale
 
Introducing Neo4j 3.0
Introducing Neo4j 3.0Introducing Neo4j 3.0
Introducing Neo4j 3.0Neo4j
 
Reaching State Zero Without Losing Your Versions
Reaching State Zero Without Losing Your VersionsReaching State Zero Without Losing Your Versions
Reaching State Zero Without Losing Your VersionsSSP Innovations
 
SBS5411_1819_02_basics.pdf
SBS5411_1819_02_basics.pdfSBS5411_1819_02_basics.pdf
SBS5411_1819_02_basics.pdfssuser91d50e
 
Spring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudSpring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudOrkhan Gasimov
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
Revit 2017 Whats New Webcast 5-26-2016
Revit 2017 Whats New Webcast 5-26-2016Revit 2017 Whats New Webcast 5-26-2016
Revit 2017 Whats New Webcast 5-26-2016Wendy Finch
 
Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginDaniel Spilker
 
JUC Europe 2015: Configuration as Code: The Job DSL Plugin
JUC Europe 2015: Configuration as Code: The Job DSL PluginJUC Europe 2015: Configuration as Code: The Job DSL Plugin
JUC Europe 2015: Configuration as Code: The Job DSL PluginCloudBees
 
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Dan Halperin
 
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022HostedbyConfluent
 
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...HostedbyConfluent
 

Similar to LambdaFlow: Scala Functional Message Processing (20)

Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!
 
Introduction no sql solutions with couchbase and .net core
Introduction no sql solutions with couchbase and .net coreIntroduction no sql solutions with couchbase and .net core
Introduction no sql solutions with couchbase and .net core
 
Blockchain and UDFs
Blockchain and UDFsBlockchain and UDFs
Blockchain and UDFs
 
Sitecore MVC Advanced
Sitecore MVC AdvancedSitecore MVC Advanced
Sitecore MVC Advanced
 
Technical Debt - SOTR14 - Clarkie
Technical Debt -  SOTR14 - ClarkieTechnical Debt -  SOTR14 - Clarkie
Technical Debt - SOTR14 - Clarkie
 
ch11_031102.ppt
ch11_031102.pptch11_031102.ppt
ch11_031102.ppt
 
Cincom Roadmap ESUG2014
Cincom Roadmap ESUG2014Cincom Roadmap ESUG2014
Cincom Roadmap ESUG2014
 
LA Ember.js Meetup, Jan 2017
LA Ember.js Meetup, Jan 2017LA Ember.js Meetup, Jan 2017
LA Ember.js Meetup, Jan 2017
 
Introducing Neo4j 3.0
Introducing Neo4j 3.0Introducing Neo4j 3.0
Introducing Neo4j 3.0
 
Reaching State Zero Without Losing Your Versions
Reaching State Zero Without Losing Your VersionsReaching State Zero Without Losing Your Versions
Reaching State Zero Without Losing Your Versions
 
SBS5411_1819_02_basics.pdf
SBS5411_1819_02_basics.pdfSBS5411_1819_02_basics.pdf
SBS5411_1819_02_basics.pdf
 
Leveraging ArcGIS Online for Public Utility Data
Leveraging ArcGIS Online for Public Utility DataLeveraging ArcGIS Online for Public Utility Data
Leveraging ArcGIS Online for Public Utility Data
 
Spring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudSpring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloud
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Revit 2017 Whats New Webcast 5-26-2016
Revit 2017 Whats New Webcast 5-26-2016Revit 2017 Whats New Webcast 5-26-2016
Revit 2017 Whats New Webcast 5-26-2016
 
Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL Plugin
 
JUC Europe 2015: Configuration as Code: The Job DSL Plugin
JUC Europe 2015: Configuration as Code: The Job DSL PluginJUC Europe 2015: Configuration as Code: The Job DSL Plugin
JUC Europe 2015: Configuration as Code: The Job DSL Plugin
 
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
 
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022
Schema Registry 101 with Bill Bejeck | Kafka Summit London 2022
 
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streamin...
 

More from John Nestor

Type Checking Scala Spark Datasets: Dataset Transforms
Type Checking Scala Spark Datasets: Dataset TransformsType Checking Scala Spark Datasets: Dataset Transforms
Type Checking Scala Spark Datasets: Dataset TransformsJohn Nestor
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patternsJohn Nestor
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaJohn Nestor
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataJohn Nestor
 
Scala Json Features and Performance
Scala Json Features and PerformanceScala Json Features and Performance
Scala Json Features and PerformanceJohn Nestor
 

More from John Nestor (6)

Type Checking Scala Spark Datasets: Dataset Transforms
Type Checking Scala Spark Datasets: Dataset TransformsType Checking Scala Spark Datasets: Dataset Transforms
Type Checking Scala Spark Datasets: Dataset Transforms
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big Data
 
Scala Json Features and Performance
Scala Json Features and PerformanceScala Json Features and Performance
Scala Json Features and Performance
 
Neutronium
NeutroniumNeutronium
Neutronium
 

Recently uploaded

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 

Recently uploaded (20)

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 

LambdaFlow: Scala Functional Message Processing

  • 1. Scala Functional Message Processing: LambdaFlow John Nestor 47 Degrees www.47deg.com https://github.com/47deg/LambdaFlow May 9, 2017 147deg.com
  • 2. 47deg.com © Copyright 2017 47 Degrees Outline • Introduction • Examples • Simple • Windowing • Indexing and Query • Graph • Temperature • Page Rank • Questions 2
  • 4. 47deg.com © Copyright 2017 47 Degrees Inspiration • Wanted to build a reactive system using Akka clustering • Don’t like Spark micro-batching, want message at a time • Want a Scala functional DSL, like the Spark Scala DSL 4
  • 5. 47deg.com © Copyright 2017 47 Degrees LambdaFlow • Near-real-time message processing • Message at a time • Both set (create or update) and delete • Written in Scala and Akka • Two parts: • Functional DSL • Akka Cluster reactive implementation 5
  • 6. 47deg.com © Copyright 2017 47 Degrees LambdaFlow Use Cases • * Near real time streaming with infinite stream • Finite streams • Batch processing • Input and outputs via • files • API • Kafka • … 6
  • 7. 47deg.com © Copyright 2017 47 Degrees Possible Use Case 7 LambdaFlow ... Kafka In 1 Kafka In 2 Kafka In M Kafka Out N Kafka Out 2 Kafka Out 1 ...
  • 8. 47deg.com © Copyright 2017 47 Degrees Functional DSL • Directed graph • Strongly typed • Graph nodes are actions • Graph arcs are paths for message passing • Graph can contain cycles 8
  • 9. 47deg.com © Copyright 2017 47 Degrees Key-Value Model • (most) Actions contain an in-memory Key-Value HashMap[K,V] • Two messages • Set/Update Key:k1 to Value:v1 • Delete Key-Value pair for Key:k1 9
  • 10. 47deg.com © Copyright 2017 47 Degrees Combining Actions • Most actions have • Input: used to set or delete keys in KV store • Output: used to set or delete keys on next action • Operation: maps KV of this action to KV of next action 10
  • 11. 47deg.com © Copyright 2017 47 Degrees Functional Eventual Consistency • Two Actions A1[K1,V1] and A2[K2,V2] • Each have a KV store: A1.kv[K1,V1] and A2.kv[K2,V2] • the output of A1 is the input to A2 • A1 has an operation A1.f that maps 
 [K1,V1] => Set([K2,V2]) • If all changes to A1 are stopped, eventually • A2.kv = A1.kv.flatMap(A1.f) 11
  • 12. 47deg.com © Copyright 2017 47 Degrees Incremental Operation • Suppose an action has k1->v1 and we now set k1->v2 • To update the next action • Undo the effect of k1->v1 • Do the effect of k1->v2 12
  • 13. 47deg.com © Copyright 2017 47 Degrees Incremental Operation Example • Suppose action KV type is String=>String • If we change “A”->”B” to “A”->”C” • Operation example 1 (map): (k,v)=>(k+v,v+v) • Delete “AB”->”BB” • Set “AC”=> “CC” • Operation example 2(mapvalue): (k,v) => (k,v+v) • Delete “A” -> “BB” (not needed here) • Set “A” -> “CC” 13
  • 14. 47deg.com © Copyright 2017 47 Degrees Implementations • Class based • Uses method calls rather than actor messages • Local Akka Actor based • Akka Cluster Based • Multinode • Reactive: scalable, responsive, fault-tolerant 14
  • 16. 47deg.com © Copyright 2017 47 Degrees Simple Example • Input data: • 8328 Tweets • Look at input data (capture.json) • Count number of tweets in each language • Use method calls between actions 16
  • 17. 47deg.com © Copyright 2017 47 Degrees Simple Example 17 (Lang,UID) => () Src Sink Reduce Sum Per Lang Lang => Count Map UID => Lang
  • 18. 47deg.com © Copyright 2017 47 Degrees Simple Example Code val src = Source[String, String]("src")
 val counts = Sink[String, Long]("counts")
 
 val f1 = src
 .map("map",(uid,lang)=>((uid,lang),()))
 .reduce("red", _._2, (k, v) => 1L, LongSum)
 .sink(counts)
 
 run(f1) 18
  • 19. 47deg.com © Copyright 2017 47 Degrees Source and Sink Actions • Source[K,V] • gets input from outside the graph (e.g. Kafka) • outputs to other actions • Sink[K,V] • gets it input from other actions • outputs to outside the graph (e.g. Kafka) 19
  • 20. 47deg.com © Copyright 2017 47 Degrees Map Operation • Action input type K,V • Action output type KOUT,VOUT • Action function type: (K,V)=>(KOUT,VOUT) 20
  • 21. 47deg.com © Copyright 2017 47 Degrees Reduce Operation • Action input type K,V • Action output type KOUT,VOUT • Grouping function type: K=>KOUT (many to one) • Value function type: (K,V)=>VOUT • Reduce operation type (VOUT,VOUT)=>VOUT • commutative, associative and inverse (abelian group) 21
  • 22. 47deg.com © Copyright 2017 47 Degrees Simple Example • Run it (demo.simple) • Look at code (Simple.scala) 22
  • 24. 47deg.com © Copyright 2017 47 Degrees Windowing Example • Streaming Data • 1000 Tweets • sent in at ~20 per second • each tweet expires after 20 seconds • Count languages and find 20 most common words • Uses local actor implementation • Uses Vaadin based visualization tool 24
  • 25. 47deg.com © Copyright 2017 47 Degrees Windowing Example 25 Lang Count Reduce Txt Total Percent Words Join Map FlatMap MapReduce Reduce First Map
  • 26. 47deg.com © Copyright 2017 47 Degrees Windowing Example Code val f1 = src
 .reduce("red", _._1, (k, v) => 1L, LongSum)
 .to(counts1, counts2)
 .sink(counts)
 
 val f2 = counts1
 .reduce("red1", _ => List.empty[String], (k, v) => v, LongSum)
 .map[String, Long]("map1", (k, v) => ("total", v))
 .to(total1)
 .sink(total)
 
 val f3 = counts2
 .join[String, Long, Unit, String, String]("product", total1, (s:String)=>(), (s:String)=>()) {
 case (lang, count, t, total) => Set((lang, f"${count * 100 / total}%02d$PERCENT"))
 }
 .sink(percent)
 
 val f4 = text
 .flatMap("GetWords", (k, v) => {
 val (text, uuid) = k
 getWords(text)
 .zipWithIndex
 .map {
 case (word, i) => ((word, uuid, i), ())
 }
 .toSet
 })
 .map("CountOrder", (word, count) => ((-count, word), ()))
 .first("first", 20)
 .map("CountOrder1", (k, v) => (k._2, f"${-k._1}%4d"))
 .sink(words) run(f1, f2, f3, f4) 26
  • 27. 47deg.com © Copyright 2017 47 Degrees Labels,To and From • Label[K,V]: used to connect an action output to another action input • .to[K,V]: send one input to multiple outputs (broadcast) • .from[K,V]: combine multiple inputs to a single output (union) 27
  • 28. 47deg.com © Copyright 2017 47 Degrees FlatMap Action • Action input type K,V • Action output type KOUT,VOUT • Action function type: (K,V)=>Set[(KOUT,VOUT)] 28
  • 29. 47deg.com © Copyright 2017 47 Degrees First Action • Action input type K,V • Action output type K,V • Count: a small integer • Output at most count key-values • those with the lowest keys • requires type K be ordered 29
  • 30. 47deg.com © Copyright 2017 47 Degrees Join Action • Two inputs: K1,V1 and K2,V2 • Two key value stores • Output types KOUT and VOUT • Two mapping functions: K1=>K K2=>K (many to one) • An operation • Applied to each member of the product of KV pairs from the two key stores with the same K value • (K1,V1,K2,V2) => Set[(KOUT,VOUT)] 30
  • 31. 47deg.com © Copyright 2017 47 Degrees Viewer 31 LambdaFlow Remote Actor FlowView Vaadin Web BrowserTweets
  • 32. 47deg.com © Copyright 2017 47 Degrees Windowing Example • Start up Vaadin viewer and web browser • Run it (demo.TwitterFlow) • Look at code (TwitterFlow.scala) 32
  • 34. 47deg.com © Copyright 2017 47 Degrees Index and Query Example • Input data: Breweries • look at breweries.data • Build indexes • set of breweries at a location (State/Country) • set of breweries with a key word (in its description) • use jline3 command hander 34
  • 35. 47deg.com © Copyright 2017 47 Degrees Index Example 35 Breweries Reduce Names Places Words Map FlatMap Reduce
  • 36. 47deg.com © Copyright 2017 47 Degrees Query • words:Sink[String,Set[Int]] • words.get(word) => Future[Option[Set[Id]]] • breweries:Source[Int,String] : id->JsonString • def name(json:String)=>name (extracts the brewery name) • breweries.get(id,name) => Future[Option[String]] 36
  • 38. 47deg.com © Copyright 2017 47 Degrees Input Data:A Directed Graph 38 A B C D E F
  • 39. 47deg.com © Copyright 2017 47 Degrees Graph Example • Note: there are two graphs • The input data • The graph of actions • Output • Number of distinct paths between two nodes • Set of all cycles • Loop in action graph for transitive closure • Like recursive function • Functional semantics is fixed point of loop 39
  • 40. 47deg.com © Copyright 2017 47 Degrees Graph Transitive Closure • Given • route C -> E -> F • link A -> C • Form product (Common key = C) • route C -> E -> F (routes starting at C) • flipped link C -> A (links ending at C) • Result • route A -> C -> E -> F (goes back around loop!) 40
  • 41. 47deg.com © Copyright 2017 47 Degrees Graph Example 41 Edges Map toPath CyclesRoutes Join Link Map Route Map Invert Filter Cyles Reduce Count
  • 42. 47deg.com © Copyright 2017 47 Degrees Graph Example • Start Vaadin viewer and browser window • Run example (demo.GraphCycle) • showCycles • Look at code 42
  • 43. 47deg.com © Copyright 2017 47 Degrees Modified Graph 43 A B C D E F
  • 44. 47deg.com © Copyright 2017 47 Degrees Modify Graph • set F A • look at browser • showCycles • delete F A • look at browser • showCycles 44
  • 46. 47deg.com © Copyright 2017 47 Degrees Temperature Grid 46 T1 T2 T3 T4 0,0 1,0 2,0 T7 T5 0,1 1,1 2,1 T8 T6 0,2 1,2 2,2 T9 T10 T11 T12
  • 47. 47deg.com © Copyright 2017 47 Degrees Computation 47 U L (U+D+L+R) / 4 R D
  • 48. 47deg.com © Copyright 2017 47 Degrees Temp Example 48 Edges Temps Map FlatMap 1 => 4 Map Reduce 4 => 1 Map
  • 49. 47deg.com © Copyright 2017 47 Degrees Temperature Result 49 30 20 10 50 35 27 27 50 40 34 27 21 10 30 33 27 20 10 40 30 20
  • 50. 47deg.com © Copyright 2017 47 Degrees Temperature Change 50 30 20 10 50/10 35/24 27/25 27/28 50 40 34/32 27/29 21/27 10 30 33/34 27/33 20/40 10/80 40 30 20
  • 52. 47deg.com © Copyright 2017 47 Degrees Page Rank Data 52 A B C D E F
  • 53. 47deg.com © Copyright 2017 47 Degrees Page Rank Example 53 Edges Reduce Rank Join Invert Map Initial Val FlatMap Map Bias Reduce Join Div by Cnt Reduce Sum Map Reduce Select
  • 54. 47deg.com © Copyright 2017 47 Degrees Page Rank Result 54 1.4 .60 .88 .28 .75 .47
  • 56. 47deg.com © Copyright 2017 47 Degrees LambdaFlow and Kafka Common Properties • JVM based • Integrate with Kafka topics • Key-value based • One message at a time • Operations: map, reduce, … • Scalable and fault tolerant • Open source 56
  • 57. 47deg.com © Copyright 2017 47 Degrees LambdaFlow versus Kafka 57 LambdaFlow Kafka Akka Cluster Zookeeper Scala Java Set/Delete Set Functional Imperative