The Hadoop Framework



Similar documents
Chapter 7. Using Hadoop Cluster and MapReduce

Data-Intensive Computing with Map-Reduce and Hadoop

CSE 590: Special Topics Course ( Supercomputing ) Lecture 10 ( MapReduce& Hadoop)

Open source software framework designed for storage and processing of large scale data on clusters of commodity hardware

Big Data and Apache Hadoop s MapReduce

Welcome to the unit of Hadoop Fundamentals on Hadoop architecture. I will begin with a terminology review and then cover the major components

Hadoop Architecture. Part 1

Hadoop implementation of MapReduce computational model. Ján Vaňo

Introduction to Hadoop

DATA MINING WITH HADOOP AND HIVE Introduction to Architecture

Big Data With Hadoop

Parallel Processing of cluster by Map Reduce

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Hadoop: A Framework for Data- Intensive Distributed Computing. CS561-Spring 2012 WPI, Mohamed Y. Eltabakh

Processing of Hadoop using Highly Available NameNode

A STUDY ON HADOOP ARCHITECTURE FOR BIG DATA ANALYTICS

Large scale processing using Hadoop. Ján Vaňo

Lecture 5: GFS & HDFS! Claudia Hauff (Web Information Systems)! ti2736b-ewi@tudelft.nl

Hadoop. Sunday, November 25, 12

Introduction to Hadoop

Introduction to Hadoop HDFS and Ecosystems. Slides credits: Cloudera Academic Partners Program & Prof. De Liu, MSBA 6330 Harvesting Big Data

CSE-E5430 Scalable Cloud Computing Lecture 2

International Journal of Advance Research in Computer Science and Management Studies

GraySort and MinuteSort at Yahoo on Hadoop 0.23

Fault Tolerance in Hadoop for Work Migration

The Performance Characteristics of MapReduce Applications on Scalable Clusters

Comparative analysis of mapreduce job by keeping data constant and varying cluster size technique

Open source Google-style large scale data analysis with Hadoop

Big Data Storage, Management and challenges. Ahmed Ali-Eldin

MapReduce. Tushar B. Kute,

Jeffrey D. Ullman slides. MapReduce for data intensive computing

Yuji Shirasaki (JVO NAOJ)

Overview. Big Data in Apache Hadoop. - HDFS - MapReduce in Hadoop - YARN. Big Data Management and Analytics

Weekly Report. Hadoop Introduction. submitted By Anurag Sharma. Department of Computer Science and Engineering. Indian Institute of Technology Bombay

A REVIEW PAPER ON THE HADOOP DISTRIBUTED FILE SYSTEM

R.K.Uskenbayeva 1, А.А. Kuandykov 2, Zh.B.Kalpeyeva 3, D.K.Kozhamzharova 4, N.K.Mukhazhanov 5

Hadoop IST 734 SS CHUNG

marlabs driving digital agility WHITEPAPER Big Data and Hadoop

PLATFORM AND SOFTWARE AS A SERVICE THE MAPREDUCE PROGRAMMING MODEL AND IMPLEMENTATIONS

MapReduce with Apache Hadoop Analysing Big Data

Generic Log Analyzer Using Hadoop Mapreduce Framework

Keywords: Big Data, HDFS, Map Reduce, Hadoop

MapReduce and Hadoop. Aaron Birkland Cornell Center for Advanced Computing. January 2012

Chapter 11 Map-Reduce, Hadoop, HDFS, Hbase, MongoDB, Apache HIVE, and Related

White Paper. Big Data and Hadoop. Abhishek S, Java COE. Cloud Computing Mobile DW-BI-Analytics Microsoft Oracle ERP Java SAP ERP

Journal of science STUDY ON REPLICA MANAGEMENT AND HIGH AVAILABILITY IN HADOOP DISTRIBUTED FILE SYSTEM (HDFS)

MASSIVE DATA PROCESSING (THE GOOGLE WAY ) 27/04/2015. Fundamentals of Distributed Systems. Inside Google circa 2015

