SlideShare a Scribd company logo
© 2014 DataStax, All Rights Reserved
Large Scale Data Analytics with DSE
Analytics
Ryan Knight
Solutions Engineer
@knight_cloud
© 2014 DataStax, All Rights Reserved
Hadoop?
© 2014 DataStax, All Rights Reserved
Hadoop Limitations
• Master / Slave Architecture
• Every Processing Step requires Disk IO
• Difficult API and Programming Model
• Designed for batch-mode jobs
• No even-streaming / real-time
• Complex Ecosystem
© 2014 DataStax, All Rights Reserved
Introduction to Spark
5
Apps in the early 2000s
were written for
Apps today
are written for
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
Small data sets Large data sets
Latency in seconds Latency in milliseconds
© 2014 Typesafe, All Rights Reserved. - Copied from Jonas Boner
What is Spark?
• Fast and general compute engine for large-scale data
processing
• Fault Tolerant Distributed Datasets
• Distributed Transformation on Datasets
• Integrated Batch, Iterative and Streaming Analysis
• In Memory Storage with Spill-over to Disk
© 2014 DataStax, All Rights Reserved
Advantages of Spark
• Improves efficiency through:
• In-memory data sharing
• General computation graphs - Lazy Evaluates Data
• 10x faster on disk, 100x faster in memory than
Hadoop MR
• Improves usability through:
• Rich APIs in Java, Scala, Py..??
• 2 to 5x less code
• Interactive shell
© 2014 DataStax, All Rights Reserved
Application

(Spark Driver)
Spark Master
Worker
Spark Components
You application code
which creates the SparkContext
A process which shells out to create
a Executor JVM
A Process which Manages the 

Resources of the Spark Cluster
These processes are all separate and require networking
to communicate
Hosting
Application UI
:4040
Hosting
Spark Master UI
:7080
WorkerWorkerWorkerWorker
© 2014 DataStax, All Rights Reserved
DataStax Analytics
Spark is about Data Analytics
• How do we get data into Spark?
• How can we work with large datasets?
• What do we do with the results of the analytics?
Spark Cassandra Connector
Spark Cassandra Connector
• Data locality-aware (speed)
• Read from and Write to Cassandra
• Cassandra Tables Exposed as RDD and DataFrames
• Server-Side filters (where clauses)
• Cross-table operations (JOIN, UNION, etc.)
• Mapping of Java Types to Cassandra Types
© 2014 DataStax, All Rights Reserved ●14
Spark Cassandra Connector uses the DataStax Java Driver to
Read from and Write to C*
Spark C*
Full Token
Range
Each Executor Maintains
a connection to the C*
Cluster
Spark
Executor
DataStax
Java Driver
Tokens 1-1000
Tokens 1001 -2000
Tokens …
RDD’s read into different
splits based on sets of tokens
Spark Cassandra Connector
15© 2015. All Rights Reserved.
•Simplified Deployment and Management
•Analytic Nodes configured to run Spark
•dse cassandra -k
•HA Spark Master with automatic leader election
•Stores Spark Worker metadata in Cassandra
DSE Analytics with Spark
© 2014 DataStax, All Rights Reserved
DSE Spark Architecture
Cassandr
a
Executor
ExecutorSpark
Worker

(JVM)
Cassandr
a
Executor
ExecutorSpark
Worker

(JVM)
Node 1
Node 2
Node 3
Node 4
Cassandr
a
Executor
ExecutorSpark
Worker

(JVM)
Cassandr
a
Executor
ExecutorSpark
Worker

(JVM)
Spark
Master

(JVM)
App

Driver
© 2014 DataStax, All Rights Reserved.
Confidential
Mixed Workload In One Cluster
17
Cassandra Mode
OLTP Database
Search Mode
All Data Searchable
Analytics Mode
Streaming and Analytics
C*
C
C
S A
Don’t build and maintain these yourself,
especially on top of a distributed data store.
AS
© 2014 DataStax, All Rights Reserved.
Confidential 18
Mixed Workload Cluster
DSE 4.7 Analytics + Search
• Allows Analytics Jobs to use Solr Queries
• Allows searching for data across partitions
• Example:
val table = sc.cassandraTable("music","solr")
val result = table.select("id","artist_name").where("solr_query='artist_name:Miles*'").collect
© 2014 DataStax, All Rights Reserved
Spark SQL and DataFrames
© 2014 DataStax, All Rights Reserved
• Creating and Running Spark Programs Faster
• Write less code
• Read less data
• Let the optimizer do the hard work
• Spark SQL Catalyst optimizer
Why Spark SQL?
© 2014 DataStax, All Rights Reserved
• Distributed collection of data
• Similar to a Table in a RDBMS
• Common API for reading/writing data
• API for selecting, filtering, aggregating 

