YARN: Hadoop's Cluster Operating System
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.
Read the original → hadoop.apache.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.