SlideShare a Scribd company logo
1 of 20
PRESENTED BY
Developing and Deploying
Edge Analytics
David Rauschenbach
Nubix.io, CTO
PRESENTED BY
1 IoT and Edge Architectures
A brief overview of Enterprise Architectures with Cloud, Fog, and Edge components
2 Open Source Projects Used
A brief overview of the open source projects used in this demo and links to them
3 Demo: Streaming Data into Redis on Edge Devices
A stream of sensor data will be collected and stored in Redis on an edge device.
Agenda:
4 Demo: Running Spark on the Edge with Redis Integration
A simple analytic will be developed using Spark & Redis, deployed to the edge, and executed
PRESENTED BY
Device Edge
Casually connected
Edge Architectures
Fog
Commonly air-gapped
Server Edge
Tethered
PRESENTED BY
Why are Analytics Required at the Source of Data?
Because:
Sense, Infer, Act
“Return to the Edge” (2016)
by Peter Levine, Andreessen Horowitz
PRESENTED BY
Cloud and Device Edge: Two Worlds Under Pressure to Meet
Devices
•Under pressure to add intelligence and inference
•Which requires frequent updates (a tectonic shift for
the embedded world)
•Which requires best-of-breed cloud workflows like
aPaaS, IaaS, and Continuous Integration
Cloud
•Under pressure to realize the final 92% of Digital
Transformation, which hasn’t happened yet
because products live outside of datacenters
•Data Scientists don’t use desktop power supplies
and serial cables
•Don’t have tooling to program in 32k of RAM
PRESENTED BY
Open Source Projects We Are Going to Use
PRESENTED BY
• Use your favorite LuaRocks modules within Redis
• GitHub: github.com/BixData/lua-amalg-redis
• Blog: https://medium.com/nubix-open-source-edge-computing/introducing-the-
lua-amalgamator-for-redis-c498434c2154
Open Source #1: Lua Amalgamator for Redis
PRESENTED BY
PRESENTED BY
Moses: the Lodash / Underscore of the Lua ecosystem
Using Moses within Redis
$ luarocks install moses
$ vi main.lua
local moses = require 'moses'
local data = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
local sum = moses.reduce(data, function(r, n)
return r + n
end)
print(string.format('Sum of first %d primes is %d', #data, sum))
return sum
$ lua –lamalg-redis main.lua
Sum of first 10 primes is 129
$ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c
$ redis-cli --eval main-with-dependencies.lua 0,0
(integer) 129
PRESENTED BY
Open Source #2: Stuart
PRESENTED BY
Using Spark ML Vectors within Redis
$ luarocks install stuart-ml
$ vi main.lua
local BLAS = require 'stuart-ml.linalg.BLAS'
local Vectors = require 'stuart-ml.linalg.Vectors'
local a = Vectors.dense({1,2,3})
local b = Vectors.dense({4,-5,6})
local dotProduct = BLAS.dot(a, b)
local isAcuteAngle = dotProduct > 0
print(string.format('The dot product of [{1,2,3}, {4,-5,6}] is %d, which %s an acute angle',
dotProduct, isAcuteAngle and 'is' or 'is not'))
return dotProduct
$ lua –lamalg-redis main.lua
The dot product of [{1,2,3}, {4,-5,6}] is 12, which is an acute angle
$ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c
$ redis-cli --eval main-with-dependencies.lua 0,0
(integer) 12
PRESENTED BY
Using Spark ML Matrices within Redis
$ vi main.lua
local Matrices = require 'stuart-ml.linalg.Matrices'
local matrix = Matrices.sparse(3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0})
local msg = string.format('The sparse matrix %s has %d non-zeros and %d actives',
'(3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0})',
matrix:numNonzeros(),
matrix:numActives())
print(msg)
return msg
$ lua –lamalg-redis main.lua
The sparse matrix (3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0}) has 1 non-zeros and 3 actives
$ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c
$ redis-cli --eval main-with-dependencies.lua 0,0
"The sparse matrix (3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0}) has 1 non-zeros and 3 actives"
PRESENTED BY
Using Spark ML K-means Clustering within Redis
$ vi main.lua
local KMeans = require 'stuart-ml.clustering.KMeans'
local Vectors = require 'stuart-ml.linalg.Vectors'
local VectorWithNorm = require 'stuart-ml.clustering.VectorWithNorm'
local centers = {
VectorWithNorm.new(Vectors.dense(1,2,6)),
VectorWithNorm.new(Vectors.dense(5,3,9)),
VectorWithNorm.new(Vectors.dense(9,4,7))
}
local point = VectorWithNorm.new(Vectors.dense(6,2,5))
local bestIndex, bestDistance = KMeans.findClosest(centers, point)
local msg = string.format('The point %s is closest to cluster center #%d, with a distance of %d',
tostring(point), bestIndex, bestDistance)
print(msg)
return msg
$ lua –lamalg-redis main.lua
The point ((6,2,5),8.0622577482985) is closest to cluster center #3, with a distance of 17
$ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c
$ redis-cli --eval main-with-dependencies.lua 0,0
"The point ((6,2,5),8.0622577482985) is closest to cluster center #3, with a distance of 17"
PRESENTED BY
Open Source #3: Stuart-Redis
PRESENTED BY
Reading+Writing Spark RDDs within Redis$ luarocks install stuart-redis
$ vi main.lua
local stuart = require 'stuart'
local stuartRedis = require 'stuart-redis'
local function split(str, pattern)
local res = {}
for s in string.gmatch(str, pattern) do table.insert(res, s) end
return res
end
local sc = stuart.NewContext()
sc = stuartRedis.export(sc)
-- writing
local doc = [[I mean, think about music. Music is all about repetition and patterns.
If you didn’t have repetition in music, it would all just be noise.]]
local words = sc:parallelize(split(doc, '%w+'))
local wordCountsRDD = words
:map(function(word) return {string.lower(word), 1} end)
:reduceByKey(function(r, x) return r+x end)
:map(function(e) return {e[1], e[2]} end)
sc:toRedisZSET(wordCountsRDD, 'wordCounts')
-- reading
local wordFrequencies = sc:fromRedisZSetWithScore('wordCounts')
:map(function(e) return e[1] .. '=' .. e[2] end)
:collect()
local msg = table.concat(wordFrequencies, ', ')
print(msg)
return msg
PRESENTED BY
Reading+Writing Spark RDDs within Redis (continued)
$ redis-cli
monitor
1554135760.154290 [0 127.0.0.1:64608] "EVAL" ”(5,300 lines, 177k not shown)"
1554136904.716402 [0 lua] "ZADD" "wordCounts" "1" "it"
1554136904.716415 [0 lua] "ZADD" "wordCounts" "1" "didn"
1554136904.716420 [0 lua] "ZADD" "wordCounts" "1" "mean"
1554136904.716425 [0 lua] "ZADD" "wordCounts" "1" "is"
1554136904.716429 [0 lua] "ZADD" "wordCounts" "2" "repetition"
1554136904.716435 [0 lua] "ZADD" "wordCounts" "1" "i"
1554136904.716439 [0 lua] "ZADD" "wordCounts" "1" "think"
1554136904.716444 [0 lua] "ZADD" "wordCounts" "1" "would"
1554136904.716449 [0 lua] "ZADD" "wordCounts" "1" "noise"
1554136904.716453 [0 lua] "ZADD" "wordCounts" "1" "just"
1554136904.716458 [0 lua] "ZADD" "wordCounts" "1" "t"
1554136904.716463 [0 lua] "ZADD" "wordCounts" "1" "if"
1554136904.716467 [0 lua] "ZADD" "wordCounts" "1" "you"
1554136904.716472 [0 lua] "ZADD" "wordCounts" "1" "in"
1554136904.716506 [0 lua] "ZADD" "wordCounts" "1" "patterns"
1554136904.716511 [0 lua] "ZADD" "wordCounts" "1" "be"
1554136904.716515 [0 lua] "ZADD" "wordCounts" "1" "have"
1554136904.716520 [0 lua] "ZADD" "wordCounts" "2" "about"
1554136904.716525 [0 lua] "ZADD" "wordCounts" "2" "all"
1554136904.716530 [0 lua] "ZADD" "wordCounts" "1" "and"
1554136904.716534 [0 lua] "ZADD" "wordCounts" "3" "music"
1554136904.716541 [0 lua] "KEYS" "wordCounts"
1554136904.716846 [0 lua] "TYPE" "wordCounts"
1554136904.717252 [0 lua] "ZRANGE" "wordCounts" "0" "-1" "WITHSCORES"
$ lua –lamalg-redis main.lua
and=1, be=1, didn=1, have=1, i=1, if=1,
in=1, is=1, it=1, just=1, mean=1,
noise=1, patterns=1, t=1, think=1,
would=1, you=1, about=2, all=2,
repetition=2, music=3
(… manual edits to amalg.cache …)
$ amalg-redis.lua –s main.lua –o main-
with-dependencies.lua –c
$ redis-cli --eval main-with-
dependencies.lua 0,0
"and=1, be=1, didn=1, have=1, i=1, if=1,
in=1, is=1, it=1, just=1, mean=1,
noise=1, patterns=1, t=1, think=1,
would=1, you=1, about=2, all=2,
repetition=2, music=3"
PRESENTED BY
Hardware
• Raspberry Pi 3 B+
• BME280 Atmospheric Sensor
• I²C Communication Bus (shown in
orange+yellow)
Software
• Raspbian OS
• Redis 5.0
• Nubix Agent
DEMO 1: Streaming Data into Redis on an Edge Device
PRESENTED BY
Hardware
• Raspberry Pi 3 B+
• BME280 Atmospheric Sensor
• I²C Communication Bus (shown in
orange+yellow)
Software
•Redis 5.0 (unmodified, no
plugins)
• Lua submitted via standard
redis-cli
DEMO 2: Spark Analytics within Redis on Edge Device
Thank you!
Code examples available at:
https://github.com/BixData/redisconf19
PRESENTED BY

