Fault ¡Tolerant ¡Distributed ¡Main ¡ Memory ¡Systems ¡
CompSci ¡590.04 ¡ Instructor: ¡Ashwin ¡Machanavajjhala ¡
1 ¡ Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡
Fault Tolerant Distributed Main Memory Systems CompSci - - PowerPoint PPT Presentation
Fault Tolerant Distributed Main Memory Systems CompSci 590.04 Instructor: Ashwin Machanavajjhala Lecture 16 : 590.04 Fall 15 1 Recap: Map Reduce ma p ! ! ,
1 ¡ Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 2 ¡
Map ¡Phase ¡ (per ¡record ¡computaEon) ¡ Reduce ¡Phase ¡ (global ¡computaEon) ¡ Shuffle ¡
!
Split ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 3 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 4 ¡
HDFS" read" HDFS" write" HDFS" read" HDFS" write"
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 5 ¡
HDFS" read" HDFS" write" HDFS" read" HDFS" write"
3 6 2 1 Superstep 0 6 6 2 6 Superstep 1 6 6 6 6 Superstep 2 6 6 6 6 Superstep 3 Figure 2: Maximum Value Example. Dotted lines are messages. Shaded vertices have voted to halt.
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 6 ¡
7 ¡
Data ¡Graph ¡ Shared ¡Data ¡Table ¡ Scheduling ¡ Update ¡FuncEons ¡and ¡Scopes ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 8 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 9 ¡
HDFS" read" HDFS" write" HDFS" read" HDFS" write"
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 10 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 11 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 12 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 13 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 14 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 15 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 16 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 17 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 18 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 19 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 20 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 21 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 22 ¡
Original ¡File ¡ This ¡is ¡the ¡RDD ¡that ¡is ¡stored ¡ First ¡acEon ¡triggers ¡RDD ¡ computaEon ¡and ¡load ¡into ¡ memory ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 23 ¡
"
path"="hdfs://…"
"
func"="_.contains(...)"
"
func"="_.split(…)"
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 24 ¡ Transformations( (define"a"new"RDD)" map" filter" sample" groupByKey" reduceByKey" sortByKey" flatMap" union" join" cogroup" cross" mapValues" Actions( (return"a"result"to" driver"program)" collect" reduce" count" save" lookupKey"
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 25 ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 26 ¡
val points = spark.textFile(...) .map(parsePoint).persist() var w = // random initial vector for (i <- 1 to ITERATIONS) { val gradient = points.map{ p => p.x * (1/(1+exp(-p.y*(w dot p.x)))-1)*p.y }.reduce((a,b) => a+b) w -= gradient }
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 27 ¡
val links = spark.textFile(...).map(...).persist() var ranks = // RDD of (URL, rank) pairs for (i <- 1 to ITERATIONS) { // Build an RDD of (targetURL, float) pairs // with the contributions sent by each page val contribs = links.join(ranks).flatMap { (url, (links, rank)) => links.map(dest => (dest, rank/links.size)) } // Sum contributions by URL and get new ranks ranks = contribs.reduceByKey((x,y) => x+y) .mapValues(sum => a/N + (1-a)*sum) }
ranks0 input file map contribs0 ranks1 contribs1 ranks2 contribs2 links join reduce + map
. . .
Lineage ¡graphs ¡can ¡be ¡long. ¡Uses ¡ checkpoinEng ¡in ¡such ¡cases. ¡ ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 28 ¡ union groupByKey join with inputs not co-partitioned join with inputs co-partitioned map, filter
Narrow Dependencies: Wide Dependencies:
User ¡can ¡specify ¡how ¡data ¡is ¡parEEoned ¡to ¡ensure ¡narrow ¡ dependencies ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 29 ¡
join union groupBy map Stage 3 Stage 1 Stage 2 A: B: C: D: E: F: G:
Can ¡pipeline ¡execuEon ¡as ¡long ¡as ¡ dependencies ¡are ¡narrow ¡
Lecture ¡16 ¡: ¡590.04 ¡Fall ¡15 ¡ 30 ¡