and plotting structured data
• Similar to a Table in a RDBMS
DataFrame
© 2014 DataStax, All Rights Reserved
• Sources such as Cassandra, structured data
files, tables in Hive, external databases, or
existing RDDs.
• Optimization and code generation through the
Spark SQL Catalyst optimizer
• Decorator around RDD
• Previously SchemaRDD
DataFrame Part 2
© 2014 DataStax, All Rights Reserved
• Unified interface to reading/writing data in a
variety of formats
• Spark Notebook Example
Write Less Code: Input & Output
Scala for Large Scale Data Analytics
25© 2015. All Rights Reserved.
•Functional Paradigm is ideal for Data Analytics
•Strongly Typed - Enforce Schema at Every Later
•Immutable by Default - Event Logging
•Declarative instead of Imperative - Focus on
Transformation not Implementation
Spark Notebook
26© 2015. All Rights Reserved.
C*
C
C A
AA
Notebook
Notebook
Notebook
Spark Notebook Server
Cassandra Cluster with Spark Connector
Apache Spark Notebook
27© 2015. All Rights Reserved.
•Interactive Data Analytics in Browser
•Reactive / Dynamic Graphs based on Scala, SQL and
DataFrames
•Spark Streaming
•Examples notebooks covering visualization, machine
learning, streaming, graph analysis, genomics analysis
•Tune and Configure Each Notebook Separately
•https://github.com/andypetrella/spark-notebook
© 2014 DataStax, All Rights Reserved
Spark Streaming
© 2014 DataStax, All Rights Reserved
Spark Components
© 2014 DataStax, All Rights Reserved
Spark Versus Spark Streaming
© 2014 DataStax, All Rights Reserved
Spark Streaming General Architecture
© 2014 DataStax, All Rights Reserved
Spark Streaming General Architecture
© 2014 DataStax, All Rights Reserved
DStream Micro Batches
© 2014 DataStax, All Rights Reserved
Windowing
© 2014 DataStax, All Rights Reserved
Windowing
© 2014 DataStax, All Rights Reserved
Streaming Resiliency
• Streaming uses aggressive checkpointing and in-memory data
replication to improve resiliency.
• Frequent checkpointing keeps RDD lineages down to a
reasonable size.
• Checkpointing and replication mandatory since streams don’t
have source data files to reconstruct lost RDD partitions (except
for the directory ingest case).
© 2014 DataStax, All Rights Reserved
KillrWeather Architecture
© 2014 DataStax, All Rights Reserved
Spark Development
Imperative Code
final List<Integer> numbers =
Arrays.asList(1, 2, 3);
final List<Integer> numbersPlusOne =
Collections.emptyList();
for (Integer number : numbers) {
final Integer numberPlusOne = number + 1;
numbersPlusOne.add(numberPlusOne);
}
We Want Declarative Code
• Remove temporary lists - List<Integer> numbersPlusOne =
Collections.emptyList();
• Remove looping - for (Integer number : numbers)
• Focus on what - x+1
© 2014 DataStax, All Rights Reserved
Functions as Values
• Similar to a method - Expression with 0 or more
input arguments
• Simple Expressions f(x) = x+1 f(y)=y*y
• Avoid side effects and mutable state
• Output only depends on input
• Functions can be passed similar to other variables
Map, FlatMap and Filter
1 2 3 4 5 6 7 8
2 4 6 8 10 12 14 16
map (x*2)
4 6 8 102
filter ( x < 11)
30
reduce( x+nxt)
1,2 8,9 4,1 5,7
2 4 16 18 8 2 10 14
flatMap (x*2)
4 8 22
filter ( x < 10)
16
reduce( x+nxt)
Java 8
final List<Integer> numbers =
Arrays.asList(1, 2, 3);
final List<Integer> numbersPlusOne =
numbers.stream().map(number -> number + 1).
collect(Collectors.toList());
λ
Scala
val numbers = 1 to 20