More Related Content

What's hot

Wrapper Generation Supervised by a Noisy Crowd
Wrapper Generation Supervised by a Noisy CrowdWrapper Generation Supervised by a Noisy Crowd
Wrapper Generation Supervised by a Noisy CrowdDisheng Qiu
 
From grep to BERT
From grep to BERTFrom grep to BERT
From grep to BERTQAware GmbH
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDB
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDBPuppet Camp Melbourne 2014: Node Collaboration with PuppetDB
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDBPuppet
 
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)Alexey Zinoviev
 
Kafka pours and Spark resolves
Kafka pours and Spark resolvesKafka pours and Spark resolves
Kafka pours and Spark resolvesAlexey Zinoviev
 
Dynomite at Erlang Factory
Dynomite at Erlang FactoryDynomite at Erlang Factory
Dynomite at Erlang Factorymoonpolysoft
 
Top k string similarity search
Top k string similarity searchTop k string similarity search
Top k string similarity searchChiao-Meng Huang
 
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...James Salter
 
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013Amazon Web Services
 
Scala Meetup Hamburg - Spark
Scala Meetup Hamburg - SparkScala Meetup Hamburg - Spark
Scala Meetup Hamburg - SparkIvan Morozov
 
Advanced data modeling with apache cassandra
Advanced data modeling with apache cassandraAdvanced data modeling with apache cassandra
Advanced data modeling with apache cassandraPatrick McFadin
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Holden Karau
 
