Lecture 1 cs246 intro

Lecture 1

Link for Azure: Microsoft Azure New Topics:

To be able to answer: How do you want that data? To be a master chef that singlehandedly does everything.

Distributed File Systems

MapReduce

3 Steps of MapReduce

MapEnvironment takes care of - Partitioning the input data - Scheduling the program’s execution across a set of machines - Performing the group by key step - handling machine failures - managing inter-machine communication

Dealing with failures Map worker failure Reduce worker failures harder: - Only in-progress tasks need to be reset and reduce task is started

Example: Word Counting

This is a completely sequential problem. No memory is necessary for intermediate storage - Find Popular URLS in web logs, 5-character word string are word counting problems. - Map: Word -> (Word, 1) - Groupbykey (System does this): group by word - Reduce: sum by key

Spark

Spark written in Java - Is a DataFlow system - Allows for chaining of multiple map-reduce steps - MapReduce uses two “ranks” of tasks - One for Map and the second for Reduce, data flows from teh first to the second - Dataflow Systems generalise this in two ways - Allow any number of tasks and ranks - Allow functions other than Map and Reduce - As long as data flow is in one direction only, we can have the blocking property and allow recovery of tasks rather than whole jobs. - Spark = Map Reduce + Fast data sharing (caching), DAG execution graphs, Richer functions than Map or Reduce - Spark high level APIs: DataFrame, Datasets are useful. - Spark RDD - Partitioned collection of records - Spread across the cluster, read only - Cached dataset in memory - Different Storage levels available, fallback to disk possible - RDDs can be created from Hadoop or by transforming other RDDs. You can stack RDDs - RDDs are best suited for applications that apply the same operation to all elements of a dataset.

Transformations build RDDs through - map filter join union intersection distinct - Lazy evaluation Actions (force evaluation) return value or export data - count, collect, reduce, save Action can be applied to RDDs, actions force computations to occur

Spark features - Spark supports general task graphs - Pipelines functions where possible - Cache aware data reuse and locality - Partitioning-aware to avoid shuffles

Abstractions - DataFrame - Unlike RDD, data organised into named column, imposes a structure on to the distributed collection of data - Dataset - Type safe OOP interface w/ compile time error detection

Libraries.- Spark SQL, Spark Streaming, MLLIb, GraphX

Screenshot 2019-09-26 at 11.39.59 AM.png