SlideShare a Scribd company logo
Real-time personal trainer on
the SMACK stack



@honzam399 Jan Machacek 

@anirvan_c Anirvan Chakraborty 

© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Automated personal trainer - muvr
• Suggests the sequence of exercise sessions
• Suggests exercises in a session, including exercise
parameters (e.g. weight, repetitions, …)
• Provides tips on proper exercise form
• With additional hardware (smartwatch, smart clothes),
muvr provides
• Completely unobtrusive exercise experience
• More accurate tips on proper exercise form
• With over–fitting, it is usable for physiotherapy
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Architecture
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Privacy
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
The technologies—iOS
• Learns the users’ behaviour
• Exercise sessions
• Exercises within exercise session
• Short–term prediction of [scalar] labels for the exercises
• Performs the real–time analysis of the incoming sensor
data
• Advised by the expected behaviour
• Signal processing to compute repetitions / strokes
• Forward–propagation to label the exercise
• Submits all recorded sensor data and confirmed (!) labels
per session
• Handles offline / travel modes
• Synchronises the data across the user’s devices using iCloud
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
The technologies—Akka
• Reactive services for user profiles, model parameters,
and sensor data
• CQRS/ES implementation, which helps to
• Handle peaks in load
• Handle failures of individual nodes
• Reason about the scope of the mutable state we keep
• Uses Cassandra for its journal and snapshot stores
• The written values are binary “blobs”
• Writes the sensor data to Cassandra
• Writes the sensor data in “readable” form; it can be read outside the Akka / Scala
world
• Reads the model and exercise parameters from
Cassandra
• It selects the best / newest model parameters to serve to the mobile app
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
The technologies—Spark
• Distributed computation framework
• “Big data” tasks
• Integrates extremely well with Cassandra
• Reads and processes the profiles and sensor data
• Identifies clusters of users on their profile information
• Slices the sensor inputs by sensor types
• Writes the results to another store
• Runs in batches
• Executes by schedule (typically once a day)
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
The technologies—neon
• A machine learning framework, including
• “The usual” suspects in tensor algebra
• Signal processing
• Different ML approaches
• Training and evaluation programs
• Both programs terminate either upon discovering the perfect model or when their
budget is up
• Reads clustered training and testing data from the Spark job
• Writes the model parameters and evaluation result to Cassandra
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
The technologies—Cassandra
• Underpins the entire platform
• Journal and snapshot store for Akka
• Sensor data store
• Model parameter store
• “Summary” store
• High availability
• No single point of failure
• High read and write
• Replication factor
• Tuneable consistency level
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Spark & Cassandra
• Group the sensor data into n clusters by user profile with
biometric ID
• Expand the sensor data
• Slices of the sensor data by combinations of accelerometer, gyroscope, heart rate,
targeted muscle group strain gauges, …
• 1 user = 1 MiB from one sensor per hour; but 4 sensors expand into 4! MiB
• Trivial tasks
• The most popular user–contributed exercises
• The most popular exercise sessions and exercises within the sessions
• The most effective (by overall fitness improvement, weight loss, muscle mass gain, …)
exercise sessions
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Production ML
Take the data from Cassandra (written there by the Spark
jobs) and:
• Split into training and test datasets
• Fit models for various sensor types
• Save model parameters
• Evaluate the newly fitted models, and re-evaluate old
data
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Production ML
• We are using convolutional network
• 2 seconds of sensor data input (e.g. a @ 50 Hz for accelerometer; a, g @ 50 Hz for
accelerometer + gyroscope; u, l @ 10 Hz for smart clothes)
• The exercise classes as the outputs
• The training program
• CNN in neon
• Loads the mini–batches from Cassandra
• Fits the model; evaluates the fitted model
• Saves the model parameters into Cassandra
• The re–evaluation program
• Re–evaluates past n models against the latest training dataset; computing accuracy,
precision, recall, f1
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Having code is jolly good
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Running it
• Simplicity
• Ease of orchestration
• Ease of development
• Support for polyglot frameworks and components
• Cost effective resource utilisation
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Docker
• Deploy reliably & consistently
• Execution is fast and light weight
• Simplicity
• Developer friendly workflow
• Fantastic community
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Dockerize Cassandra Dev Environment
• Super low memory settings in cassandra-env.sh
• MAX_HEAP_SIZE=“128M”
• HEAP_NEWSIZE=“24M”
• Remove caches in dev mode in cassandra.yml
• key_cache_size_in_mb: 0
• reduce_cache_sizes_at: 0
• reduce_cache_capacity_to: 0
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Dockerize Cassandra Production
• Use host networking (—net=host) for better network
performance
• Put data, commitlog and saved_caches in volume
mount folders to the underlying host
• Run cassandra on the foreground using (-f)
• Tune JVM heap for optimal size
• Tune JVM garbage collector for your workload
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Mesos
• Distributed systems kernel
• Scales to 10,000s of nodes
• Depends on Zookeeper for fault tolerance and high
availability
• Creates a highly available, scalable single resource pool
• Automatic failover
• Ease of management
• Simple to operate
• Support for Docker container
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Mesos architecture
image source: https://assets.digitalocean.com/articles/mesosphere/mesos_architecture.png
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Cassandra on Mesos
• Running Cassandra as Docker containers
• Custom Dockerfile and entry-point script to control Cassandra configuration
• Marathon to initialize and control
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Cost effective resource in AWS
• Embrace AWS spot instances
• About 50-60% cheaper than on demand instances
• Can be reclaimed without notice if outbidded
• Run dev and staging on spot instances
• Run Spark jobs on spot instances
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
© 2016 Cake Solutions Limited CC BY-NC-SA 4.0
Thanks!
Twitter: @cakesolutions