Wuala, P2P Online Storage
Wuala, P2P Online StorageWuala, P2P Online Storage
Wuala, P2P Online Storageadunne
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Databricks
 
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...Luke Young
 
A Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraA Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraDataStax Academy
 

What's hot (20)

Wrapper Generation Supervised by a Noisy Crowd
Wrapper Generation Supervised by a Noisy CrowdWrapper Generation Supervised by a Noisy Crowd
Wrapper Generation Supervised by a Noisy Crowd
 
From grep to BERT
From grep to BERTFrom grep to BERT
From grep to BERT
 
Ccna exam paper
Ccna exam paperCcna exam paper
Ccna exam paper
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDB
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDBPuppet Camp Melbourne 2014: Node Collaboration with PuppetDB
Puppet Camp Melbourne 2014: Node Collaboration with PuppetDB
 
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)
Joker'16 Spark 2 (API changes; Structured Streaming; Encoders)
 
Kafka pours and Spark resolves
Kafka pours and Spark resolvesKafka pours and Spark resolves
Kafka pours and Spark resolves
 
Dynomite at Erlang Factory
Dynomite at Erlang FactoryDynomite at Erlang Factory
Dynomite at Erlang Factory
 
Top k string similarity search
Top k string similarity searchTop k string similarity search
Top k string similarity search
 
Python database interfaces
Python database  interfacesPython database  interfaces
Python database interfaces
 
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...
An Efficient Reactive Model for Resource Discovery in DHT-Based Peer-to-Peer ...
 
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013
DDoS Resiliency with Amazon Web Services (SEC305) | AWS re:Invent 2013
 
