From Big Data to the Cloud, Part 2.2

From Big Data to the Cloud, Part 2.2

Leader ●9 ●30 ●73
calendar_today ago • schedule4 min read

Part 2.1 opened the two Hadoop components that touch the data directly. HDFS cut a 400 MB file into four blocks, spread them across the cluster, and kept three copies of each, so that a failing DataNode — announced by its missing heartbeat — costs us nothing. The NameNode holds the map of which block lives where, with a Standby ready to take over in a High Availability setup. MapReduce then processed that data where it already lay: Map on each node’s own piece, Shuffle & Sort to bring each key’s values together, Reduce to combine them. We ran it by hand twice — counting words and averaging ages — and watched the right answer appear without any single node ever seeing the whole file.

But Part 2.1 left one of Part 1’s three questions open, and it made an assumption to get past it. Every time we said “the program runs on the node that holds the data,” we skipped over who arranges that. Something must decide which machine runs which task, how much CPU and memory each task may use, and how several jobs share one cluster without trampling each other. That is Part 1’s remaining question — how do the nodes communicate and coordinate? — and this part answers it.

We do it in two steps. First we open the last core component, YARN, and meet its four parts. Then we put everything from Part 2 to work at once and follow a single job through the cluster, from the moment it is submitted to the moment it finishes. And at the very end, with the whole of Hadoop finally in view, we take one honest step back and name the burden it still leaves on our hands — because that burden is where the cloud begins.


Chapter 1: YARN — Who Gets Which CPU and Memory

The Cluster’s Resource Manager
HDFS gave the data a home, and MapReduce gave us a way to process it. But a cluster is shared. Several jobs may want to run at the same time, and every one of them needs CPU and memory on some machine. Something has to decide who gets what. That is YARN, Yet Another Resource Negotiator: it manages the cluster’s resources (CPU, memory) and schedules jobs. In the layered stack from Part 2.1, it is the middle layer — above the data in HDFS, below the processing in MapReduce — and it is the answer to Part 1’s open question: how do nodes communicate and coordinate?

YARN has a second, quieter importance. It separates resource management from processing. Because YARN only hands out resources and does not care what runs on them, processing engines other than MapReduce — Apache Spark, for example — can run on the same cluster. This matters because Part 1 listed one of Hadoop’s limitations as being designed for batch processing, with Spark better suited to real-time work. YARN is what lets both live on one cluster.

Four Parts

  • ResourceManager (master): allocates resources across the whole
    cluster.

  • NodeManager (one per node): manages the resources on its own machine
    and reports to the ResourceManager.

  • ApplicationMaster (one per job): coordinates and monitors the tasks
    of one application.

  • Container: a bundle of CPU + memory where a task actually runs.

The pattern should look familiar from Part 2.1. HDFS had one master (the NameNode) and many workers (the DataNodes). YARN has one master (the ResourceManager) and many workers (the NodeManagers). What YARN adds is a manager per job — the ApplicationMaster — so that the cluster-wide master never has to babysit the details of every individual job.

Who Is Inside Whom
Four parts from YARN plus two from HDFS is a lot of names, and the fastest way to untangle them is to ask where each one physically lives.

Cluster
├── Master machine
│   ├── ResourceManager
│   └── NameNode
└── Worker machine
    ├── DataNode      → stores blocks
    └── NodeManager
        └── Containers → one of them may hold the job's ApplicationMaster

Chapter 2: Running a Job, Step by Step

Six Steps
We now have every piece. The last thing to see is how they move together when a single job runs. There are six steps.

  1. Submit. The client sends the job to the ResourceManager.

  2. Start a manager. The ResourceManager starts an ApplicationMaster for this job, on any free node. From here on, this job has its own manager.

  3. Find the data. The ApplicationMaster asks the NameNode: “Where is my data?” The NameNode, holding the map, answers with the machines that hold each block.

  4. Ask for workers. The ApplicationMaster asks the ResourceManager for containers — ideally on the nodes that hold the data.

  5. Do the work. The NodeManagers start the containers, and each task reads data from its own machine.

  6. Finish. The ApplicationMaster and the containers are removed. The main services — the ResourceManager, the NameNode, the NodeManagers, the DataNodes — keep running for the next job.

Where Each Component Shows Up
It is worth reading the six steps again, this time watching which component does what.

Steps 3 and 4 are where the whole design pays off. The NameNode knows where the data is; the ResourceManager knows where the free resources are; the ApplicationMaster puts the two together and asks for containers on the machines that already hold its blocks. So in step 5, each task reads from its own machine’s disk instead of pulling data across the network.

This is also the moment the assumption from Part 2.1 is paid off. When the word-count example said “the three lines go to three different nodes,” this is what was really happening underneath: an ApplicationMaster asked the NameNode where the data was, and asked the ResourceManager for containers on exactly those nodes.

To read the full article, you can visit the link : https://husseinmahdi.xyz/writing/big-data-2-2/

References:

Related articles : https://husseinmahdi.xyz/writing/series/from-big-data-to-the-cloud/
Deshpande, T., Karanth, S., & Turkington, G. Hadoop: Data Processing and Modelling (Learning Path). Packt Publishing.
Oracle. What Is Big Data? https://www.oracle.com/big-data/what-is-big-data/
Big Data — Understanding Hadoop: Architecture, Features, Challenges & Applications. Medium. https://medium.com/@rp99452/big-data-understanding-hadoop-architecturefeatures-challenges-applications-c7ab7011e375
Mehta, C. B. (2022). A Comprehensive Review of Hadoop Ecosystem for Big Data Processing and Analytics. IJNRD, 7(10).

Want more #ai & #programming deep dives?

Join 6,106+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

From Big Data to the Cloud, Part 2.1 — Inside Hadoop: HDFS and MapReduce

Hussein Mahdi - Nov 1

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

A Message From Our Founder: On the Winding Down of LaaSy™

Ken W. Algerverified - Oct 29

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23
chevron_left
5.4k Points • 112 Badges
20Posts
79Comments
15Connections
Research Engineer at @Era-Vision.| .NET | Java | Efficient Deep Learning | Complex & Higher-Order Networks | https://husseinmahdi.xyz

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!