Tel: 0845 617 1200
Email: enquiries@cakesolutions.net
Jobs: http://www.cakesolutions.net/
careers

More Related Content

What's hot

Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
DataStax
 

What's hot (20)

Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd KnownCassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
 
Reporting from the Trenches: Intuit & Cassandra
Reporting from the Trenches: Intuit & CassandraReporting from the Trenches: Intuit & Cassandra
Reporting from the Trenches: Intuit & Cassandra
 
Introducing DataStax Enterprise 4.7
Introducing DataStax Enterprise 4.7Introducing DataStax Enterprise 4.7
Introducing DataStax Enterprise 4.7
 
Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...
Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...
Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...
 
Azure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User StoreAzure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User Store
 
Cassandra Development Nirvana
Cassandra Development Nirvana Cassandra Development Nirvana
Cassandra Development Nirvana
 
Webinar: DataStax Training - Everything you need to become a Cassandra Rockstar
Webinar: DataStax Training - Everything you need to become a Cassandra RockstarWebinar: DataStax Training - Everything you need to become a Cassandra Rockstar
Webinar: DataStax Training - Everything you need to become a Cassandra Rockstar
 
Announcing Spark Driver for Cassandra
Announcing Spark Driver for CassandraAnnouncing Spark Driver for Cassandra
Announcing Spark Driver for Cassandra
 
Oracle to Cassandra Core Concepts Guid Part 1: A new hope
Oracle to Cassandra Core Concepts Guid Part 1: A new hopeOracle to Cassandra Core Concepts Guid Part 1: A new hope
Oracle to Cassandra Core Concepts Guid Part 1: A new hope
 
How much money do you lose every time your ecommerce site goes down?
How much money do you lose every time your ecommerce site goes down?How much money do you lose every time your ecommerce site goes down?
How much money do you lose every time your ecommerce site goes down?
 
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
 
Building a Digital Bank
Building a Digital BankBuilding a Digital Bank
Building a Digital Bank
 
Managing Cassandra Databases with OpenStack Trove
Managing Cassandra Databases with OpenStack TroveManaging Cassandra Databases with OpenStack Trove
Managing Cassandra Databases with OpenStack Trove
 
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at EbayCassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
 
There are More Clouds! Azure and Cassandra (Carlos Rolo, Pythian) | C* Summit...
There are More Clouds! Azure and Cassandra (Carlos Rolo, Pythian) | C* Summit...There are More Clouds! Azure and Cassandra (Carlos Rolo, Pythian) | C* Summit...
There are More Clouds! Azure and Cassandra (Carlos Rolo, Pythian) | C* Summit...
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
 
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
 
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
 
Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...
Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...
Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...
 