Scala Meetup Hamburg - Spark
Scala Meetup Hamburg - SparkScala Meetup Hamburg - Spark
Scala Meetup Hamburg - Spark
 
Dynomite Nosql
Dynomite NosqlDynomite Nosql
Dynomite Nosql
 
Advanced data modeling with apache cassandra
Advanced data modeling with apache cassandraAdvanced data modeling with apache cassandra
Advanced data modeling with apache cassandra
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014
 
Wuala, P2P Online Storage
Wuala, P2P Online StorageWuala, P2P Online Storage
Wuala, P2P Online Storage
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
 
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...
There's no place like 127.0.0.1 - Achieving "reliable" DNS rebinding in moder...
 
A Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraA Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache Cassandra
 

Similar to Developing and Deploying Edge Analytics with Redis

Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...
Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...
Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...StampedeCon
 
The Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable CodeBaidu, Inc.
 
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...DataStax Academy
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciencesalexstorer
 
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterpriseA Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterprisePatrick McFadin
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Nomad Multi-Cloud
Nomad Multi-CloudNomad Multi-Cloud
Nomad Multi-CloudNic Jackson
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)fridolin.wild
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeWim Godden
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013Randall Hunt
 
Introduction to Spark with Scala
Introduction to Spark with ScalaIntroduction to Spark with Scala
Introduction to Spark with ScalaHimanshu Gupta
 
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...MongoDB
 
Unlocking Your Hadoop Data with Apache Spark and CDH5
Unlocking Your Hadoop Data with Apache Spark and CDH5Unlocking Your Hadoop Data with Apache Spark and CDH5
Unlocking Your Hadoop Data with Apache Spark and CDH5SAP Concur
 
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...MongoDB
 
Akka Cluster in Production
Akka Cluster in ProductionAkka Cluster in Production
Akka Cluster in Productionbilyushonak
 
Living the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonLiving the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonParis Container Day
 

Similar to Developing and Deploying Edge Analytics with Redis (20)

Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...
Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...
Beyond the Query – Bringing Complex Access Patterns to NoSQL with DataStax - ...
 
The Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable Code
 
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
 
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterpriseA Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
 
Deathstar
DeathstarDeathstar
Deathstar
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Nomad Multi-Cloud
Nomad Multi-CloudNomad Multi-Cloud
Nomad Multi-Cloud
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013
 
Introduction to Spark with Scala
Introduction to Spark with ScalaIntroduction to Spark with Scala
Introduction to Spark with Scala
 
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
 
Unlocking Your Hadoop Data with Apache Spark and CDH5
Unlocking Your Hadoop Data with Apache Spark and CDH5Unlocking Your Hadoop Data with Apache Spark and CDH5
Unlocking Your Hadoop Data with Apache Spark and CDH5
 
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
 
Akka Cluster in Production
Akka Cluster in ProductionAkka Cluster in Production
Akka Cluster in Production
 
The Rust Borrow Checker
The Rust Borrow CheckerThe Rust Borrow Checker
The Rust Borrow Checker
 
Living the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonLiving the Nomadic life - Nic Jackson
Living the Nomadic life - Nic Jackson
 

Recently uploaded

Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 

Recently uploaded (20)

Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 

