Yarn Interview Questions

Yarn Interview Questions | Freshers & Experienced

  • Sharad Jaiswal
  • 12th Feb, 2021

Key Features of Yarn

Below are few major features of Yarn

Global ResourceManager

Supports Multi-tenancy

Multiple resource types

Scalability and Compatibility

Docker containerization

Cluster utilization

Backed by Facebook Team

Supports variety of processing engines

NodeManager slave

Yarn Interview Questions

Q1. What is Yarn?

Yarn (Yet Another Resource Negotiator) is a type of package manager that replaces the existing workflow for the npm and other package managers but still remains compatible with the npm registry. Yarn also works as a project manager to create safe, stable, and reproducible projects.

This open-source JavaScript package manager is developed by Facebook. Your current npm workflow can be totally replaced by Yarn with minimal effort.

Q2. What are the components of yarn?

The components of Yarn are,

Resource manager

It is used to manage resources that are used across the cluster. It has two components namely Scheduler and Application manager. Scheduling of the resources based on the requirements of the application is done by the scheduler. The application manager manages the execution of the application master in the cluster.

Node manager

It is responsible for the execution of the task in each node.


These are the set of resources like RAM, CPU, and Memory present in the node. These resources are scheduled by the Resource manager and monitored by the Node manager.

Application Master

The application master monitors the execution of tasks and manages the lifecycle of the applications running on the cluster.

Q3. What is use of yarn in Hadoop?

In the Hadoop framework, Yarn is used for resource management and job scheduling. It allocates the system resources to various applications running in the Hadoop cluster. It also schedules the task that is to be executed on different clusters. The Yarn sits between the HDFS and the processing engine in the Hadoop architecture. It allocates the resource dynamically so it improves resource utilization and application performance.

Yarn uses scheduling methods that are based on the queue format for submitting the jobs.

Q4. Enlist few difference between yarn and NPM?

NPM (Node Package Manager) is a package manager for JavaScript. It presents a command-line interface to the npm system which the users can use to install different JavaScript packages to their application. It is considered as the best package manager by the JavaScript community.

Some of the companies that use the npm package manager are Reddit, Instacart, and Starbucks.

YARN (Yet Another Resource Negotiator) is a new package manager for JavaScript. Yarn caches every package it downloads. So the package need not be downloaded again. Yarn uses parallel operations so the resource utilization is maximized and the install times are faster. StackShare, Docplanner, and BrightMachine are some of the companies that use the YARN package manager.

Q5. Explain Resource Manager In YARN?

The resource manager is a core component in Yarn that manages the different resources among all applications. It arbitrates all the available resources and helps manage the distributed application run on the YARN system.

The two main components of the resource manager are the Scheduler and Application Manager.

The scheduler in the Resource manager is responsible for allocating resources. It schedules the resource-based on the resource requirement of the applications.

The application manager is responsible for accepting the job-submissions and execution of the application-specific application master.

Q6. What is ApplicationMaster in YARN?

The application master in the YARN is responsible for the execution of a single application. It gets the resource from the Resource Scheduler and executes the application. It is a framework-specific library that knows the application logic and executes the application scheduled by the Yarn scheduler.

Q7. How to add dev dependencies in yarn?

To add a dependency, you should use the command "yarn add {package-name}" specified by the package name of the required dependency. It installs the package and also updates the dependency in the package.json file and yarn.lock.

Q8. What is yarn command?

YARN comes with a list of CLI commands to execute different things like installation, administration, and publishing. You can run a user-defined script by executing the 'yarn' command. You can also execute a list of predefined commands using the Yarn.

Some of the popular Yarn commands are,

  • Yarn add - adds a new package.
  • Yarn init - initializes the development of a package.
  • Yarn install - installs the dependencies defined in the package.json file
  • Yarn remove - removes the package

Q9. What are the YARN responsibilities?

YARN is responsible for two activities:

Responding to a client’s request to create a container(A container is in essence a process, with a contract governing the physical resources that it’s permitted to use).

Monitoring containers that are running, and terminating them if needed(Containers can be terminated if a YARN scheduler wants to free up resources so that containers from other applications can run, or if a container is using more than its allocated resources).

Q10. What Are The Scheduling Policies Available In Yarn ?

YARN scheduler is responsible for scheduling resources to user applications based on a defined scheduling policy. YARN provides three scheduling options - FIFO scheduler, Capacity Scheduler, and Fair scheduler.

FIFO Scheduler - FIFO scheduler puts application requests in queue and runs them in the order of submission.

Capacity Scheduler - The capacity scheduler has a separate dedicated queue for smaller jobs and starts them as soon as they are submitted.

Fair Scheduler - Fair scheduler dynamically balances and allocates resources between all the running jobs.

About Author :

  • Author of Yarn Interview Questions

    Sharad Jaiswal

    My name is Sharad Jaiswal, and I am the founder of Conax web Solutions. My tech stacks are PHP, NodeJS, Angular, React. I love to write technical articles and programming blogs.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.