Map Reduce & Hadoop Recommended Text:

Tutorial: Big Data Algorithms and Applications Under Hadoop KUNPENG ZHANG SIDDHARTHA BHATTACHARYYA

Introduction to Parallel Programming and MapReduce

A Brief Outline on Bigdata Hadoop

CS2510 Computer Operating Systems

CS2510 Computer Operating Systems

International Journal of Advancements in Research & Technology, Volume 3, Issue 2, February ISSN

Hadoop and Map-reduce computing

BigData. An Overview of Several Approaches. David Mera 16/12/2013. Masaryk University Brno, Czech Republic

Intro to Map/Reduce a.k.a. Hadoop

MapReduce and Hadoop Distributed File System

Hadoop Big Data for Processing Data and Performing Workload

Comparison of Different Implementation of Inverted Indexes in Hadoop

Outline. High Performance Computing (HPC) Big Data meets HPC. Case Studies: Some facts about Big Data Technologies HPC and Big Data converging

MAPREDUCE Programming Model

Hadoop and Map-Reduce. Swati Gore

Open source large scale distributed data management with Google s MapReduce and Bigtable

How To Scale Out Of A Nosql Database

Take An Internal Look at Hadoop. Hairong Kuang Grid Team, Yahoo! Inc

Big Application Execution on Cloud using Hadoop Distributed File System

Reduction of Data at Namenode in HDFS using harballing Technique

HADOOP MOCK TEST HADOOP MOCK TEST II

Apache Hadoop. Alexandru Costan

Map Reduce / Hadoop / HDFS

Big Data Analysis and Its Scheduling Policy Hadoop

MapReduce (in the cloud)

Hadoop/MapReduce. Object-oriented framework presentation CSCI 5448 Casey McTaggart

Getting to know Apache Hadoop

Recognization of Satellite Images of Large Scale Data Based On Map- Reduce Framework

From GWS to MapReduce: Google s Cloud Technology in the Early Days

A Cost-Benefit Analysis of Indexing Big Data with Map-Reduce

Distributed File System. MCSN N. Tonellotto Complements of Distributed Enabling Platforms

16.1 MAPREDUCE. For personal use only, not for distribution. 333

THE HADOOP DISTRIBUTED FILE SYSTEM

A Study on Workload Imbalance Issues in Data Intensive Distributed Computing

Manifest for Big Data Pig, Hive & Jaql

Energy Efficient MapReduce

LARGE-SCALE DATA PROCESSING USING MAPREDUCE IN CLOUD COMPUTING ENVIRONMENT

MapReduce and Hadoop Distributed File System V I J A Y R A O


Data-Intensive Programming. Timo Aaltonen Department of Pervasive Computing

Lecture 10 - Functional programming: Hadoop and MapReduce

Distributed File Systems

Analysing Large Web Log Files in a Hadoop Distributed Cluster Environment

Data-intensive computing systems

INTRODUCTION TO APACHE HADOOP MATTHIAS BRÄGER CERN GS-ASE

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

HADOOP MOCK TEST HADOOP MOCK TEST I

Scalable Cloud Computing Solutions for Next Generation Sequencing Data

Transcription:

The Hadoop Framework Nils Braden University of Applied Sciences Gießen-Friedberg Wiesenstraße 14 35390 Gießen nils.braden@mni.fh-giessen.de Abstract. The Hadoop Framework offers an approach to large-scale computing on a big number of nodes in a cluster. It is based on the MapReduce programming model and provides the programmer with any essential means to reliably distribute work without having to handle the upcoming problems of the distribution. This paper provides a beginners approach to distributed parallel programming with the Hadoop Framework by explaining the necessary parts of the framework and giving an introduction on MapReduce. Keywords: MapReduce, Cluster, Rack-Based-Computing, Hadoop, Data processing, Distributed programming 1 Introduction With growing amounts of data comes the need to analyze the data. As stated by Anand Rajaraman More data usually beats better algorithms 1 so if the used algorithms are sufficiently evolved the best way to get better results is to use the algorithms with more data. As of 2009 the Internet Archive stored around 2 petabytes of data and was growing at a rate 20 terabytes per month [6] and Facebook was hosting approximately 10 billion photos, taking up one petabyte of storage [3]. These amounts of data raise the problems of computing power and storage. If there are ten terabytes of data to be read and they have to be read from five nodes it will take about 330 minutes. If the data is spread across 500 nodes it is just going to take five minutes when reading at an average rate of 100 megabytes per second. If we would start to transfer the data over the network to other nodes the time would increase by some orders of magnitude. Hadoop adresses these problems by distributing the work and the data over thousands of machines. The workload is spread evenly accross the cluster and there are several techniques to be explained which ensure fault-tolerance and data-integrity. It also ensures that only a small amount of the data is transferred over the network on processing time so it suits best in cases were data is written once and often read. 1 See http://anand.typepad.com/datawocky/2008/03/more-data-usual.html

2 The MapReduce programming model allows for the programmer to work on an abstract level without having to tinker with any cluster-specific details, concurrent use of ressources, communication and data flow. The two functions, map and reduce, receive incoming data, modify it and send it to an output channel. Comparison to RDBMS Relational database management systems (RDBMS) are often compared to Hadoop but in fact are more like the opposite. Both systems got different strengths. While RDBMS can hardly store more then 1 terabyte of data, using Hadoop just starts to make sense with several terabytes. Hadoop shines when reading the whole data is necessary while RDBMS are using indexes and caches for random access to access small portions of the data. Another big difference are constraints which are non-existent in Hadoop but impossible to think away from database systems. By leaving this ballast behind, Hadoop has one serious advantage over traditional systems: Hadoop scales well. If the number of nodes is doubled, the computing time for a job is roughly half of the original time which is impossible to achieve with specialized and expensive database servers. Hadoop operates well on semi-structured or unstructured data by allowing the programmer to chose the input keys and values. For processing a textfile one would probably chose the line number as key and the line as value so there would be no need to find and check any key inside the actual data. Comparison to Grid-Computing The terms Grid-Computing and High Performance Computing often refer to quite different fields of computing. What matters here is the fact that large-scale computing on lots of different nodes is not a new idea but has in fact been done for years. The general approach is to distribute the work over the nodes but leave the data on one central storage which works well for compute-intensive tasks but becomes the bottleneck for tasks which require access to the whole dataset. Hadoop follows a different approach by trying to locate the work-units on the same nodes as the necessary data for this unit is hosted because in a data center the network bandwidth becomes the most precious ressource if the amount of data is large. The framework takes responsibility for coordination of the processes. It is complicated to check for dead nodes and differentiate between nodes which are just making slow progress, nodes that are not reachable via network at the moment but may become available later and nodes which stopped working. 2 The Hadoop Framework This section contains a general overview of the components and their association in the Hadoop Framework without getting into the depths of what exactly they

3 do. The Hadoop Framework consists of several modules which provide different parts of the necessary functionality to distribute tasks and data across a cluster. These modules are explained in the sections 3 and 4 while this section covers general information about the framework, the communication and the topology of a cluster. Cluster Master-Node JobTracker NameNode Rack 1 Node 1 Node 2... Node n... Rack n Node 1 Node 2... Node n Fig. 1. Abstract view on a Cluster. A cluster consists of several nodes organized into racks, each node running a for the MapReduce tasks and a for the distributed storage system. One special node, the Master-Node runs the JobTracker and the NameNode which are organizing the distribution of tasks and data. Hadoop Framework The Hadoop Framework is written in Java but can run MapReduce programs expressed in various languages, e.g. Ruby, Python and C++. This functionality is implemented using Unix standard streams, the input for the Map function is streamed to the program which implements it, no matter which language it is implemented in as long as it can read and write from standard input and to standard output. Another way to achieve this is with the Hadoop Pipes, an interface to C++ which uses sockets for the communication with the Map and Reduce functions.

