Docsity

Building MapReduce from Scratch: A College Project, Study Guides, Projects, Research of Programming Languages

Partial preview of the text

Download Building MapReduce from Scratch: A College Project and more Study Guides, Projects, Research Programming Languages in PDF only on Docsity!

CMSC 433

Building Map Reduce November 27th, 2007

Rest of the semester

Open Source contribution project

due Dec 4th

Homework 5: a simple Hadoop project

due Dec 6th

Project 4: implementing Map Reduce from scratch

due Dec 11th

Final project

Bigger than other projects (about 1000 lines of code)

Not going to be spoon fed

leave a lot of the details up to you, much of the suggested implementation strategies are just suggestions

Not many unit tests, mostly end-to-end tests

Simplifying assumptions

We have a distributed reliable file system

MapReduce is build on top of Google File System

We don’t worry about file system failure

We don’t have to worry about locality, all files are equidistant from all processors

Common/shared code base; don’t need to worry about shipping map/reduce code to cluster nodes

Master / JobRunner

One master node: job is submitted here

JobRunners: available to run any MapReduce tasks, announce their availability by broadcasting a ServerLocation every second

Master listens for announcements, waits until it has enough job runners or until 10 seconds elapse

Input/Output formats

We will use text files as our input source

all files in a directory that have a name ending in .txt

handle all line ending encodings

Write output files into an output directory using Object serialization

a set of files, each of which consists of

key1, value1, key2, value2, ...

JobRunner

Listens for connections on a server socket

Accepts a connection, uses an ObjectInputStream to read a task, executes it

send back a heart beat

false, false, false, ..., false, true

one value per second

Mapper input

In theory, the input to the mapper could be anything

In practice, we are going to only handle splits of text files

InputKey is a FileIndex (contains a File and a position)

InputValue is a String (which starts at that file index)

File Splitting

OK, we have a set of files, each of variable length

We have a desired # of ranges to split it into

Consider the following situation:

10 splits requested

one file containing 1 gigabyte of data

9 files containing 100 bytes of data

Uneven splits

If asked for m splits of n files

generate m full sized splits,

each no bigger than ceil (totalSize/m)

up to n small splits

Exact details up to you

How are we going to do this

efficiently?

Hint: having each Map task reading each line of text, starting at the beginning of the file, until it gets to the right position, is not efficient

Tasks

The tasks that sent to JobRunners are tasks

each has an id, a unique number

we will use the numbers to ensure that each task writes to distinct files, and to allow us to clean up or ignore output of failed jobs

Phase 1 files

Map task writes all generated key/value pairs, in sequence, to

phase1/{partition#}/{taskID}

Separate file for each partition

each key,value pair written to the file for its partition

Reduce task

Assigned a partition

Read all files in phase1/{partition#}

exclude any files from failed jobs

Might be too big to fit all into memory

we are thinking “big”