MapReduce Job Execution Process – Reduce Function

Hi Hadoopers,

We are in 6th circle today, which is the reducer function. A job is submitted by the user, which has been initiated in 2nd circle for which the setup is completed in 3rd circle.

Map Task was executed in 4th circle and sort & shuffle was completed in 5th circle.


The reducer will collect the output from all the mappers to apply the user defined reduce function.


  1. Task tracker launches the reduce task
  2. Reduce task (not reduce function) read the jar and xml of the job.
  3. It execute the shuffle. Because the time the reducer task started, all the mappers may not have completed the job. So it goes to individual mapper machines to collect the output and shuffles them.
  4. Once all the mapping activity is finished it invokes the user reducer function (one more reducers).
  5. Each reducers will complete their jobwrite the output records to HDFS.
  6. Those output would be stored in temporary output file first.
  7. Once all the reducers have completed their job, final output would be written to the reducer partition file.

MapReduce Job Execution Process – Sort & Spill

Hi Hadoopers,

Mappers run on individual machines and prepare intermediate results. They accept splits as inputs. Reducer accepts partition of data as inputs.  Preparing the partitions from the intermediate mapper results is the responsibility of this sort & spill phase, which is the 5th circle given below.



During this phase, we find the keys from all the mappers, sort and shuffle them before sending them to one machine, where the reducer will run.


  1. The task tracker 1 initiates a reducer task.
  2. TT1 updates the job tracker about the completion status.
  3. Similarly TT2 or any other task trackers also updates the Job Tracker about completion status.
  4. The reducer task goes to TT1 where the mapping task is finished to collect the interim results.
  5. TT2 read the mapper output streams it to the reducer
  6. Task 4 and 5 is repeated for other task trackers also who are all involved in mapping tasks.
  7. Once the reducer received all the mapping results, it performs a sorting and spilling.


MapReduce Job Execution Process – Map Task Execution

Hi Hadoopers,

The user had submitted his job. He has permissions. We have slots in the cluster. Job setup is completed. We look at 4th circle given below – The Map Task Execution



The below given diagram depicts the Map Task Execution.


  1. The task tracker launches the Map  Task
  2. The Map task read the jar file given the user. This is what we write in Eclipse. In the entire frameworks, this is what our contribution 🙂
    The Map task also reads the job config (input path, output path etc). It gets everything from HDFS, as all these are already uploaded to HDFS initially.
  3. The Map task reads the input splits from HDFS
  4. From the input splits, Map task creates the record.
  5. The Map task invokes the user Mapper with the record
  6. The mapper writes intermediate output
  7. The task sort them based on key and flush them to disk.
  8. Map task informs Task Tracker about the completion of the job.

MapReduce Job Execution Process – Job scheduling

Hi Hadoopers,

We shall talk about 3rd circle today, as we talk about Job submission and Job initialilzation already.


Scheduling the jobs is an interesting concept. I’m really excited to see the communication between Scheduler, Job tracker and  Task tracker.


  1. The task tracker keeps on sending heartbeats to Job Tracker about the status of the job. So, it says to Job Tracker that job is completed and it wants more jobs.
  2. Job Tracker updates the task status and make a note of Task Tracker’s message.
  3. Job Tracker goes to Scheduler asking for tasks.
  4. Scheduler updates the tasks scheduler record. Based on job scheduling policy, either it makes the job client to wait or process the job. It is based on execution policy, priority etc.
  5. Job tracker gets the task.
  6. It submits the task to the task tracker.

Map Reduce 1 – Insight

Dear fellow Hadoopers,

After a quick introduction to HDFS, my instructor started Map/Reduce concepts today. I could realize that he touched upon many concepts in a short sessions. Here is what I scribbled down.

M/R – As the name implies, it has two parts.

  1. Map
  2. Reduce



  • These are java programs written using M/R algorithm
  • Mapping programs runs on each block of big data file
  • Transformation of data, picking the URL from a web server access log file


  • These are also java programs writting using M/R algorithm
  • We do aggregations with reduce
  • The output of mapping becomes the input of Reducing.
  • We do many type of aggregations to arrive at the right results required by business logic
  • A good example is how many requests received for a particular URL of a web server.

M/R Process flow

The following gives an example of the MR process flow.


M/R 1 process flow example

We have many words in a block of a big data file. This is our input.

During the split phase, Hadoop reads the input sequentially. K1 is the key and V1 is the value. Each value denotes each record in the input.

Mapping takes the output of split and parse the content. It makes a K2 and V2 key value pair, denotes the word and number of appearance.

The process is moved to shuffling phase, where we give the K2, V2 to prepare the word and its appearance.

This output of shuffling is given to reduce process where aggregation is performed and final result is k3, v3 list is prepared.


M/R 1 Task Execution

  1. We launch the job from client to Job tracker
  2. Job tracker is running on a server class machine
  3. Job tracker can submit the job to each task tracker on data nodes.
  4. It can monitor the jobs on all nodes.
  5. If it is preferred, it can kill the tasks.