val incFunc = (x:Int) => x+1

numbers.map(incFunc)



numbers.map(x => x+1)





numbers.map(_+1)
λ
SQL - Declarative or Imperative?
• SQL is Declarative
• What operation to perform and not how
to perform it
• Select doesn’t define how just what data
we want
Closures vs Functions?
• Closure is a Function which closes over
the surrounding context
• Closures can access variables in
surrounding context
• Spark Job passes closures to operate on
the data
© 2014 DataStax, All Rights Reserved
Spark Development
• Write programs in terms of parallel
transformations on distributed datasets
• Programming at a higher level of abstraction
Why Functions with Spark?
• Declarative Programming - Define What and Not
How
• Define what operations to perform and Spark
figures out how to operate on the data
• Easy to handle Events and Async Results with
Functional Callbacks
• Avoid Inner Classes
© 2014 DataStax, All Rights Reserved
Spark RDD
© 2014 DataStax, All Rights Reserved
• The primary abstraction in Spark
• Collection of data stored in the Spark Cluster
• Fault-tolerant
• Enables parallel processing on data sets
• In-Memory or On-Disk
Resilient Distributed Datasets (RDD)
© 2014 DataStax, All Rights Reserved
• Parallelized Collections
• Take an existing collection and runs functions
on it in parallel
• PairRDD
• UnionRDD
• JsonRDD
• ShuffledRDD
• CassandraRDD
Examples RDDs
© 2014 DataStax, All Rights Reserved
Spark Data Model
A1 A2 A3 A4 A5 A6 A7 A8
B1 B2 B3 B4 B5 B6 B7 B8
map
B2 B5 B7 B8B1
filter
C
reduce
Resilient Distributed Dataset
A collection:
● immutable
● iterable
● serializable
● distributed
● parallel
● lazy
© 2014 DataStax, All Rights Reserved
• RDDs are immutable - Each stage of a
transformation will create a new RDD.
• RDDs are lazy
• A DAG (directed acyclic graph) of computation
is constructed.
• The actual data is processed only when
results are requested.
Resilient Distributed Datasets (RDD)
© 2014 DataStax, All Rights Reserved
• RDDs know their “parents” and transitively, all
ancestors.
• RDDs are resilient - A lost partition is
reconstructed from ancestors.
• Transformation history / Lineage of the Data for
Re-computation when needed
Resilient Distributed Datasets (RDD)
© 2014 DataStax, All Rights Reserved
RDD Operations - Not Only Map & Reduce

More Related Content

What's hot (20)

PPTX
Architecture of a Kafka camus infrastructure
mattlieber
 
PDF
Scylla Summit 2016: Compose on Containing the Database
ScyllaDB
 
PDF
OpenStack Best Practices and Considerations - terasky tech day
Arthur Berezin
 
PDF
Spark day 2017 - Spark on Kubernetes
Yousun Jeong
 
PPTX
SAS Institute on Changing All Four Tires While Driving an AdTech Engine at Fu...
ScyllaDB
 
PDF
Cassandra on Docker
Instaclustr
 
PPT
Building your own NSQL store
Edward Capriolo
 
PPTX
Cassandra Performance and Scalability on AWS
Adrian Cockcroft
 
PDF
Apache Cassandra Management
Instaclustr
 
PPTX
Stream your Operational Data with Apache Spark & Kafka into Hadoop using Couc...
Data Con LA
 
PPT
February 2016 HUG: Running Spark Clusters in Containers with Docker
Yahoo Developer Network
 
ODP
Guaranteeing Storage Performance by Mike Tutkowski
buildacloud
 
PDF
Running Spark Inside Containers with Haohai Ma and Khalid Ahmed
Spark Summit
 
PPTX
Scaling DataStax in Docker
DataStax
 
PDF
Building Distributed Systems With Riak and Riak Core
Andy Gross
 
PPTX
Apache Kafka at LinkedIn
Guozhang Wang
 
PPTX
Scalable On-Demand Hadoop Clusters with Docker and Mesos
nelsonadpresent
 
PPTX
Big Data in Container; Hadoop Spark in Docker and Mesos
Heiko Loewe
 
PDF
Looking towards an official cassandra sidecar netflix
Vinay Kumar Chella
 
PPT
Docker based Hadoop provisioning - Hadoop Summit 2014
Janos Matyas
 
Architecture of a Kafka camus infrastructure
mattlieber
 