4 The central parts of the framework are in the Common module which contains generally availabe interfaces and tools to support the usage of the other modules. These modules include MapReduce, a framework to distribute the processing of large data sets on compute clusters, and HDFS, the Hadoop Distributed Filesystem which enables large clusters to save and access data with high throughput. Communication In every cluster running Hadoop there is one node addressed as the Master- Node. This node constitutes a single point of failure which is why Hadoop is not a high-availability system. Communication from outside of the cluster is completely handled by the Master-Node, because it keeps all the necessary information about the cluster, usage of the nodes, disk-space and distribution of files. Every MapReduce task is sent to the MasterNode where the JobTracker, the component that manages the MapReduce jobs, and the NameNode, which is responsible for everything concerning the filesystem, are running. The JobTracker communicates with Task- Trackers on the nodes which receive work units and send reports about their status back to the JobTracker. The work of the JobTrackers is explained in detail in section 3 and the general layout of the communicating modules is shown in figure 1 on page 3. The NameNode is explained in section 4. Cluster A Hadoop-Cluster typically consists of 10 to 5000 nodes and is subdivided into racks by a two-level network topology[3] as shown in figure 1 on page 3. The frameworks configuration should include information about the toplogy to allow the underlying filesytem the use of the location for its replication strategy. Also it allows the framework to place MapReduce tasks at least near the data they operate on if it happens to be impossible to place the task at the same machine because that way the not-so-precious in-rack bandwith is used. 3 MapReduce The MapReduce module of the framework and its underlying technique of splitting the work in a map- and a reduce-phase are explained in detail in this section. The examples mentioned here are more thoroughly clarified in section 5. Programming Model The following quote from [1] summarizes the programming model: The computation takes a set of input key/value pairs, and produces a set of output key/value pairs. The user of the MapReduce library expresses the computation as two functions: Map and Reduce.

5 The division into the two phases, Map and Reduce, permits the framework to distribute the work without respect to the amount of data or the number of nodes operating in parallel. Every Map operation is self-contained and the Reduce tasks get all output data for one key so there is no overlapping in the work of the Reduce tasks. The following sections explain the Map and Reduce phase in more detail. Map The Map function as used by MapReduce is provided with a list of key-value pairs as input data and returns a list of key-value pairs as its output. The keys and values from the input do not need to be of the same type as the output. All values are then grouped and sorted by the key and sent to the Reduce function. It is optionally possible to call a user-defined Combine function before the data is sent to minimize the usage of bandwith. The Combine function is mostly the same as the Reduce function but is only applied to the output of one Map task at once. In the word-count example in section 5, a combiner would sum up the counts for every word so instead of sending lots of pairs of the form (word, 1) it would just send one pair for each word. Conventionally the Map function in functional programming languages takes a list of values and applies a mapping function to every value. For example if there is a function square x = x x and we call map square [1, 2, 3, 4] we get [1, 4, 9, 16] as the result. As stated in [2], there is no trivial correspondence between MapReduce s MAP & RE- DUCE and what is normally called map & reduce in functional programming. Also, the relationships between MAP and map are different from those between REDUCE and reduce. (MAP is meant to address the MapReduce s Map function while map stands for the map function as known from functional programming. The same goes for the Reduce function.) Reduce The Reduce function in the context of MapReduce is invoked with the intermediate output of the Map functions, grouped and sorted by the key. These values are typically merged together and a possibly smaller amount of key-value pairs is produced as output. In functional programming languages the Reduce function takes a function as first argument and a list of elements as the second. Then the elements are recursively combined by applying the function to the first argument and the result of combining the rest. An example would be the calculation of the sum in the following way: We have a function add x = x+1 and call reduce add [1, 2, 3, 4], as a result we get the sum of 10.

