MapReduce Paradigm• Splits input files into blocks (typically of 64MB each)• Operates on key/value pairs• Mappers filter & transform input data• Reducers aggregate mappers output• Efficient way to process the cluster: – Move code to data – Run code on all machines
• Map Hash Function (K1,v1) List(k2,v2)• Reduce Aggregate Function List(k3,v3) (k2,list(v2))
Advanced MapReduce• Hadoop Streaming – Lets you stream Mapper and reducer written in other languages such as python, ruby, etc.,• Chaining MapReduce jobs• Joining data• Bloom filters
Hadoop• Open Source Implementation of MapReduce by Apache Software Foundation.• Created by Doug Cutting.• Derived from Googles MapReduce and Google File System (GFS) papers.• Apache Hadoop is a software framework that supports data-intensive distributed applications under a free license• It enables applications to work with thousands of computational independent computers and petabytes of data.
Hadoop Architecture• Hadoop MapReduce – Single master node, many worker nodes – Client submits a job to master node – Master splits each job into tasks (MapReduce), and assigns tasks to worker nodes• Hadoop Distributed File System (HDFS) – Single name node, many data nodes – Files stored as large, fixed-size (e.g. 64MB) blocks – HDFS typically holds map input and reduce output
Job Scheduling in Hadoop• One map task for each block of the input file – Applies user-defined map function to each record in the block – Record = <key, value>• User-defined number of reduce tasks – Each reduce task is assigned a set of record groups – For each group, apply user-defined reduce function to the record values in that group• Reduce tasks read from every map task – Each read returns the record groups for that reduce task
Dataflow in Hadoop• Map tasks write their output to local disk – Output available after map task has completed• Reduce tasks write their output to HDFS – Once job is finished, next job’s map tasks can be scheduled, and will read input from HDFS• Therefore, fault tolerance is simple: simply re- run tasks on failure – No consumers see partial operator output
Dataflow in Hadoop[CAHER10] Submit job map schedule reduce map reduce
Dataflow in Hadoop[CAHER10] map Local FS reduce HTTP GET Local map FS reduce
Dataflow in Hadoop[CAHER10] Write Final reduce Answer HDFS reduce
HDFS• Data is distributed and replicated over multiple machines.• Files are not stored in contiguously on servers broken up into blocks.• Designed for large files (large means GB or TB)• Block Oriented• Linux Style commands (eg. ls, cp, mkdir, mv)
Hadoop Applicability by Workflow[MTAGS11] Score Meaning: • Score Zero implies Easily adaptable to the workflow • Score 0.5 implies Moderately adaptable to the workflow • Score 1 indicates one of the potential workflow areas where Hadoop needs improvement
Relative Merits and Demerits of Hadoop Over DBMSPros Cons• Fault tolerance • No high level language like• Self Healing rebalances files SQL in DBMS across cluster • No schema and no index• Highly Scalable • Low efficiency• Highly Flexible as it does not • Very young (since 2004) have any dependency on compared to over 40years data model and schema of DBMS Hadoop Relational Scale out (add more Scaling is difficult machines) Key/Value pairs Tables Say how to process the data Say what you want (SQL) Offline/ batch Online/ realtime
Conclusions and Future Work• MapReduce is easy to program• Hadoop=HDFS+MapReduce• Distributed, Parallel processing• Designed for fault tolerance and high scalability• MapReduce is unlikely to substitute DBMS in data warehousing instead we expect them to complement each other and help in data analysis of scientific data patterns• Finally, Efficiency and especially I/O costs needs to be addressed for successful implications
References[LLCCM12] Kyong-Ha Lee, Yoon-Joon Lee, Hyunsik Choi, Yon DohnChung, and Bongki Moon, “Parallel data processing with MapReduce:a survey,” SIGMOD, January 2012, pp. 11-20. [MTAGS11] Elif Dede, Madhusudhan Govindaraju, Daniel Gunter, andLavanya Ramakrishnan, “ Riding the Elephant: Managing Ensembleswith Hadoop,” Proceedings of the 2011 ACM international workshopon Many task computing on grids and supercomputers, ACM, NewYork, NY, USA, pp. 49-58.[DG08]Jeffrey Dean and Sanjay Ghemawat, “MapReduce: simplifieddata processing on large clusters,” January 2008, pp. 107-113. ACM.[CAHER10]Tyson Condie, Neil Conway, Peter Alvaro, Joseph M.Hellerstein, Khaled Elmeleegy, and Russell Sears, “MapReduce online,”Proceedings of the 7th USENIX conference on Networked systemsdesign and implementation (NSDI10), USENIX Association, Berkeley,CA, USA, 2010, pp. 21-37.