Scylla Summit 2016: Compose on Containing the Database
ScyllaDB
 
OpenStack Best Practices and Considerations - terasky tech day
Arthur Berezin
 
Spark day 2017 - Spark on Kubernetes
Yousun Jeong
 
SAS Institute on Changing All Four Tires While Driving an AdTech Engine at Fu...
ScyllaDB
 
Cassandra on Docker
Instaclustr
 
Building your own NSQL store
Edward Capriolo
 
Cassandra Performance and Scalability on AWS
Adrian Cockcroft
 
Apache Cassandra Management
Instaclustr
 
Stream your Operational Data with Apache Spark & Kafka into Hadoop using Couc...
Data Con LA
 
February 2016 HUG: Running Spark Clusters in Containers with Docker
Yahoo Developer Network
 
Guaranteeing Storage Performance by Mike Tutkowski
buildacloud
 
Running Spark Inside Containers with Haohai Ma and Khalid Ahmed
Spark Summit
 
Scaling DataStax in Docker
DataStax
 
Building Distributed Systems With Riak and Riak Core
Andy Gross
 
Apache Kafka at LinkedIn
Guozhang Wang
 
Scalable On-Demand Hadoop Clusters with Docker and Mesos
nelsonadpresent
 
Big Data in Container; Hadoop Spark in Docker and Mesos
Heiko Loewe
 
Looking towards an official cassandra sidecar netflix
Vinay Kumar Chella
 
Docker based Hadoop provisioning - Hadoop Summit 2014
Janos Matyas
 

Viewers also liked (20)

PPTX
Managing (Schema) Migrations in Cassandra
DataStax Academy
 
PPTX
Continuous Deployment with Cassandra
DataStax Academy
 
PDF
Becoming Friends with Cassandra
DataStax
 
PDF
Cassandra NoSQL Tutorial
Michelle Darling
 
PDF
Webinar: Continuous Deployment with MongoDB at Kitchensurfing
MongoDB
 
PPTX
Ops manager webinar mar 5, 2015
MongoDB
 
PDF
«CI. Jenkins. 2GIS» — Игорь Павлов, 2ГИС
DevDay
 
PDF
Continuous DB migration based on carbon5 framework
b0ris_1
 
PDF
MySQLドライバの改良と軽量O/Rマッパーの紹介
kwatch
 
PDF
Scaling Crashlytics: Building Analytics on Redis 2.6
Crashlytics
 
PDF
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
DataStax Academy
 
PDF
DataStax: How to Roll Cassandra into Production Without Losing your Health, M...
DataStax Academy
 
PDF
DataStax: Old Dogs, New Tricks. Teaching your Relational DBA to fetch
DataStax Academy
 
PDF
Crash course intro to cassandra
Jon Haddad
 
PDF
Cassandra Core Concepts
Jon Haddad
 
PDF
DataStax: 7 Deadly Sins for Cassandra Ops
DataStax Academy
 
PDF
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax Academy
 
PDF
Cassandra 3.0 Awesomeness
Jon Haddad
 
PDF
Diagnosing Problems in Production - Cassandra
Jon Haddad
 
PDF
Enter the Snake Pit for Fast and Easy Spark
Jon Haddad
 
Managing (Schema) Migrations in Cassandra
DataStax Academy
 
Continuous Deployment with Cassandra
DataStax Academy
 
Becoming Friends with Cassandra
DataStax
 
Cassandra NoSQL Tutorial
Michelle Darling
 
Webinar: Continuous Deployment with MongoDB at Kitchensurfing
MongoDB
 
Ops manager webinar mar 5, 2015
MongoDB
 
«CI. Jenkins. 2GIS» — Игорь Павлов, 2ГИС
DevDay
 
Continuous DB migration based on carbon5 framework
b0ris_1
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
kwatch
 
Scaling Crashlytics: Building Analytics on Redis 2.6
Crashlytics
 
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
DataStax Academy
 
DataStax: How to Roll Cassandra into Production Without Losing your Health, M...
DataStax Academy
 
DataStax: Old Dogs, New Tricks. Teaching your Relational DBA to fetch
DataStax Academy
 
Crash course intro to cassandra
Jon Haddad
 
Cassandra Core Concepts
Jon Haddad
 
DataStax: 7 Deadly Sins for Cassandra Ops
DataStax Academy
 
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax Academy
 
