Skip to content
tezvyn:

YARN: Hadoop's Cluster Operating System

Source: hadoop.apache.orgMediumHow cards are made

YARN acts as the operating system for a Hadoop cluster, separating resource management from job processing. This allows multiple engines like Spark or MapReduce to run on the same hardware.

Why it exists

Before YARN, the original Hadoop MapReduce framework tightly coupled resource management with its specific processing logic. This created a bottleneck and restricted clusters to running only MapReduce jobs. YARN was created to split these functions, turning a Hadoop cluster into a general-purpose, multi-tenant data platform capable of running many different applications.

The mental model

Think of YARN as the operating system for your data center. Your laptop's OS manages which applications get CPU and RAM. YARN does the same for a cluster of machines, arbitrating resources for distributed applications like Spark, Flink, or MapReduce. It doesn't run the apps itself; it just gives them a place to run and the resources they need.

How it works

YARN splits resource management and job monitoring into separate daemons. A global ResourceManager (RM) is the ultimate authority for all cluster resources. On each worker machine, a NodeManager (NM) agent is responsible for managing that machine's resources. When you submit an application, the RM launches a per-application ApplicationMaster (AM). This AM negotiates with the RM's Scheduler for resources, which are granted as 'Containers' (abstract bundles of CPU, memory, etc.). The AM then works with the NodeManagers to launch and monitor the tasks within these containers.

When to use it

Use YARN when you need to run multiple, different data processing frameworks on a single shared hardware cluster. It provides resource isolation, queuing, and scheduling policies (like Fair or Capacity schedulers) to ensure efficient utilization and fair resource sharing across different users and applications. It is the foundation of modern Hadoop ecosystems.

When not to use it

While YARN is the default for Hadoop, if your workload is not a distributed data processing job (e.g., a fleet of web servers or microservices), a general-purpose container orchestrator like Kubernetes might be a more natural fit. YARN is purpose-built for the data-computation framework paradigm.

One canonical example

A user submits a Spark job to a YARN cluster. YARN's ResourceManager accepts the submission and launches a Spark ApplicationMaster in a container. The AM then requests 100 containers, each with 4GB of RAM and 2 CPU cores. YARN's Scheduler finds available slots on NodeManagers across the cluster and grants the containers. The AM then uses these containers to run Spark's distributed executors, which perform the actual data processing. YARN just provided the playground; Spark played the game.

Interview question

What is the primary benefit YARN provides in a Hadoop ecosystem?

  • a.Simplifying the development of distributed applications by offering a unified programming interface.
  • b.Optimizing data storage and retrieval by replacing HDFS with a more efficient file system.
  • c.Directly performing the computational tasks for all submitted data processing jobs.
  • d.Allowing different data processing frameworks, like Spark and MapReduce, to share the same cluster hardware.Correct
Why?

YARN's fundamental role is to separate resource management from processing logic, enabling multiple diverse data processing frameworks to run concurrently on a shared cluster. It does not directly execute tasks or provide programming APIs, nor does it manage data storage.

Just read this? Test yourself on what you have been reading.

Read the original → hadoop.apache.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles