Lecture 4: Mapreduce and Hadoop

Slides:



Advertisements
Similar presentations
Lecture 12: MapReduce: Simplified Data Processing on Large Clusters Xiaowei Yang (Duke University)
Advertisements

MAP REDUCE PROGRAMMING Dr G Sudha Sadasivam. Map - reduce sort/merge based distributed processing Best for batch- oriented processing Sort/merge is primitive.
CS246 TA Session: Hadoop Tutorial Peyman kazemian 1/11/2011.
Intro to Map-Reduce Feb 4, map-reduce? A programming model or abstraction. A novel way of thinking about designing a solution to certain problems…
CS 525 Advanced Distributed Systems Spring 2015 Indranil Gupta (Indy) Lecture 3 Cloud Computing (Contd.) January 27, 2015 All slides © IG 1.
Distributed Computations
CS 345A Data Mining MapReduce. Single-node architecture Memory Disk CPU Machine Learning, Statistics “Classical” Data Mining.
An Introduction to MapReduce: Abstractions and Beyond! -by- Timothy Carlstrom Joshua Dick Gerard Dwan Eric Griffel Zachary Kleinfeld Peter Lucia Evan May.
MapReduce Dean and Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. Communications of the ACM, Vol. 51, No. 1, January Shahram.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 3: Mapreduce and Hadoop All slides © IG.
Distributed Computations MapReduce
L22: SC Report, Map Reduce November 23, Map Reduce What is MapReduce? Example computing environment How it works Fault Tolerance Debugging Performance.
Introduction to Google MapReduce WING Group Meeting 13 Oct 2006 Hendra Setiawan.
Lecture 2 – MapReduce CPE 458 – Parallel Programming, Spring 2009 Except as otherwise noted, the content of this presentation is licensed under the Creative.
MapReduce : Simplified Data Processing on Large Clusters Hongwei Wang & Sihuizi Jin & Yajing Zhang
Lecture 3-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) Sep 3, 2013 Lecture 3 Cloud Computing - 2  2013,
Lecture 3-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) Sep 4, 2012 Lecture 3 Cloud Computing -
Advanced Topics: MapReduce ECE 454 Computer Systems Programming Topics: Reductions Implemented in Distributed Frameworks Distributed Key-Value Stores Hadoop.
SIDDHARTH MEHTA PURSUING MASTERS IN COMPUTER SCIENCE (FALL 2008) INTERESTS: SYSTEMS, WEB.
Lecture 3-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) August 31, 2010 Lecture 3  2010, I. Gupta.
MapReduce.
Introduction to Parallel Programming MapReduce Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and are licensed under.
By: Jeffrey Dean & Sanjay Ghemawat Presented by: Warunika Ranaweera Supervised by: Dr. Nalin Ranasinghe.
MapReduce. Web data sets can be very large – Tens to hundreds of terabytes Cannot mine on a single server Standard architecture emerging: – Cluster of.
Google MapReduce Simplified Data Processing on Large Clusters Jeff Dean, Sanjay Ghemawat Google, Inc. Presented by Conroy Whitney 4 th year CS – Web Development.
Süleyman Fatih GİRİŞ CONTENT 1. Introduction 2. Programming Model 2.1 Example 2.2 More Examples 3. Implementation 3.1 ExecutionOverview 3.2.
Map Reduce for data-intensive computing (Some of the content is adapted from the original authors’ talk at OSDI 04)
Parallel Programming Models Basic question: what is the “right” way to write parallel programs –And deal with the complexity of finding parallelism, coarsening.
MapReduce: Simplified Data Processing on Large Clusters Jeffrey Dean and Sanjay Ghemawat.
1 The Map-Reduce Framework Compiled by Mark Silberstein, using slides from Dan Weld’s class at U. Washington, Yaniv Carmeli and some other.
MapReduce: Hadoop Implementation. Outline MapReduce overview Applications of MapReduce Hadoop overview.
HAMS Technologies 1
Map Reduce: Simplified Processing on Large Clusters Jeffrey Dean and Sanjay Ghemawat Google, Inc. OSDI ’04: 6 th Symposium on Operating Systems Design.
MAP REDUCE : SIMPLIFIED DATA PROCESSING ON LARGE CLUSTERS Presented by: Simarpreet Gill.
MapReduce How to painlessly process terabytes of data.
Google’s MapReduce Connor Poske Florida State University.
MapReduce M/R slides adapted from those of Jeff Dean’s.
MapReduce Kristof Bamps Wouter Deroey. Outline Problem overview MapReduce o overview o implementation o refinements o conclusion.
Introduction to Search Engines Technology CS Technion, Winter 2013 Amit Gross Some slides are courtesy of: Edward Bortnikov & Ronny Lempel, Yahoo!
SECTION 5: PERFORMANCE CHRIS ZINGRAF. OVERVIEW: This section measures the performance of MapReduce on two computations, Grep and Sort. These programs.
MapReduce: Simplified Data Processing on Large Clusters Lim JunSeok.
MapReduce : Simplified Data Processing on Large Clusters P 謝光昱 P 陳志豪 Operating Systems Design and Implementation 2004 Jeffrey Dean, Sanjay.
Map Reduce. Functional Programming Review r Functional operations do not modify data structures: They always create new ones r Original data still exists.
MapReduce: Simplified Data Processing on Large Clusters By Dinesh Dharme.
MapReduce: Simplied Data Processing on Large Clusters Written By: Jeffrey Dean and Sanjay Ghemawat Presented By: Manoher Shatha & Naveen Kumar Ratkal.
Lecture 3 – MapReduce: Implementation CSE 490h – Introduction to Distributed Computing, Spring 2009 Except as otherwise noted, the content of this presentation.
Lecture 4. MapReduce Instructor: Weidong Shi (Larry), PhD
Introduction to Google MapReduce
CS 525 Advanced Distributed Systems Spring 2017
Large-scale file systems and Map-Reduce
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing MapReduce - Introduction Dr. Xiao Qin Auburn.
Map-reduce programming paradigm
Lecture 4: Mapreduce and Hadoop
MapReduce Computing Paradigm Basics Fall 2013 Elke A. Rundensteiner
Database Applications (15-415) Hadoop Lecture 26, April 19, 2016
Distributed Systems CS
CS 525 Advanced Distributed Systems Spring 2018
MapReduce Simplied Data Processing on Large Clusters
湖南大学-信息科学与工程学院-计算机与科学系
February 26th – Map/Reduce
Map reduce use case Giuseppe Andronico INFN Sez. CT & Consorzio COMETA
Cse 344 May 4th – Map/Reduce.
CS 345A Data Mining MapReduce This presentation has been altered.
Lecture 4: Mapreduce and Hadoop
Distributed Systems CS
Introduction to MapReduce
5/7/2019 Map Reduce Map reduce.
COS 518: Distributed Systems Lecture 11 Mike Freedman
MapReduce: Simplified Data Processing on Large Clusters
Lecture 29: Distributed Systems
Presentation transcript:

Lecture 4: Mapreduce and Hadoop CS 425 / ECE 428 Distributed Systems Fall 2016 Indranil Gupta (Indy) Aug 30-Sep 1, 2016 Lecture 4: Mapreduce and Hadoop All slides © IG

What is MapReduce? Terms are borrowed from Functional Language (e.g., Lisp) Sum of squares: (map square ‘(1 2 3 4)) Output: (1 4 9 16) [processes each record sequentially and independently] (reduce + ‘(1 4 9 16)) (+ 16 (+ 9 (+ 4 1) ) ) Output: 30 [processes set of all records in batches] Let’s consider a sample application: Wordcount You are given a huge dataset (e.g., Wikipedia dump or all of Shakespeare’s works) and asked to list the count for each of the words in each of the documents therein

Map Process individual records to generate intermediate key/value pairs. Key Value Welcome Everyone Hello Everyone Welcome 1 Everyone 1 Hello 1 Input <filename, file text>

Map Parallelly Process individual records to generate intermediate key/value pairs. MAP TASK 1 Welcome Everyone Hello Everyone Welcome 1 Everyone 1 Hello 1 Input <filename, file text> MAP TASK 2

Map Parallelly Process a large number of individual records to generate intermediate key/value pairs. Welcome Everyone Hello Everyone Why are you here I am also here They are also here Yes, it’s THEM! The same people we were thinking of ……. Welcome 1 Everyone 1 Hello 1 Why 1 Are 1 You 1 Here 1 ……. Input <filename, file text> MAP TASKS

Reduce Reduce processes and merges all intermediate values associated per key Key Value Welcome 1 Everyone 1 Hello 1 Everyone 2 Hello 1 Welcome 1

Reduce Each key assigned to one Reduce Parallelly Processes and merges all intermediate values by partitioning keys Popular: Hash partitioning, i.e., key is assigned to reduce # = hash(key)%number of reduce tasks Welcome 1 Everyone 1 Hello 1 Everyone 2 Hello 1 Welcome 1 REDUCE TASK 1 REDUCE TASK 2

Hadoop Code - Map public static class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map( LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) // key is empty, value is the line throws IOException { String line = value.toString(); StringTokenizer itr = new StringTokenizer(line); while (itr.hasMoreTokens()) { word.set(itr.nextToken()); output.collect(word, one); } } // Source: http://developer.yahoo.com/hadoop/tutorial/module4.html#wordcount

Hadoop Code - Reduce public static class ReduceClass extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce( Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { // key is word, values is a list of 1’s int sum = 0; while (values.hasNext()) { sum += values.next().get(); } output.collect(key, new IntWritable(sum)); } // Source: http://developer.yahoo.com/hadoop/tutorial/module4.html#wordcount

Hadoop Code - Driver // Tells Hadoop how to run your Map-Reduce job public void run (String inputPath, String outputPath) throws Exception { // The job. WordCount contains MapClass and Reduce. JobConf conf = new JobConf(WordCount.class); conf.setJobName(”mywordcount"); // The keys are words (strings) conf.setOutputKeyClass(Text.class); // The values are counts (ints) conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(MapClass.class); conf.setReducerClass(ReduceClass.class); FileInputFormat.addInputPath( conf, newPath(inputPath)); FileOutputFormat.setOutputPath( conf, new Path(outputPath)); JobClient.runJob(conf); } // Source: http://developer.yahoo.com/hadoop/tutorial/module4.html#wordcount

Some Applications of MapReduce Distributed Grep: Input: large set of files Output: lines that match pattern Map – Emits a line if it matches the supplied pattern Reduce – Copies the intermediate data to output

Some Applications of MapReduce (2) Reverse Web-Link Graph Input: Web graph: tuples (a, b) where (page a  page b) Output: For each page, list of pages that link to it Map – process web log and for each input <source, target>, it outputs <target, source> Reduce - emits <target, list(source)>

Some Applications of MapReduce (3) Count of URL access frequency Input: Log of accessed URLs, e.g., from proxy server Output: For each URL, % of total accesses for that URL Map – Process web log and outputs <URL, 1> Multiple Reducers - Emits <URL, URL_count> (So far, like Wordcount. But still need %) Chain another MapReduce job after above one Map – Processes <URL, URL_count> and outputs <1, (<URL, URL_count> )> 1 Reducer – Does two passes. In first pass, sums up all URL_count’s to calculate overall_count. In second pass calculates %’s Emits multiple <URL, URL_count/overall_count>

Some Applications of MapReduce (4) Map task’s output is sorted (e.g., quicksort) Reduce task’s input is sorted (e.g., mergesort) Sort Input: Series of (key, value) pairs Output: Sorted <value>s Map – <key, value>  <value, _> (identity) Reducer – <key, value>  <key, value> (identity) Partitioning function – partition keys across reducers based on ranges (can’t use hashing!) Take data distribution into account to balance reducer tasks

Programming MapReduce Externally: For user Write a Map program (short), write a Reduce program (short) Specify number of Maps and Reduces (parallelism level) Submit job; wait for result Need to know very little about parallel/distributed programming! Internally: For the Paradigm and Scheduler Parallelize Map Transfer data from Map to Reduce (shuffle data) Parallelize Reduce Implement Storage for Map input, Map output, Reduce input, and Reduce output (Ensure that no Reduce starts before all Maps are finished. That is, ensure the barrier between the Map phase and Reduce phase)

Inside MapReduce For the cloud: Parallelize Map: easy! each map task is independent of the other! All Map output records with same key assigned to same Reduce Transfer data from Map to Reduce: Called Shuffle data All Map output records with same key assigned to same Reduce task use partitioning function, e.g., hash(key)%number of reducers Parallelize Reduce: easy! each reduce task is independent of the other! Implement Storage for Map input, Map output, Reduce input, and Reduce output Map input: from distributed file system Map output: to local disk (at Map node); uses local file system Reduce input: from (multiple) remote disks; uses local file systems Reduce output: to distributed file system local file system = Linux FS, etc. distributed file system = GFS (Google File System), HDFS (Hadoop Distributed File System)

1 2 3 4 5 6 7 Map tasks Reduce tasks I II III Output files into DFS Blocks from DFS A B C Servers A B C Servers (Local write, remote read) Resource Manager (assigns maps and reduces to servers)

The YARN Scheduler Used underneath Hadoop 2.x + YARN = Yet Another Resource Negotiator Treats each server as a collection of containers Container = fixed CPU + fixed memory (think of Linux cgroups, but even more lightweight) Has 3 main components Global Resource Manager (RM) Scheduling Per-server Node Manager (NM) Daemon and server-specific functions Per-application (job) Application Master (AM) Container negotiation with RM and NMs Detecting task failures of that job

YARN: How a job gets a container In this figure 2 servers (A, B) 2 jobs (1, 2) Resource Manager Capacity Scheduler 1. Need container 3. Container on Node B 2. Container Completed Node A Node Manager A Application Master 1 Node B Node Manager B Application Master 2 Task (App2) 4. Start task, please!

Fault Tolerance Server Failure RM Failure NM heartbeats to RM If server fails: RM times out waiting for next heartbeat, RM lets all affected AMs know, and AMs take appropriate action NM keeps track of each task running at its server If task fails while in-progress, mark the task as idle and restart it AM heartbeats to RM On failure, RM restarts AM, which then syncs it up with its running tasks RM Failure Use old checkpoints and bring up secondary RM Heartbeats also used to piggyback container requests Avoids extra messages

Slow Servers Slow tasks are called Stragglers The slowest task slows the entire job down (why?) Due to Bad Disk, Network Bandwidth, CPU, or Memory Keep track of “progress” of each task (% done) Perform proactive backup (replicated) execution of some straggler tasks A task considered done when its first replica complete (other replicas can then be killed) Approach called Speculative Execution. Barrier at the end of Map phase!

Locality Locality Since cloud has hierarchical topology (e.g., racks) For server-fault-tolerance, GFS/HDFS stores 3 replicas of each of chunks (e.g., 64 MB in size) For rack-fault-tolerance, on different racks, e.g., 2 on a rack, 1 on a different rack Mapreduce attempts to schedule a map task on a machine that contains a replica of corresponding input data, or failing that, on the same rack as a machine containing the input, or failing that, Anywhere Note: The 2-1 split of replicas is intended to reduce bandwidth when writing file. Using more racks does not affect overall Mapreduce scheduling performance

Mapreduce: Summary Mapreduce uses parallelization + aggregation to schedule applications across clusters Need to deal with failure Plenty of ongoing research work in scheduling and fault-tolerance for Mapreduce and Hadoop

Announcements HW1 due Sep 20th MP1 due Sep 11th VMs distributed (check Piazza) Demos will be Monday Sep 12th (schedule and details will be posted next week on Piazza) Please fill out Student Survey by today (course webpage). Check Piazza often! It’s where all the announcements are at! If your MP partner dropped, please form new group and let us know (cs-425-staff) TODAY is the last day DO NOT change MP groups unless your partner has dropped