Cassandra 3.0 Awesomeness
Jon Haddad
 
Diagnosing Problems in Production - Cassandra
Jon Haddad
 
Enter the Snake Pit for Fast and Easy Spark
Jon Haddad
 
Ad

Similar to Large Scale Data Analytics with Spark and Cassandra on the DSE Platform (20)

PDF
Real Time Analytics with Dse
DataStax Academy
 
PDF
Boston Spark Meetup event Slides Update
vithakur
 
PPTX
4Introduction+to+Spark.pptx sdfsdfsdfsdfsdf
yafora8192
 
PDF
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
Chetan Khatri
 
PPTX
5 Ways to Use Spark to Enrich your Cassandra Environment
Jim Hatcher
 
PPTX
Processing Large Data with Apache Spark -- HasGeek
Venkata Naga Ravi
 
PPTX
Apache Spark for Beginners
Anirudh
 
PDF
Apache Spark and DataStax Enablement
Vincent Poncet
 
PPTX
Spark Introduction
DataStax Academy
 
PDF
Cassandra + Spark (You’ve got the lighter, let’s start a fire)
Robert Stupp
 
PDF
Spark Summit East 2015 Advanced Devops Student Slides
Databricks
 
PPTX
APACHE SPARK.pptx
DeepaThirumurugan
 
PPTX
Spark
Heena Madan
 
PPTX
Big Data Analytics with Spark
DataStax Academy
 
PDF
Kindling: Getting Started with Spark and Cassandra
DataStax Academy
 
PPTX
Apache Spark Fundamentals
Zahra Eskandari
 
PPTX
Pyspark presentationsfspfsjfspfjsfpsjfspfjsfpsjfsfsf
sasuke20y4sh
 
PPTX
Spark.pptx to knowledge gaining in wdm days ago
PreethamMCPreethamMC
 
PPTX
Big data vahidamiri-tabriz-13960226-datastack.ir
datastack
 
PDF
Apache Spark Overview
Vadim Y. Bichutskiy
 
Real Time Analytics with Dse
DataStax Academy
 
Boston Spark Meetup event Slides Update
vithakur
 
4Introduction+to+Spark.pptx sdfsdfsdfsdfsdf
yafora8192
 
HKOSCon18 - Chetan Khatri - Scaling TB's of Data with Apache Spark and Scala ...
Chetan Khatri
 
5 Ways to Use Spark to Enrich your Cassandra Environment
Jim Hatcher
 
Processing Large Data with Apache Spark -- HasGeek
Venkata Naga Ravi
 
Apache Spark for Beginners
Anirudh
 
Apache Spark and DataStax Enablement
Vincent Poncet
 
Spark Introduction
DataStax Academy
 
Cassandra + Spark (You’ve got the lighter, let’s start a fire)
Robert Stupp
 
Spark Summit East 2015 Advanced Devops Student Slides
Databricks
 
APACHE SPARK.pptx
DeepaThirumurugan
 
Big Data Analytics with Spark
DataStax Academy
 
Kindling: Getting Started with Spark and Cassandra
DataStax Academy
 
Apache Spark Fundamentals
Zahra Eskandari
 
Pyspark presentationsfspfsjfspfjsfpsjfspfjsfpsjfsfsf
sasuke20y4sh
 
Spark.pptx to knowledge gaining in wdm days ago
PreethamMCPreethamMC
 
Big data vahidamiri-tabriz-13960226-datastack.ir
datastack
 
Apache Spark Overview
Vadim Y. Bichutskiy
 
Ad

More from DataStax Academy (20)

PDF
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
DataStax Academy
 
PPTX
Introduction to DataStax Enterprise Graph Database
DataStax Academy
 
PPTX
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
DataStax Academy
 
PDF
Cassandra 3.0 Data Modeling
DataStax Academy
 
PPTX
Cassandra Adoption on Cisco UCS & Open stack
DataStax Academy
 
PDF
Data Modeling for Apache Cassandra
DataStax Academy
 
PDF
Coursera Cassandra Driver
DataStax Academy
 
PDF
Production Ready Cassandra
DataStax Academy
 
PDF
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
DataStax Academy
 
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 1
DataStax Academy
 
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 2
DataStax Academy
 
PDF
Standing Up Your First Cluster
DataStax Academy
 
PDF
Introduction to Data Modeling with Apache Cassandra
DataStax Academy
 
PDF
Cassandra Core Concepts
DataStax Academy
 
PPTX
Enabling Search in your Cassandra Application with DataStax Enterprise
DataStax Academy
 
PPTX
Bad Habits Die Hard
DataStax Academy
 
PDF
Advanced Data Modeling with Apache Cassandra
DataStax Academy
 
PDF
Advanced Cassandra
DataStax Academy
 
PDF
Apache Cassandra and Drivers
DataStax Academy
 
PDF
Getting Started with Graph Databases
DataStax Academy
 
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
DataStax Academy
 
Introduction to DataStax Enterprise Graph Database
DataStax Academy
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
DataStax Academy
 
Cassandra 3.0 Data Modeling
DataStax Academy
 
Cassandra Adoption on Cisco UCS & Open stack
DataStax Academy
 
Data Modeling for Apache Cassandra
DataStax Academy
 
Coursera Cassandra Driver
DataStax Academy
 
Production Ready Cassandra
DataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
DataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
DataStax Academy
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
DataStax Academy
 
Standing Up Your First Cluster
DataStax Academy
 
Introduction to Data Modeling with Apache Cassandra
DataStax Academy
 
Cassandra Core Concepts
DataStax Academy
 
Enabling Search in your Cassandra Application with DataStax Enterprise
DataStax Academy
 
Bad Habits Die Hard
DataStax Academy
 
Advanced Data Modeling with Apache Cassandra
DataStax Academy
 
Advanced Cassandra
DataStax Academy
 
Apache Cassandra and Drivers
DataStax Academy
 
Getting Started with Graph Databases
DataStax Academy
 

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 