ProtectWise Revolutionizes Enterprise Network Security in the Cloud with Data...
ProtectWise Revolutionizes Enterprise Network Security in the Cloud with Data...ProtectWise Revolutionizes Enterprise Network Security in the Cloud with Data...
ProtectWise Revolutionizes Enterprise Network Security in the Cloud with Data...
 

Viewers also liked

Viewers also liked (14)

Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
 
SMACK Stack - Fast Data Done Right by Stefan Siprell at Codemotion Dubai
SMACK Stack - Fast Data Done Right by Stefan Siprell at Codemotion DubaiSMACK Stack - Fast Data Done Right by Stefan Siprell at Codemotion Dubai
SMACK Stack - Fast Data Done Right by Stefan Siprell at Codemotion Dubai
 
Spark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotronSpark zeppelin-cassandra at synchrotron
Spark zeppelin-cassandra at synchrotron
 
Cassandra 3 new features 2016
Cassandra 3 new features 2016Cassandra 3 new features 2016
Cassandra 3 new features 2016
 
Intro to Big Data Analytics using Apache Spark and Apache Zeppelin
Intro to Big Data Analytics using Apache Spark and Apache ZeppelinIntro to Big Data Analytics using Apache Spark and Apache Zeppelin
Intro to Big Data Analytics using Apache Spark and Apache Zeppelin
 
Kubernetes Architecture v1.x
Kubernetes Architecture v1.xKubernetes Architecture v1.x
Kubernetes Architecture v1.x
 
Data processing platforms with SMACK: Spark and Mesos internals
Data processing platforms with SMACK:  Spark and Mesos internalsData processing platforms with SMACK:  Spark and Mesos internals
Data processing platforms with SMACK: Spark and Mesos internals
 
Kick-Start with SMACK Stack
Kick-Start with SMACK StackKick-Start with SMACK Stack
Kick-Start with SMACK Stack
 
Kubernetes architecture
Kubernetes architectureKubernetes architecture
Kubernetes architecture
 
BI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraBI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache Cassandra
 
Jenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryJenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous Delivery
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Jenkins2
Jenkins2Jenkins2
Jenkins2
 
Big Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and ZeppelinBig Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and Zeppelin
 

Similar to Real-time Personal Trainer on the SMACK Stack

2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
Mirantis
 

Similar to Real-time Personal Trainer on the SMACK Stack (20)

Building production spark streaming applications
Building production spark streaming applicationsBuilding production spark streaming applications
Building production spark streaming applications
 
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceMySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
 
OpenStack Enabling DevOps
OpenStack Enabling DevOpsOpenStack Enabling DevOps
OpenStack Enabling DevOps
 
Typesafe spark- Zalando meetup
Typesafe spark- Zalando meetupTypesafe spark- Zalando meetup
Typesafe spark- Zalando meetup
 
mParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from CassandramParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from Cassandra
 
HPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journeyHPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journey
 
Big data architecture on cloud computing infrastructure
Big data architecture on cloud computing infrastructureBig data architecture on cloud computing infrastructure
Big data architecture on cloud computing infrastructure
 
Microservices deck
Microservices deckMicroservices deck
Microservices deck
 
Forecasting Kafka Lag Issues with Machine Learning
Forecasting Kafka Lag Issues with Machine LearningForecasting Kafka Lag Issues with Machine Learning
Forecasting Kafka Lag Issues with Machine Learning
 
Configuration Management in the Cloud | AWS Public Sector Summit 2017
Configuration Management in the Cloud | AWS Public Sector Summit 2017Configuration Management in the Cloud | AWS Public Sector Summit 2017
Configuration Management in the Cloud | AWS Public Sector Summit 2017
 
Stay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolithStay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolith
 
Cloud Infrastructures Slide Set 8 - More Cloud Technologies - Mesos, Spark | ...
Cloud Infrastructures Slide Set 8 - More Cloud Technologies - Mesos, Spark | ...Cloud Infrastructures Slide Set 8 - More Cloud Technologies - Mesos, Spark | ...
Cloud Infrastructures Slide Set 8 - More Cloud Technologies - Mesos, Spark | ...
 
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflows
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflowsCloud nativecomputingtechnologysupportinghpc cognitiveworkflows
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflows
 