6 Data flow When a MapReduce job is started in a Hadoop cluster the number of reduce tasks is equal to the number of reducers specified by the programmer. The number of map tasks, on the other hand, depends on many factors: the number of mappers specified by the programmer serves as a hint to the execution framework, but the actual number of tasks depends on both the number of input files and the number of HDFS data blocks occupied by those files. (from [4]) Input 1 Input 2 Map 1 Map 2 Map 3 m1 r1 m1 r2 m2 r1 m2 r2 m3 r1 m3 r2 Sort 1 Sort 2 Reduce 1 Reduce 2 Output 1 Output 2 Fig. 2. Data flow in a Hadoop Cluster. The input data is passed to the Map jobs which apply their function and output key-value pairs grouped by the key and sorted. Every Reducer gets the pairs for one key and outputs the processed data into the distributed storage. For some tasks only one Reduce invocation is necessary, for example if the result of a computation is only a sum of a lot of input values. The input data normally is already in HDFS, the Hadoop Distributed Filesystem which will be

7 explained in section 4, so the Map tasks are assigned to the machines which hold the relevant data. This method is used to reduce the utilized bandwith and is often referred to as data locality or location awareness. The general data flow for two input blocks, three Map tasks and two Reduce tasks is shown in figure 2 on page 6. The Map tasks apply their function to the input data and write it to their local storage so the Reduce tasks have to fetch it when they need the data. Before the data is written to disk it is implicitly sorted and grouped by the key as stated above. The data is written locally because of the anticipatory scheduling of tasks as explained in 2. If several Map tasks worked on the same data the reduce tasks would receive every information several times which would consume a lot of bandwith. After the Reduce tasks have finished their work the output is normally written to the distributed storage as it may be the same size or even bigger than the input data and therefore cannot be safely stored to local storage. 4 Hadoop Distributed Filesystem The Hadoop Distributed Filesystem is designed to be fault-tolerant in an environment with thousands of nodes which are likely to fail and to provide high throughput access to data [7]. This section explains the advantages of the filesystem in association with the MapReduce module. General In a distributed system with a large number of nodes of commodity hardware failure is the biggest problem to cope with. HDFS approaches this by replicating the data to three nodes by default, one of which is to be in another rack to make sure the data is available when a network link fails and a complete rack goes offline. The filesystem allows for files with a size of tens of petabytes but restricts the usage of the files to streaming-access because the time to read the full dataset (or large portions of it) is more important then latency in reading the first record. (from [3]) Other filesystems such as the CloudStore 2 or the Amazon Simple Storage Service 3 can be used instead of HDFS too, the framework provides an abstract class and several implementations for different storage systems. Filesystem Details The filesystem uses Blocks as the smalles unit of data that can be read or written. The size of a block defaults to 64 megabytes which is comparatively big 2 see http://kosmosfs.sourceforge.net/ 3 Amazon S3, see http://aws.amazon.com/s3/

8 but ensures that a Map task does not need to read data from other machines because one block can not be spread out over several nodes. From this it follows that for a cluster of 1000 nodes you need at least 1000 blocks of input data for a task to occupy every node in the cluster. In case of failure of a node the Master-Node asks the holders of the remaining copies of the lost-blocks to replicate the blocks again to bring the replication factor back to the desired level. This is necessary because Hardware failure is the norm rather than the exception. An HDFS instance may consist of hundreds or thousands of server machines, each storing part of the file system s data. The fact that there are a huge number of components and that each component has a non-trivial probability of failure means that some component of HDFS is always non-functional. (from [7]) HDFS Structure An Hadoop cluster running HDFS as a filesystem always has a central Name- Node as shown in figure 1 on page 3 which handles the data distribution and any operations on the data. It communicates with the which is running on every connected node and performing the disk access. Every periodically reports a list of its blocks to the NameNode so the NameNode does not need to write this information to disk all the time. The NameNode just persistently stores information about the filesystem-tree and the metadata of the files. The s are responsible for serving read and write requests from the file system s clients. The s also perform block creation, deletion, and replication upon instruction from the NameNode. [8] The read- and writerequests from clients are managed by the NameNode but executed by the Data- Nodes because the NameNode has the filesystems metadata and knows which nodes store the requested blocks. The user data is never going through the NameNode because this would quickly saturate its network connection. 5 Examples This section lists some use-cases for the convenient utilisation of the MapReduce programming model. Counting Words This is the most commonly used example to explain the usage of the Map and Reduce functions. It takes the input text and sums up counts for every appearing word. Optionally the Reduce function can be installed as a Combiner class to save bandwith. It sums up all counts of one map task before the result is sent.