Developing and Deploying Edge Analytics with Redis

  • 1. PRESENTED BY Developing and Deploying Edge Analytics David Rauschenbach Nubix.io, CTO
  • 2. PRESENTED BY 1 IoT and Edge Architectures A brief overview of Enterprise Architectures with Cloud, Fog, and Edge components 2 Open Source Projects Used A brief overview of the open source projects used in this demo and links to them 3 Demo: Streaming Data into Redis on Edge Devices A stream of sensor data will be collected and stored in Redis on an edge device. Agenda: 4 Demo: Running Spark on the Edge with Redis Integration A simple analytic will be developed using Spark & Redis, deployed to the edge, and executed
  • 3. PRESENTED BY Device Edge Casually connected Edge Architectures Fog Commonly air-gapped Server Edge Tethered
  • 4. PRESENTED BY Why are Analytics Required at the Source of Data? Because: Sense, Infer, Act “Return to the Edge” (2016) by Peter Levine, Andreessen Horowitz
  • 5. PRESENTED BY Cloud and Device Edge: Two Worlds Under Pressure to Meet Devices •Under pressure to add intelligence and inference •Which requires frequent updates (a tectonic shift for the embedded world) •Which requires best-of-breed cloud workflows like aPaaS, IaaS, and Continuous Integration Cloud •Under pressure to realize the final 92% of Digital Transformation, which hasn’t happened yet because products live outside of datacenters •Data Scientists don’t use desktop power supplies and serial cables •Don’t have tooling to program in 32k of RAM
  • 6. PRESENTED BY Open Source Projects We Are Going to Use
  • 7. PRESENTED BY • Use your favorite LuaRocks modules within Redis • GitHub: github.com/BixData/lua-amalg-redis • Blog: https://medium.com/nubix-open-source-edge-computing/introducing-the- lua-amalgamator-for-redis-c498434c2154 Open Source #1: Lua Amalgamator for Redis
  • 9. PRESENTED BY Moses: the Lodash / Underscore of the Lua ecosystem Using Moses within Redis $ luarocks install moses $ vi main.lua local moses = require 'moses' local data = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29} local sum = moses.reduce(data, function(r, n) return r + n end) print(string.format('Sum of first %d primes is %d', #data, sum)) return sum $ lua –lamalg-redis main.lua Sum of first 10 primes is 129 $ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c $ redis-cli --eval main-with-dependencies.lua 0,0 (integer) 129
  • 11. PRESENTED BY Using Spark ML Vectors within Redis $ luarocks install stuart-ml $ vi main.lua local BLAS = require 'stuart-ml.linalg.BLAS' local Vectors = require 'stuart-ml.linalg.Vectors' local a = Vectors.dense({1,2,3}) local b = Vectors.dense({4,-5,6}) local dotProduct = BLAS.dot(a, b) local isAcuteAngle = dotProduct > 0 print(string.format('The dot product of [{1,2,3}, {4,-5,6}] is %d, which %s an acute angle', dotProduct, isAcuteAngle and 'is' or 'is not')) return dotProduct $ lua –lamalg-redis main.lua The dot product of [{1,2,3}, {4,-5,6}] is 12, which is an acute angle $ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c $ redis-cli --eval main-with-dependencies.lua 0,0 (integer) 12
  • 12. PRESENTED BY Using Spark ML Matrices within Redis $ vi main.lua local Matrices = require 'stuart-ml.linalg.Matrices' local matrix = Matrices.sparse(3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0}) local msg = string.format('The sparse matrix %s has %d non-zeros and %d actives', '(3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0})', matrix:numNonzeros(), matrix:numActives()) print(msg) return msg $ lua –lamalg-redis main.lua The sparse matrix (3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0}) has 1 non-zeros and 3 actives $ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c $ redis-cli --eval main-with-dependencies.lua 0,0 "The sparse matrix (3, 2, {0, 2, 3}, {0, 2, 1}, {0.0, -1.2, 0.0}) has 1 non-zeros and 3 actives"
  • 13. PRESENTED BY Using Spark ML K-means Clustering within Redis $ vi main.lua local KMeans = require 'stuart-ml.clustering.KMeans' local Vectors = require 'stuart-ml.linalg.Vectors' local VectorWithNorm = require 'stuart-ml.clustering.VectorWithNorm' local centers = { VectorWithNorm.new(Vectors.dense(1,2,6)), VectorWithNorm.new(Vectors.dense(5,3,9)), VectorWithNorm.new(Vectors.dense(9,4,7)) } local point = VectorWithNorm.new(Vectors.dense(6,2,5)) local bestIndex, bestDistance = KMeans.findClosest(centers, point) local msg = string.format('The point %s is closest to cluster center #%d, with a distance of %d', tostring(point), bestIndex, bestDistance) print(msg) return msg $ lua –lamalg-redis main.lua The point ((6,2,5),8.0622577482985) is closest to cluster center #3, with a distance of 17 $ amalg-redis.lua –s main.lua –o main-with-dependencies.lua –c $ redis-cli --eval main-with-dependencies.lua 0,0 "The point ((6,2,5),8.0622577482985) is closest to cluster center #3, with a distance of 17"
  • 14. PRESENTED BY Open Source #3: Stuart-Redis
  • 15. PRESENTED BY Reading+Writing Spark RDDs within Redis$ luarocks install stuart-redis $ vi main.lua local stuart = require 'stuart' local stuartRedis = require 'stuart-redis' local function split(str, pattern) local res = {} for s in string.gmatch(str, pattern) do table.insert(res, s) end return res end local sc = stuart.NewContext() sc = stuartRedis.export(sc) -- writing local doc = [[I mean, think about music. Music is all about repetition and patterns. If you didn’t have repetition in music, it would all just be noise.]] local words = sc:parallelize(split(doc, '%w+')) local wordCountsRDD = words :map(function(word) return {string.lower(word), 1} end) :reduceByKey(function(r, x) return r+x end) :map(function(e) return {e[1], e[2]} end) sc:toRedisZSET(wordCountsRDD, 'wordCounts') -- reading local wordFrequencies = sc:fromRedisZSetWithScore('wordCounts') :map(function(e) return e[1] .. '=' .. e[2] end) :collect() local msg = table.concat(wordFrequencies, ', ') print(msg) return msg
  • 16. PRESENTED BY Reading+Writing Spark RDDs within Redis (continued) $ redis-cli monitor 1554135760.154290 [0 127.0.0.1:64608] "EVAL" ”(5,300 lines, 177k not shown)" 1554136904.716402 [0 lua] "ZADD" "wordCounts" "1" "it" 1554136904.716415 [0 lua] "ZADD" "wordCounts" "1" "didn" 1554136904.716420 [0 lua] "ZADD" "wordCounts" "1" "mean" 1554136904.716425 [0 lua] "ZADD" "wordCounts" "1" "is" 1554136904.716429 [0 lua] "ZADD" "wordCounts" "2" "repetition" 1554136904.716435 [0 lua] "ZADD" "wordCounts" "1" "i" 1554136904.716439 [0 lua] "ZADD" "wordCounts" "1" "think" 1554136904.716444 [0 lua] "ZADD" "wordCounts" "1" "would" 1554136904.716449 [0 lua] "ZADD" "wordCounts" "1" "noise" 1554136904.716453 [0 lua] "ZADD" "wordCounts" "1" "just" 1554136904.716458 [0 lua] "ZADD" "wordCounts" "1" "t" 1554136904.716463 [0 lua] "ZADD" "wordCounts" "1" "if" 1554136904.716467 [0 lua] "ZADD" "wordCounts" "1" "you" 1554136904.716472 [0 lua] "ZADD" "wordCounts" "1" "in" 1554136904.716506 [0 lua] "ZADD" "wordCounts" "1" "patterns" 1554136904.716511 [0 lua] "ZADD" "wordCounts" "1" "be" 1554136904.716515 [0 lua] "ZADD" "wordCounts" "1" "have" 1554136904.716520 [0 lua] "ZADD" "wordCounts" "2" "about" 1554136904.716525 [0 lua] "ZADD" "wordCounts" "2" "all" 1554136904.716530 [0 lua] "ZADD" "wordCounts" "1" "and" 1554136904.716534 [0 lua] "ZADD" "wordCounts" "3" "music" 1554136904.716541 [0 lua] "KEYS" "wordCounts" 1554136904.716846 [0 lua] "TYPE" "wordCounts" 1554136904.717252 [0 lua] "ZRANGE" "wordCounts" "0" "-1" "WITHSCORES" $ lua –lamalg-redis main.lua and=1, be=1, didn=1, have=1, i=1, if=1, in=1, is=1, it=1, just=1, mean=1, noise=1, patterns=1, t=1, think=1, would=1, you=1, about=2, all=2, repetition=2, music=3 (… manual edits to amalg.cache …) $ amalg-redis.lua –s main.lua –o main- with-dependencies.lua –c $ redis-cli --eval main-with- dependencies.lua 0,0 "and=1, be=1, didn=1, have=1, i=1, if=1, in=1, is=1, it=1, just=1, mean=1, noise=1, patterns=1, t=1, think=1, would=1, you=1, about=2, all=2, repetition=2, music=3"
  • 17. PRESENTED BY Hardware • Raspberry Pi 3 B+ • BME280 Atmospheric Sensor • I²C Communication Bus (shown in orange+yellow) Software • Raspbian OS • Redis 5.0 • Nubix Agent DEMO 1: Streaming Data into Redis on an Edge Device
  • 18. PRESENTED BY Hardware • Raspberry Pi 3 B+ • BME280 Atmospheric Sensor • I²C Communication Bus (shown in orange+yellow) Software •Redis 5.0 (unmodified, no plugins) • Lua submitted via standard redis-cli DEMO 2: Spark Analytics within Redis on Edge Device
  • 19. Thank you! Code examples available at: https://github.com/BixData/redisconf19