Headaches and Breakthroughs in Building Continuous Applications
Headaches and Breakthroughs in Building Continuous ApplicationsHeadaches and Breakthroughs in Building Continuous Applications
Headaches and Breakthroughs in Building Continuous Applications
 
High Performance Object Pascal Code on Servers (at EKON 22)
High Performance Object Pascal Code on Servers (at EKON 22)High Performance Object Pascal Code on Servers (at EKON 22)
High Performance Object Pascal Code on Servers (at EKON 22)
 
Interop ITX: Moving applications: From Legacy to Cloud-to-Cloud
Interop ITX: Moving applications: From Legacy to Cloud-to-CloudInterop ITX: Moving applications: From Legacy to Cloud-to-Cloud
Interop ITX: Moving applications: From Legacy to Cloud-to-Cloud
 
Spark + AI Summit 2019: Headaches and Breakthroughs in Building Continuous Ap...
Spark + AI Summit 2019: Headaches and Breakthroughs in Building Continuous Ap...Spark + AI Summit 2019: Headaches and Breakthroughs in Building Continuous Ap...
Spark + AI Summit 2019: Headaches and Breakthroughs in Building Continuous Ap...
 
High Performance Computing Pitch Deck
High Performance Computing Pitch DeckHigh Performance Computing Pitch Deck
High Performance Computing Pitch Deck
 
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
 
Kognitio overview april 2013
Kognitio overview april 2013Kognitio overview april 2013
Kognitio overview april 2013
 

More from DataStax

More from DataStax (20)

Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?
 
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
 
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid EnvironmentsRunning DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
 
Best Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise GraphBest Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise Graph
 
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step JourneyWebinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
 
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
 
Webinar | Better Together: Apache Cassandra and Apache Kafka
Webinar  |  Better Together: Apache Cassandra and Apache KafkaWebinar  |  Better Together: Apache Cassandra and Apache Kafka
Webinar | Better Together: Apache Cassandra and Apache Kafka
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0
 
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
 
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud RealitiesWebinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
 
Designing a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for DummiesDesigning a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for Dummies
 
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid CloudHow to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
 
How to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerceHow to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerce
 
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
 
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
 
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
 
Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)
 
An Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking ApplicationsAn Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking Applications
 
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design ThinkingBecoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Real-time Personal Trainer on the SMACK Stack

  • 1. Real-time personal trainer on the SMACK stack
 
 @honzam399 Jan Machacek 
 @anirvan_c Anirvan Chakraborty 

  • 2. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Automated personal trainer - muvr • Suggests the sequence of exercise sessions • Suggests exercises in a session, including exercise parameters (e.g. weight, repetitions, …) • Provides tips on proper exercise form • With additional hardware (smartwatch, smart clothes), muvr provides • Completely unobtrusive exercise experience • More accurate tips on proper exercise form • With over–fitting, it is usable for physiotherapy
  • 3. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Architecture
  • 4. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Privacy
  • 5. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 The technologies—iOS • Learns the users’ behaviour • Exercise sessions • Exercises within exercise session • Short–term prediction of [scalar] labels for the exercises • Performs the real–time analysis of the incoming sensor data • Advised by the expected behaviour • Signal processing to compute repetitions / strokes • Forward–propagation to label the exercise • Submits all recorded sensor data and confirmed (!) labels per session • Handles offline / travel modes • Synchronises the data across the user’s devices using iCloud
  • 6. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 The technologies—Akka • Reactive services for user profiles, model parameters, and sensor data • CQRS/ES implementation, which helps to • Handle peaks in load • Handle failures of individual nodes • Reason about the scope of the mutable state we keep • Uses Cassandra for its journal and snapshot stores • The written values are binary “blobs” • Writes the sensor data to Cassandra • Writes the sensor data in “readable” form; it can be read outside the Akka / Scala world • Reads the model and exercise parameters from Cassandra • It selects the best / newest model parameters to serve to the mobile app
  • 7. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 The technologies—Spark • Distributed computation framework • “Big data” tasks • Integrates extremely well with Cassandra • Reads and processes the profiles and sensor data • Identifies clusters of users on their profile information • Slices the sensor inputs by sensor types • Writes the results to another store • Runs in batches • Executes by schedule (typically once a day)
  • 8. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 The technologies—neon • A machine learning framework, including • “The usual” suspects in tensor algebra • Signal processing • Different ML approaches • Training and evaluation programs • Both programs terminate either upon discovering the perfect model or when their budget is up • Reads clustered training and testing data from the Spark job • Writes the model parameters and evaluation result to Cassandra
  • 9. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 The technologies—Cassandra • Underpins the entire platform • Journal and snapshot store for Akka • Sensor data store • Model parameter store • “Summary” store • High availability • No single point of failure • High read and write • Replication factor • Tuneable consistency level
  • 10. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0
  • 11. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Spark & Cassandra • Group the sensor data into n clusters by user profile with biometric ID • Expand the sensor data • Slices of the sensor data by combinations of accelerometer, gyroscope, heart rate, targeted muscle group strain gauges, … • 1 user = 1 MiB from one sensor per hour; but 4 sensors expand into 4! MiB • Trivial tasks • The most popular user–contributed exercises • The most popular exercise sessions and exercises within the sessions • The most effective (by overall fitness improvement, weight loss, muscle mass gain, …) exercise sessions
  • 12. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Production ML Take the data from Cassandra (written there by the Spark jobs) and: • Split into training and test datasets • Fit models for various sensor types • Save model parameters • Evaluate the newly fitted models, and re-evaluate old data
  • 13. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Production ML • We are using convolutional network • 2 seconds of sensor data input (e.g. a @ 50 Hz for accelerometer; a, g @ 50 Hz for accelerometer + gyroscope; u, l @ 10 Hz for smart clothes) • The exercise classes as the outputs • The training program • CNN in neon • Loads the mini–batches from Cassandra • Fits the model; evaluates the fitted model • Saves the model parameters into Cassandra • The re–evaluation program • Re–evaluates past n models against the latest training dataset; computing accuracy, precision, recall, f1
  • 14. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Having code is jolly good
  • 15. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Running it • Simplicity • Ease of orchestration • Ease of development • Support for polyglot frameworks and components • Cost effective resource utilisation
  • 16. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Docker • Deploy reliably & consistently • Execution is fast and light weight • Simplicity • Developer friendly workflow • Fantastic community
  • 17. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Dockerize Cassandra Dev Environment • Super low memory settings in cassandra-env.sh • MAX_HEAP_SIZE=“128M” • HEAP_NEWSIZE=“24M” • Remove caches in dev mode in cassandra.yml • key_cache_size_in_mb: 0 • reduce_cache_sizes_at: 0 • reduce_cache_capacity_to: 0
  • 18. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Dockerize Cassandra Production • Use host networking (—net=host) for better network performance • Put data, commitlog and saved_caches in volume mount folders to the underlying host • Run cassandra on the foreground using (-f) • Tune JVM heap for optimal size • Tune JVM garbage collector for your workload
  • 19. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Mesos • Distributed systems kernel • Scales to 10,000s of nodes • Depends on Zookeeper for fault tolerance and high availability • Creates a highly available, scalable single resource pool • Automatic failover • Ease of management • Simple to operate • Support for Docker container
  • 20. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Mesos architecture image source: https://assets.digitalocean.com/articles/mesosphere/mesos_architecture.png
  • 21. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Cassandra on Mesos • Running Cassandra as Docker containers • Custom Dockerfile and entry-point script to control Cassandra configuration • Marathon to initialize and control
  • 22. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Cost effective resource in AWS • Embrace AWS spot instances • About 50-60% cheaper than on demand instances • Can be reclaimed without notice if outbidded • Run dev and staging on spot instances • Run Spark jobs on spot instances
  • 23. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0
  • 24. © 2016 Cake Solutions Limited CC BY-NC-SA 4.0 Thanks! Twitter: @cakesolutions
 Tel: 0845 617 1200 Email: enquiries@cakesolutions.net Jobs: http://www.cakesolutions.net/ careers