9 1 v i r t u a l void Map( const MapInput& input ) { 2 const s t r i n g& t e x t = input. value ( ) ; 3 const int n = t e x t. s i z e ( ) ; 4 for ( int i = 0 ; i < n ; ) { 5 // Skip p a s t l e a d i n g whitespace 6 while ( ( i < n ) && i s s p a c e ( t e x t [ i ] ) ) 7 i ++; 8 9 // Find word end 10 int s t a r t = i ; 11 while ( ( i < n ) &&! i s s p a c e ( t e x t [ i ] ) ) 12 i ++; 13 14 i f ( s t a r t < i ) 15 Emit ( t e x t. s u b s t r ( s t a r t, i s t a r t ), 1 ) ; 16 } 17 } 1 v i r t u a l void Reduce ( ReduceInput input ) { 2 // I t e r a t e over a l l e n t r i e s with the 3 // same key and add the v a l u e s 4 i n t 6 4 value = 0 ; 5 while (! input >done ( ) ) { 6 value += StringToInt ( input >value ( ) ) ; 7 input >NextValue ( ) ; 8 } 9 10 // Emit sum f o r input >key ( ) 11 Emit ( IntToString ( value ) ) ; 12 } Sorting of large Datasets Sorting in Hadoop normally is an implicit merge-sort which is done by the framework and does not need to be implemented. In the examples supplied with the Hadoop source code the Map and Reduce functions are left empty, there is only a special partitioning function which tries to find evenly distributed partitions based on a sample of a small subset of the keys. The sorting takes place on the nodes which perform the (empty) mapping function and the result of this process is merged together by the reducers. Inverted Indexing An inverted index is an index data structure which in this example maps words to document IDs, one of the obviously common operations google needs to do

10 to provide the searchengine with new content. In [1] the method is explained by the following quote: The map function parses each document, and emits a sequence of (word, ID) pairs. The reduce function accepts all pairs for a given word, sorts the corresponding document IDs and emits a (word, list(id) pair. The set of all output pairs forms a simple inverted index. It is easy to augment this computation to keep track of word positions. Two-way Join As explained in [5] the two-way join of two relations R(A, B) and S(B, C) can be expressed as a MapReduce task by the following steps: 1. Mappers read input from the files containing R and S 2. Tuples (a, b) from R are mapped to key-value pairs with key b and value (a, R) 3. Tuples (b, c) from S are mapped to key-value pairs with key b and value (c, S) 4. The Reducers combine tuples from R and S that have a common B-Value 5. The combined tuples are written to disk References 1. Dean, J., Ghemawat, S.: MapReduce: simplified data processing on large clusters. Proceedings of the 6th Symposium on Operating System Design and Implementation (OSDI 2004), 137 150 (2004) 2. Lämmel, R. Google s MapReduce programming model Revisited. Sci. Comput. Program., vol. 68, issue 3, 208 237 (2007) 3. White, T.: Hadoop: The Definitive Guide. Second Edition, Yahoo Press, (2009) 4. Lin, J., Dyer, C.: Data-Intensive Text Processing with MapReduce (Synthesis Lectures on Human Language Technologies). Morgan and Claypool Publishers (2010) 5. Afrati, F. N., Ullman, J. D. Optimizing joins in a map-reduce environment. 13th International Conference on Extending Database Technology, 99 110 (2010) 6. Internet Archive http://www.archive.org/about/faqs.php (Retrieved: 2010-12-09) 7. Apache Hadoop http://hadoop.apache.org/ (Retrieved: 2010-12-12) 8. Apache Hadoop http://hadoop.apache.org/hdfs/docs/current/hdfs design.html (Retrieved: 2010-12-12)