Large Scale Data Analytics with Spark and Cassandra on the DSE Platform

  • 1. © 2014 DataStax, All Rights Reserved Large Scale Data Analytics with DSE Analytics Ryan Knight Solutions Engineer @knight_cloud
  • 2. © 2014 DataStax, All Rights Reserved Hadoop?
  • 3. © 2014 DataStax, All Rights Reserved Hadoop Limitations • Master / Slave Architecture • Every Processing Step requires Disk IO • Difficult API and Programming Model • Designed for batch-mode jobs • No even-streaming / real-time • Complex Ecosystem
  • 4. © 2014 DataStax, All Rights Reserved Introduction to Spark
  • 5. 5 Apps in the early 2000s were written for Apps today are written for Single machines Clusters of machines Single core processors Multicore processors Expensive RAM Cheap RAM Expensive disk Cheap disk Slow networks Fast networks Few concurrent users Lots of concurrent users Small data sets Large data sets Latency in seconds Latency in milliseconds © 2014 Typesafe, All Rights Reserved. - Copied from Jonas Boner
  • 6. What is Spark? • Fast and general compute engine for large-scale data processing • Fault Tolerant Distributed Datasets • Distributed Transformation on Datasets • Integrated Batch, Iterative and Streaming Analysis • In Memory Storage with Spill-over to Disk
  • 7. © 2014 DataStax, All Rights Reserved Advantages of Spark • Improves efficiency through: • In-memory data sharing • General computation graphs - Lazy Evaluates Data • 10x faster on disk, 100x faster in memory than Hadoop MR • Improves usability through: • Rich APIs in Java, Scala, Py..?? • 2 to 5x less code • Interactive shell
  • 8. © 2014 DataStax, All Rights Reserved
  • 9. Application
 (Spark Driver) Spark Master Worker Spark Components You application code which creates the SparkContext A process which shells out to create a Executor JVM A Process which Manages the 
 Resources of the Spark Cluster These processes are all separate and require networking to communicate Hosting Application UI :4040 Hosting Spark Master UI :7080 WorkerWorkerWorkerWorker
  • 10. © 2014 DataStax, All Rights Reserved DataStax Analytics
  • 11. Spark is about Data Analytics • How do we get data into Spark? • How can we work with large datasets? • What do we do with the results of the analytics?
  • 13. Spark Cassandra Connector • Data locality-aware (speed) • Read from and Write to Cassandra • Cassandra Tables Exposed as RDD and DataFrames • Server-Side filters (where clauses) • Cross-table operations (JOIN, UNION, etc.) • Mapping of Java Types to Cassandra Types
  • 14. © 2014 DataStax, All Rights Reserved ●14 Spark Cassandra Connector uses the DataStax Java Driver to Read from and Write to C* Spark C* Full Token Range Each Executor Maintains a connection to the C* Cluster Spark Executor DataStax Java Driver Tokens 1-1000 Tokens 1001 -2000 Tokens … RDD’s read into different splits based on sets of tokens Spark Cassandra Connector
  • 15. 15© 2015. All Rights Reserved. •Simplified Deployment and Management •Analytic Nodes configured to run Spark •dse cassandra -k •HA Spark Master with automatic leader election •Stores Spark Worker metadata in Cassandra DSE Analytics with Spark
  • 16. © 2014 DataStax, All Rights Reserved DSE Spark Architecture Cassandr a Executor ExecutorSpark Worker
 (JVM) Cassandr a Executor ExecutorSpark Worker
 (JVM) Node 1 Node 2 Node 3 Node 4 Cassandr a Executor ExecutorSpark Worker
 (JVM) Cassandr a Executor ExecutorSpark Worker
 (JVM) Spark Master
 (JVM) App
 Driver
  • 17. © 2014 DataStax, All Rights Reserved. Confidential Mixed Workload In One Cluster 17 Cassandra Mode OLTP Database Search Mode All Data Searchable Analytics Mode Streaming and Analytics C* C C S A Don’t build and maintain these yourself, especially on top of a distributed data store. AS
  • 18. © 2014 DataStax, All Rights Reserved. Confidential 18 Mixed Workload Cluster
  • 19. DSE 4.7 Analytics + Search • Allows Analytics Jobs to use Solr Queries • Allows searching for data across partitions • Example: val table = sc.cassandraTable("music","solr") val result = table.select("id","artist_name").where("solr_query='artist_name:Miles*'").collect
  • 20. © 2014 DataStax, All Rights Reserved Spark SQL and DataFrames
  • 21. © 2014 DataStax, All Rights Reserved • Creating and Running Spark Programs Faster • Write less code • Read less data • Let the optimizer do the hard work • Spark SQL Catalyst optimizer Why Spark SQL?
  • 22. © 2014 DataStax, All Rights Reserved • Distributed collection of data • Similar to a Table in a RDBMS • Common API for reading/writing data • API for selecting, filtering, aggregating 
 and plotting structured data • Similar to a Table in a RDBMS DataFrame
  • 23. © 2014 DataStax, All Rights Reserved • Sources such as Cassandra, structured data files, tables in Hive, external databases, or existing RDDs. • Optimization and code generation through the Spark SQL Catalyst optimizer • Decorator around RDD • Previously SchemaRDD DataFrame Part 2
  • 24. © 2014 DataStax, All Rights Reserved • Unified interface to reading/writing data in a variety of formats • Spark Notebook Example Write Less Code: Input & Output
  • 25. Scala for Large Scale Data Analytics 25© 2015. All Rights Reserved. •Functional Paradigm is ideal for Data Analytics •Strongly Typed - Enforce Schema at Every Later •Immutable by Default - Event Logging •Declarative instead of Imperative - Focus on Transformation not Implementation
  • 26. Spark Notebook 26© 2015. All Rights Reserved. C* C C A AA Notebook Notebook Notebook Spark Notebook Server Cassandra Cluster with Spark Connector
  • 27. Apache Spark Notebook 27© 2015. All Rights Reserved. •Interactive Data Analytics in Browser •Reactive / Dynamic Graphs based on Scala, SQL and DataFrames •Spark Streaming •Examples notebooks covering visualization, machine learning, streaming, graph analysis, genomics analysis •Tune and Configure Each Notebook Separately •https://github.com/andypetrella/spark-notebook
  • 28. © 2014 DataStax, All Rights Reserved Spark Streaming
  • 29. © 2014 DataStax, All Rights Reserved Spark Components
  • 30. © 2014 DataStax, All Rights Reserved Spark Versus Spark Streaming
  • 31. © 2014 DataStax, All Rights Reserved Spark Streaming General Architecture
  • 32. © 2014 DataStax, All Rights Reserved Spark Streaming General Architecture
  • 33. © 2014 DataStax, All Rights Reserved DStream Micro Batches
  • 34. © 2014 DataStax, All Rights Reserved Windowing
  • 35. © 2014 DataStax, All Rights Reserved Windowing
  • 36. © 2014 DataStax, All Rights Reserved Streaming Resiliency • Streaming uses aggressive checkpointing and in-memory data replication to improve resiliency. • Frequent checkpointing keeps RDD lineages down to a reasonable size. • Checkpointing and replication mandatory since streams don’t have source data files to reconstruct lost RDD partitions (except for the directory ingest case).
  • 37. © 2014 DataStax, All Rights Reserved KillrWeather Architecture
  • 38. © 2014 DataStax, All Rights Reserved Spark Development
  • 39. Imperative Code final List<Integer> numbers = Arrays.asList(1, 2, 3); final List<Integer> numbersPlusOne = Collections.emptyList(); for (Integer number : numbers) { final Integer numberPlusOne = number + 1; numbersPlusOne.add(numberPlusOne); }
  • 40. We Want Declarative Code • Remove temporary lists - List<Integer> numbersPlusOne = Collections.emptyList(); • Remove looping - for (Integer number : numbers) • Focus on what - x+1
  • 41. © 2014 DataStax, All Rights Reserved Functions as Values • Similar to a method - Expression with 0 or more input arguments • Simple Expressions f(x) = x+1 f(y)=y*y • Avoid side effects and mutable state • Output only depends on input • Functions can be passed similar to other variables
  • 42. Map, FlatMap and Filter 1 2 3 4 5 6 7 8 2 4 6 8 10 12 14 16 map (x*2) 4 6 8 102 filter ( x < 11) 30 reduce( x+nxt) 1,2 8,9 4,1 5,7 2 4 16 18 8 2 10 14 flatMap (x*2) 4 8 22 filter ( x < 10) 16 reduce( x+nxt)
  • 43. Java 8 final List<Integer> numbers = Arrays.asList(1, 2, 3); final List<Integer> numbersPlusOne = numbers.stream().map(number -> number + 1). collect(Collectors.toList()); λ
  • 44. Scala val numbers = 1 to 20 
 val incFunc = (x:Int) => x+1
 numbers.map(incFunc)
 
 numbers.map(x => x+1)
 
 
 numbers.map(_+1) λ
  • 45. SQL - Declarative or Imperative? • SQL is Declarative • What operation to perform and not how to perform it • Select doesn’t define how just what data we want
  • 46. Closures vs Functions? • Closure is a Function which closes over the surrounding context • Closures can access variables in surrounding context • Spark Job passes closures to operate on the data
  • 47. © 2014 DataStax, All Rights Reserved Spark Development • Write programs in terms of parallel transformations on distributed datasets • Programming at a higher level of abstraction
  • 48. Why Functions with Spark? • Declarative Programming - Define What and Not How • Define what operations to perform and Spark figures out how to operate on the data • Easy to handle Events and Async Results with Functional Callbacks • Avoid Inner Classes
  • 49. © 2014 DataStax, All Rights Reserved Spark RDD
  • 50. © 2014 DataStax, All Rights Reserved • The primary abstraction in Spark • Collection of data stored in the Spark Cluster • Fault-tolerant • Enables parallel processing on data sets • In-Memory or On-Disk Resilient Distributed Datasets (RDD)
  • 51. © 2014 DataStax, All Rights Reserved • Parallelized Collections • Take an existing collection and runs functions on it in parallel • PairRDD • UnionRDD • JsonRDD • ShuffledRDD • CassandraRDD Examples RDDs
  • 52. © 2014 DataStax, All Rights Reserved Spark Data Model A1 A2 A3 A4 A5 A6 A7 A8 B1 B2 B3 B4 B5 B6 B7 B8 map B2 B5 B7 B8B1 filter C reduce Resilient Distributed Dataset A collection: ● immutable ● iterable ● serializable ● distributed ● parallel ● lazy
  • 53. © 2014 DataStax, All Rights Reserved • RDDs are immutable - Each stage of a transformation will create a new RDD. • RDDs are lazy • A DAG (directed acyclic graph) of computation is constructed. • The actual data is processed only when results are requested. Resilient Distributed Datasets (RDD)
  • 54. © 2014 DataStax, All Rights Reserved • RDDs know their “parents” and transitively, all ancestors. • RDDs are resilient - A lost partition is reconstructed from ancestors. • Transformation history / Lineage of the Data for Re-computation when needed Resilient Distributed Datasets (RDD)
  • 55. © 2014 DataStax, All Rights Reserved RDD Operations - Not Only Map & Reduce