Yarn Apache Hadoop


Yarn (MapReduce 2.0 or MRv2) is a resource negotiator, which is upgraded version of MapReduce is a cluster management technology. Yarn is set up by splitting the functionalities of Resource Manager and Job Scheduling/Monitoring into different daemons.

Resource Manager: - There is a single RM per cluster which manages the resources across the cluster.

Node Manager: - Node Manager runs on all the nodes of the cluster. The main task of node manager is to launch and monitor the containers.

Yarn Job run
       
     RM has two main components mainly named as Scheduler and Application Master (AM). The main task of RM Scheduler is to allocate the resources to the jobs/applications submitted to the cluster. The RM scheduler is termed as pure scheduler as it just performs allocating the resource task and does not perform any monitoring or tracking of the jobs/applications running on the cluster. The scheduler does not offer any guarantee in restarting the failed jobs either in due to application failure or hardware failure. The scheduler performs the allocation of the resources on the requirements of the applications, it does so on the notation of resource Container which allows allocating the resources like memory, CPU, disk etc. There are different types of scheduler available like capacity scheduler or fair scheduler. These scheduler uses the plug-in to partition the cluster resources as per the requirement of the jobs/applications. Consider an example; we can use pool quota allocation in case of the fair scheduler to provide the different sets of resources to the jobs/applications.
    RM of Application Master, is responsible for accepting, submitting the jobs to the cluster and negotiate the first container required to submit the jobs for the execution. AM is responsible for restarting the AM container on the failover condition, monitor status of the jobs. The main responsibility of the AM is to negotiate the resources, track/monitor the status of the jobs.

Comparison between Yarn and MR1
           In MR1 the job execution is control by a job tracker and one or more task trackers. The main task of the job tracker is to coordinates all the jobs running on the cluster and schedule tasks on the task tracker. Task tracker runs the tasks and sends the report of the progress to each and every job to the job tracker. If any job fails job tracker reschedule the job on a different task tracker.
In MR1, job tracker takes care of scheduling and monitoring the job. Whereas in Yarn, Resource Manager handles the scheduling requests and Application Master handles the progress of the job (one for each MapReduce job).

           Fig1: Comparison between MR1 and Yarn

What are the benefits of using Yarn over MR1:-

 Scalability – Yarn can runs on larger cluster than MR1. MR1 hits scalability bottlenecks in the region of 4,000 nodes and 40,000 tasks. Yarn overcomes this limitation by virtue of its split RM/AM architecture. It can scale up to 10,000 nodes and 1,00,000 tasks.                    Availability – Yarn makes the service HA (High Available) by splitting the job between RM and Application Master.
               
Scheduling in YARN:-
         There are three different types of the scheduler yarn FIFO, capacitive and fair scheduler.
          FIFO – it places the jobs/applications in a queue and runs them in order of submitting the applications/jobs.  It will allocate the resource to the first job in the queue and then will allocate the resource to the next job when the first job gets completed.
               Capacitive – in the capacitive schedulaer there is a separate set of the queue which allows the smaller job to be started once it is submitted. The larger job will take more time to complete and will finish later as compared to when submitted with FIFO scheduler.
yarn2   
        Fair— Fair scheduler is the most important scheduler is Yarn. No need to reserve a set amount of capacity, as it allocates the resources on the run time of the job. When first (large) job starts it will allocate all the resources to this job. When second (small) job gets start it allocates the half amount of the resources to the second job and balance the fair share.
yarn3
There will be a lag between the submit time and start time of the second job, as fare scheduler has already provided all the containers to the first job and second jobs needs to wait for the containers to get free. Once the small job gets complete fair scheduler again re-allocate all the resources and containers to the first job. In order to provide the containers and resources to the small job fair scheduler terminated the resources which need to be allocate to the second job and re execute them.

Preemption
      When the job is submitted to the empty queue of the cluster, and all the resources are already occupied by the another queue. Resources must be free for the new job to start once it submits on the cluster. Preemption is supported by the fair scheduler to make the job’s start time more predictable.
Preemption allows scheduler to kill the containers for the queue that are running more than their fair scheduler. Efficiency of the cluster is reduced by using preemption as terminated containers needs to be re-executed. There are two types of preemption time out setting, one is for minimum share and other time out second is for fair share. Timeout can be keep in seconds.

Comments

Popular posts from this blog

DistCp2

Big Data Intro

Big Data Intro Part-2

DistCP

HDFS Part -3

Hadoop Learning

HDFS Part -1

HDFS Part -2