How Hadoop solved each problem

Every component of Hadoop exists because of a specific problem: data that doesn't fit, disks that die, jobs that take days, a jammed network, mountains of plumbing code, and a master that must not fail. This lesson maps each problem to its fix, runs a tiny MapReduce in Python so you see exactly which part you write and which part Hadoop does, and ends with the problems Hadoop never solved, which is why Spark and other tools exist.

Module 2 · Why Hadoop was born⏱ 25 minBeginner → AdvancedFull-feature playgroundTiny MapReduce in PythonStrengths and limits8 practice problems
1 The story

Riya's problem list, ticked off one by one

On the whiteboard, Riya has written every problem BharatSearch hit while growing: doesn't fit, disks die, too slow, network jammed, too much plumbing code, adding machines is painful, costs too much. Arjun Sir hands her a green marker. “For each one, write the part of Hadoop that fixes it. If you can fill this board, you understand Hadoop's architecture.”

Problem Hadoop's answer data doesn't fitHDFS blocks on many nodes disks and nodes die3 replicas + re-replication processing too slowMapReduce: parallel tasks network jammeddata locality too much plumbing codewrite map + reduce only growing is painfuladd nodes; NameNode tracks blocks Every part of Hadoop exists because of one line on this board. myphatshala.in
Riya

“Doesn't fit”: HDFS cuts files into blocks and spreads them over many machines.

Arjun Sir

Good. And “disks die”?

Kabir

Three copies of every block, on different racks. And the NameNode re-copies when a node dies.

Riya

“Too slow” is MapReduce: thousands of small tasks running at the same time. “Network jammed” is data locality.

Arjun Sir

And the one most people forget?

Kabir

“Too much plumbing.” We only write map and reduce, and Hadoop does the splitting, scheduling, retrying and merging.

Arjun Sir

Then I'll add two harder lines to your board: “the master is a single point of failure” and “only one kind of job can run”. Hadoop 1 couldn't fix those. Hadoop 2 did, with High Availability and YARN. Today we'll go through every line, see each fix in action, and then be honest about the problems Hadoop didn't solve.

2 Definition

Hadoop's architecture as a set of answers

Formal definition (write this in exams)

Apache Hadoop consists of four core modules. Hadoop Common: shared libraries and utilities. HDFS: a distributed file system that splits files into large blocks, replicates each block across DataNodes and racks, and keeps metadata on a NameNode, providing scalable, fault-tolerant, high-throughput storage. YARN (since Hadoop 2): a cluster resource manager that allocates CPU and memory as containers to many applications. MapReduce: a programming model and engine in which user-defined map and reduce functions are executed in parallel near the data, with the framework handling partitioning, scheduling, shuffling, sorting and failure recovery.

In simple words

Hadoop is four pieces. HDFS stores huge files safely across many machines. MapReduce processes them in parallel. YARN decides which job gets which machines' CPU and memory. Common holds the shared code. Each piece was built to fix a specific problem of big data.

Words you'll meet in this lesson

Hadoop CommonShared Java libraries, configuration and tools used by all other Hadoop modules.
HDFSHadoop Distributed File System: blocks + replicas on DataNodes, metadata on the NameNode.
YARNYet Another Resource Negotiator: shares the cluster's CPU and memory between applications.
MapReduceMap tasks turn records into key–value pairs; reduce tasks combine all values for each key.
Shuffle and sortMoving map outputs to reducers, grouped and sorted by key. Done by the framework.
Horizontal scalabilityCapacity grows roughly in line with the number of nodes added.
Schema-on-readStore raw data as it is; apply structure when reading it.
High Availability (HA)An active and a standby master, with automatic failover.

Problem → solution map

Data bigger than one machineHDFS splits files into 128 MB blocks across many DataNodes
Cheap hardware failsReplication (3, rack-aware), heartbeats, re-replication, checksums
Processing too slowMapReduce: one map task per block, thousands in parallel
Network too slow to move dataData locality: tasks scheduled on nodes holding the block
Distributed code is hardWrite map and reduce; the framework does splits, scheduling, shuffle, retries
Tasks fail mid-jobAutomatic re-execution (up to 4 attempts) and speculative execution
Need to growAdd nodes; the NameNode tracks every block, the balancer spreads data
Raw, messy dataHDFS stores any bytes: schema-on-read
Master is a single point of failureNameNode HA (Hadoop 2+), multiple standbys (Hadoop 3)
Only MapReduce could runYARN (Hadoop 2+): Spark, Tez, Hive and others share one cluster
3× storage is expensiveErasure coding (Hadoop 3): about 1.5× for cold data

The architecture at three levels

Pick your level. New to this? Start at Beginner and climb.

Beginner A courier company

  • HDFS is the warehouse network: parcels (blocks) stored in many warehouses (nodes), each parcel copied to three warehouses in different areas.
  • The NameNode is the head office register: it knows which warehouse holds which parcel, but never touches the parcels.
  • MapReduce is the sorting work: every warehouse sorts its own parcels by city at the same time (map), then all parcels for one city go to one hub (shuffle) to be counted (reduce).
  • YARN is the staff manager: it decides which team uses which warehouse workers today.

Intermediate How the pieces work together on one job

  • You copy a file into HDFS: the NameNode picks DataNodes, the client writes blocks to them in a pipeline.
  • You submit a job: YARN starts an ApplicationMaster for it.
  • The ApplicationMaster asks the NameNode where the input blocks are, then asks YARN for containers on those nodes.
  • Map tasks read their local blocks; outputs are shuffled to reducers; reducers write results back to HDFS.
  • Throughout, heartbeats let the masters notice failures and re-run work.

Advanced What Hadoop did not solve (and what came next)

  • Latency: MapReduce jobs take seconds to start and write intermediate data to disk. Interactive SQL came from Impala, Presto/Trino, Hive LLAP and cloud warehouses.
  • Iterative algorithms (machine learning, graph processing) reread data in every pass. Spark keeps working data in memory and became the main engine.
  • Streaming: MapReduce is batch-only. Kafka, Flink and Spark Structured Streaming handle real-time data.
  • Small files: every file and block costs NameNode memory. Mitigations: bigger files, HAR/SequenceFiles, compaction, federation.
  • Updates: HDFS files are write-once. Table formats like Apache Iceberg, Delta Lake and Hudi added updates and deletes on top of files.
  • Operations and security: running Kerberos, Ranger, upgrades and capacity planning takes skilled staff. Managed cloud services reduced this burden.

Exam tip: For “Explain the core components of Hadoop”, name all four (Common, HDFS, YARN, MapReduce), give each one's job in one line, and connect each to the problem it solves. Adding one line on Hadoop's limitations (latency, small files, iterative jobs) shows real understanding.

3 Types and ways to use it

The four core modules, side by side

Hadoop Common

Configuration system (core-site.xml), file-system abstraction, RPC, security, command-line tools. Everything else is built on it.

Foundation

HDFS

NameNode (metadata), DataNodes (blocks), optional standby NameNode and JournalNodes for HA. Commands: hdfs dfs ….

Storage

YARN

ResourceManager (cluster-wide scheduler), NodeManagers (run containers), one ApplicationMaster per job.

Resources

MapReduce

Java API (Mapper, Reducer, Job) and the engine that runs map, shuffle, sort and reduce as a YARN application.

Processing

Hadoop's strengths and limits

Hadoop is good atHadoop is weak at
Storing petabytes cheaply and safelyMillisecond lookups of single records
Scanning whole data sets in parallelInteractive queries with MapReduce (start-up cost)
Surviving hardware failures automaticallyMany small files
Raw and semi-structured data (logs, JSON, text)Updating records in place
Long-running batch pipelinesReal-time streams and iterative ML (without Spark etc.)

When someone asks “Can Hadoop do X?”, ask yourself which problem on Riya's board X belongs to. If X is about large, batch, throughput, Hadoop fits. If X is about small, instant, constantly changing, another tool is usually better, even if it stores its history in HDFS.

4 Step by step

A word count, and which Hadoop part handles each step

  1. Store: put the file in HDFS

    hdfs dfs -put pages.txt /data/pages.txt
    HDFS splits the file into 128 MB blocks and writes 3 replicas of each to DataNodes on two racks. Solves: doesn't fit and disks die.
  2. Map: each task reads one block

    def map_words(line):
        return [(w, 1) for w in line.lower().split()]
    print(map_words("Pune Delhi Pune"))
    [('pune', 1), ('delhi', 1), ('pune', 1)]
    Your only code. MapReduce runs one copy per block, in parallel, on nodes that hold the blocks (locality). Solves: too slow and network jammed.
  3. Shuffle and sort: group by key

    pairs = [("pune", 1), ("delhi", 1), ("pune", 1)]
    groups = {}
    for k, v in sorted(pairs):
        groups.setdefault(k, []).append(v)
    print(groups)
    {'delhi': [1], 'pune': [1, 1]}
    Done entirely by the framework: map outputs are partitioned by key, copied over the network to reducers and sorted. Solves: too much plumbing.
  4. Reduce: combine each key's values

    def reduce_count(word, ones):
        return word, sum(ones)
    print(reduce_count("pune", [1, 1]))
    ('pune', 2)
    Your second function. Reducers write results back to HDFS, replicated like any other file.
  5. Recover: a node dies halfway

    A DataNode with three running map tasks loses power.

    YARN and the ApplicationMaster re-run those tasks on other nodes, reading other replicas. The job finishes. Solves: tasks fail mid-job.
5 See it happen

Six problems, six fixes: the board and the cluster

Each frame takes one line from Riya's board. Left: the problem as a user feels it. Right: the Hadoop mechanism that fixes it.

Problem → Hadoop mechanism 6 steps
The problem “It doesn't fit.”4 TB disk400 TB “A disk died. Data gone.”✕ disk “The report takes 3 days.”one machine reading 400 TB “The network is jammed.”everyone copying data to one place “Our retry script is 900 lines.”split() schedule() retry()merge() rebalance() monitor()recover() copy() wait() …count_words() ← the real work “We need more capacity.”adding machines meansre-sharding all the data by hand myphatshala.in
Hadoop's fix HDFS blocks on many nodes capacity = sum of all nodes' disks 3 replicas + re-replication two copies left; a new one is made automatically MapReduce: 1,000s of tasks at once every node reads its share in parallel: minutes Data locality task ↔ blocktask ↔ blocktask ↔ block the program goes to the data; the network stays free You write map + reduce map(line) → (word, 1)reduce(w, ones) → sum splits, scheduling, shuffle, sort,retries, output: the framework Add a node: it just joins new NameNode tracks each block; nothing re-sharded(balancer moves some blocks when you want) myphatshala.in

Try it yourself: test every fix

This cluster has everything switched on, including High Availability for the NameNode. Work through the checklist to see each fix with your own eyes.

6 Real-world use

Which fix matters most, by industry

7 years

1. Telecom: cheap, safe storage for years

Regulations require keeping call and data records for years. HDFS on commodity disks with replication (or erasure coding for old data) is far cheaper per TB than enterprise storage.

Records→HDFS + replication / EC→Retained for years
EOD batch

2. Banking: finishing the batch window

End-of-day risk and reconciliation jobs must finish before morning. Parallel processing near the data and automatic retries make the deadline reliable, even when nodes fail at night.

Day's transactions→Parallel jobs + retries→Ready by 6 am
{"evt":"tap"}raw JSON

3. E-commerce: schema-on-read for app events

App events change format every few weeks as new features ship. Storing them raw in HDFS and applying a schema at query time (Hive, Spark) means nothing is lost when the format changes.

Raw events→Stored as-is→Schema applied by queries
SparkHive

4. Many teams, one cluster

With YARN, the fraud team's Spark jobs, the BI team's Hive queries and nightly MapReduce jobs share one cluster, each in its own queue with guaranteed capacity (Module 11).

Many teams→YARN queues→One shared cluster
activestandby

5. Always-on data platforms

When dashboards and pipelines depend on HDFS around the clock, NameNode High Availability turns a master failure from an outage into a short pause.

Active NN fails→Standby takes over→Pipelines continue

Examples are simplified descriptions of common patterns.

7 Run the code

A tiny MapReduce, in 20 lines of Python

This is the whole MapReduce idea on one machine. map_fn and reduce_fn are the only parts you would write in Hadoop; run_job plays the framework: it splits the input, runs every map, shuffles and sorts by key, and runs every reduce.

def map_fn(line):                        # YOU write this
    city, amount = line.split(",")
    return [(city, int(amount))]

def reduce_fn(city, amounts):            # YOU write this
    return city, sum(amounts)

def run_job(lines, splits=2):            # HADOOP does this part
    parts = [lines[i::splits] for i in range(splits)]
    mapped = [kv for part in parts for line in part for kv in map_fn(line)]
    groups = {}
    for k, v in sorted(mapped):          # shuffle and sort by key
        groups.setdefault(k, []).append(v)
    return [reduce_fn(k, vs) for k, vs in groups.items()]

orders = ["Pune,240", "Delhi,120", "Pune,60", "Goa,300", "Delhi,80"]
print(run_job(orders))
[('Delhi', 200), ('Goa', 300), ('Pune', 300)]
  • def map_fn(line):Map: turn one input record into zero or more (key, value) pairs. Here: (city, amount).
  • parts = [lines[i::splits] for i in range(splits)]Split the input into pieces, like HDFS blocks. lines[i::2] takes every second line starting at i.
  • for k, v in sorted(mapped):Shuffle and sort: all values with the same key end up together, in key order.
  • return [reduce_fn(k, vs) for k, vs in groups.items()]Reduce: called once per key with the list of all its values.
8 Line by line

Map, shuffle and reduce, one line at a time

Follow three orders through map (records → pairs), shuffle (pairs grouped by key) and reduce (one total per city). Watch the groups dictionary build up.

Worked examples: real problems, solved and traced in memory

Three problems that show each layer of Hadoop doing its job: a MapReduce on business data, the storage cost of replication versus erasure coding, and the gain from YARN sharing one cluster. Each runs live and is traced in memory.

Example 1BeginnerRetail · MapReduce

Total sales per store with map and reduce

Problem statement

A chain of chai stalls logs each sale as store,item,amount. Using only a map function and a reduce function, compute the total sales per store.

Input
["Kharghar,chai,20", "Vashi,samosa,15", "Kharghar,samosa,15", "Vashi,chai,20", "Kharghar,chai,20"]
Expected output
('Kharghar', 55)
('Vashi', 35)

Approach

  1. Map: from each line, emit (store, amount).
  2. Shuffle: group amounts by store (sorted).
  3. Reduce: sum each store's list.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 2IntermediateStorage · cost

Replication or erasure coding for old data?

Problem statement

A telecom keeps 600 TB of call records. The last 3 months (60 TB) are hot; the rest is cold. Compare raw disk needed if everything uses 3× replication, versus hot data at 3× and cold data with erasure coding (RS-6-3, 1.5×).

Input
600 TB total · 60 TB hot · replication 3× · erasure coding 1.5×
Expected output
All 3x replication: 1800 TB raw
Hot 3x + cold EC   : 990.0 TB raw
Saving: 810 TB (45%)

Approach

  1. All replicated: 600 × 3.
  2. Mixed: 60 × 3 + 540 × 1.5.
  3. Print the saving.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 3AdvancedYARN · utilisation

Why sharing one cluster with YARN beats separate clusters

Problem statement

Three teams each have their own 20-node cluster. Their busy hours differ: each cluster is 90% busy for 6 hours a day and 10% busy for the rest. Compare average utilisation with separate clusters, and the number of nodes a shared YARN cluster would need to give every team its peak.

Input
3 teams × 20 nodes · 90% busy 6 h, 10% busy 18 h · peaks at different times
Expected output
Separate clusters: 30% average utilisation, 60 nodes
Shared YARN cluster: about 22 nodes busy at worst
With 25% spare: 28 nodes instead of 60

Approach

  1. Average utilisation of one cluster = (0.9 × 6 + 0.1 × 18) ÷ 24.
  2. Shared cluster: at any hour, at most one team is at peak (18 nodes busy) and two are quiet (2 each).
  3. Nodes needed = 18 + 2 + 2, plus some spare.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

9 Quiz and revision

Check yourself

Quick revision

Lesson 2.3 in one screen

  • Four core modules: Common (shared code), HDFS (storage), YARN (resources), MapReduce (processing).
  • Doesn't fit → HDFS blocks. Disks die → 3 replicas, re-replication, checksums.
  • Too slow → parallel map tasks. Network → data locality.
  • Plumbing → you write map + reduce; framework does splits, scheduling, shuffle and sort, retries.
  • Growth → add nodes; NameNode tracks each block; balancer spreads data.
  • Hadoop 2: YARN (many engines, better scale) + NameNode HA. Hadoop 3: erasure coding, multiple standbys.
  • Schema-on-read: store raw, structure at query time.
  • Not solved by MapReduce: low latency, iterative ML, streaming, small files, in-place updates → Spark, Flink, Trino, Iceberg/Delta/Hudi.

Interview and viva questions

What are the core components of Hadoop?

Hadoop Common (shared libraries, configuration and utilities), HDFS (distributed storage with a NameNode for metadata and DataNodes for blocks), YARN (resource management with a ResourceManager, NodeManagers and per-application ApplicationMasters) and MapReduce (the batch processing model and engine that runs on YARN).

How does Hadoop achieve scalability?

By scaling out: HDFS spreads blocks over any number of DataNodes and the NameNode tracks each block individually, so adding nodes adds capacity without re-sharding. MapReduce creates one task per input split, so more nodes means more tasks run in parallel. YARN schedules resources across all nodes.

Which part of a MapReduce job is handled by the framework?

Computing input splits, scheduling map tasks near their data, running the map tasks, partitioning, spilling, sorting and shuffling map outputs to reducers, merging them, running reduce tasks, writing output to HDFS, tracking progress and counters, and retrying failed or slow tasks. The developer supplies the map and reduce functions and job configuration.

What problems does Hadoop not solve well?

Low-latency queries and point lookups, iterative and interactive workloads with MapReduce, real-time streaming, very large numbers of small files, and in-place updates of records. Other tools fill these gaps: HBase for lookups, Spark for iterative and in-memory work, Flink/Kafka for streaming, Trino/Impala for interactive SQL, and table formats such as Iceberg, Delta Lake and Hudi for updates.

Why was YARN introduced?

In Hadoop 1 the JobTracker handled both resource management and job tracking, which limited cluster size and allowed only MapReduce jobs. YARN separated these: the ResourceManager manages resources for the whole cluster, and each application has its own ApplicationMaster. This improved scalability and let other engines like Spark and Tez share the same cluster.

Practice problems

Practise the MapReduce way of thinking (map → shuffle → reduce) and the arithmetic behind Hadoop's storage choices.

P1Easy

Map one line

Write a map function that turns "Pune,UPI,450" into ("UPI", 450), and test it.

Input
"Pune,UPI,450"
Expected output
('UPI', 450)
Show solution and explanation
def map_fn(line):
    city, mode, amount = line.split(",")
    return (mode, int(amount))
print(map_fn("Pune,UPI,450"))
('UPI', 450)

How it works: The key you emit decides how data is grouped. Here the key is the payment mode.

P2Easy

Group pairs by key

Group these pairs by key into a dictionary of lists: [("a",1),("b",2),("a",3)].

Input
[("a",1),("b",2),("a",3)]
Expected output
{'a': [1, 3], 'b': [2]}
Show solution and explanation
pairs = [("a", 1), ("b", 2), ("a", 3)]
groups = {}
for k, v in pairs:
    groups.setdefault(k, []).append(v)
print(groups)
{'a': [1, 3], 'b': [2]}

How it works: This is the shuffle in one loop. In Hadoop it happens across the network between thousands of tasks.

P3Easy

Raw disk for replication 3

How much raw disk does 250 TB of data need with replication 3, and with erasure coding at 1.5×?

Input
250 TB
Expected output
Replication: 750 TB | EC: 375.0 TB
Show solution and explanation
print("Replication:", 250 * 3, "TB | EC:", 250 * 1.5, "TB")
Replication: 750 TB | EC: 375.0 TB

How it works: 750 TB vs 375 TB. EC halves raw storage for data that is rarely read.

P4Medium

Average order per city

Using map and reduce, compute the average order amount per city.

Input
["Pune,240", "Delhi,120", "Pune,60", "Delhi,80", "Goa,300"]
Expected output
Delhi 100.0
Goa 300.0
Pune 150.0
Show solution and explanation
orders = ["Pune,240", "Delhi,120", "Pune,60", "Delhi,80", "Goa,300"]
groups = {}
for city, amt in sorted((o.split(",")[0], int(o.split(",")[1])) for o in orders):
    groups.setdefault(city, []).append(amt)
for city, amts in groups.items():
    print(city, sum(amts) / len(amts))
Delhi 100.0 Goa 300.0 Pune 150.0

How it works: Average must be computed in the reducer from all values. Averaging partial averages from different mappers would give wrong answers.

P5Medium

Count words longer than 4 letters

Write map and reduce logic that counts only words longer than 4 letters.

Input
["Hadoop stores data", "Spark caches data in memory"]
Expected output
{'caches': 1, 'hadoop': 1, 'memory': 1, 'spark': 1, 'stores': 1}
Show solution and explanation
lines = ["Hadoop stores data", "Spark caches data in memory"]
pairs = [(w.lower(), 1) for l in lines for w in l.split() if len(w) > 4]
counts = {}
for w, one in sorted(pairs):
    counts[w] = counts.get(w, 0) + one
print(counts)
{'caches': 1, 'hadoop': 1, 'memory': 1, 'spark': 1, 'stores': 1}

How it works: Filtering in the map step means fewer pairs are shuffled. Doing work early, before the network, is a key MapReduce habit.

P6Medium

Which tool for the job?

For each workload, print whether batch Hadoop fits ("yes") or not ("no").

Input
scan 2 years of logs · show one user profile in 50 ms · nightly sales report · live fraud alert in 1 s
Expected output
scan 2 years of logs            : yes
show one user profile in 50 ms  : no
nightly sales report            : yes
live fraud alert in 1 s         : no
Show solution and explanation
workloads = {"scan 2 years of logs": "batch", "show one user profile in 50 ms": "lookup",
             "nightly sales report": "batch", "live fraud alert in 1 s": "stream"}
for w, kind in workloads.items():
    print(f"{w:32}: {'yes' if kind == 'batch' else 'no'}")
scan 2 years of logs : yes show one user profile in 50 ms : no nightly sales report : yes live fraud alert in 1 s : no

How it works: Batch fits Hadoop. Lookups need a database or HBase; streams need Kafka with Flink or Spark Streaming.

P7Business problem

NameNode memory for small files

A team stores 40 crore small files of 200 KB each (one block per file). Using about 150 bytes per file object and 150 per block object, estimate the NameNode memory. Then estimate it if the same data were packed into 256 MB files.

Input
40 crore files × 200 KB · 150 B per object
Expected output
Small files : ~112 GB of NameNode heap
Packed files: ~0.09 GB
Show solution and explanation
files = 40_00_00_000
small_gb = files * 2 * 150 / 1024**3
data_mb = files * 200 / 1024
big_files = data_mb / 256
big_gb = big_files * 2 * 150 / 1024**3
print(f"Small files : ~{small_gb:.0f} GB of NameNode heap")
print(f"Packed files: ~{big_gb:.2f} GB")
Small files : ~112 GB of NameNode heap Packed files: ~0.09 GB

How it works: About 112 GB versus well under 1 GB for the same bytes. The small-files problem is one of the main things Hadoop did not solve by itself (Module 7).

P8Business problem

Cost of keeping cold data replicated

Cold data of 900 TB is kept at 3× replication. Switching it to erasure coding (1.5×) frees raw disk. At Rs 2,500 per TB of raw disk, how much hardware does the switch save?

Input
900 TB · 3× → 1.5× · Rs 2,500/TB
Expected output
Saved 1350 TB raw = Rs 33.8 lakh
Show solution and explanation
saved_tb = 900 * (3 - 1.5)
print(f"Saved {saved_tb:.0f} TB raw = Rs {saved_tb * 2500 / 1e5:.1f} lakh")
Saved 1350 TB raw = Rs 33.8 lakh

How it works: 1,350 TB of raw disk, about Rs 33.8 lakh of hardware (illustrative price), plus the power and rack space for it.

Real-world scenario questions (asked in company interviews)

Interviewers often test architecture knowledge by giving you a problem and asking which part of Hadoop handles it.

Any company · architectureFresher

“Walk me through what happens when I run a Hadoop job.”

The interviewer wants the end-to-end flow, naming which component does what, for a job that reads a file in HDFS and writes results.

The interviewer is checking: can you connect HDFS, YARN and MapReduce into one story?

Show a strong answer
  1. The file is already in HDFS: blocks on DataNodes, metadata on the NameNode.
  2. The client submits the job to the ResourceManager, which starts an ApplicationMaster in a container.
  3. The AM computes input splits from block locations and asks YARN for containers on (or near) those nodes.
  4. NodeManagers launch map tasks; each reads its block locally and writes partitioned, sorted output to local disk.
  5. Reducers shuffle (fetch) their partitions from all mappers, merge them and run reduce, writing output to HDFS.
  6. The AM tracks progress and re-runs failed tasks; when done, it reports success and exits.

Avoid: mentioning the JobTracker for a modern cluster (that was Hadoop 1).

ML team · architecture1–3 years

The ML training job takes 14 hours in MapReduce

A data scientist implemented a training algorithm with 30 iterations as 30 chained MapReduce jobs over the same 2 TB data set. It takes 14 hours.

The interviewer is checking: do you know which problems MapReduce did not solve, and what replaced it?

Show a strong answer
  • Each MapReduce job rereads the 2 TB from HDFS and writes its results back to HDFS, so 30 iterations mean about 60 full passes over disk, plus job start-up each time.
  • Move it to Spark on the same YARN cluster: load the data once, cache() it in executor memory, and iterate in memory. Spark MLlib already has many algorithms.
  • Keep HDFS as the storage; only the engine changes.

Avoid: “Add more nodes.” The waste is in the repeated I/O, not the lack of machines.

Platform team · capacity1–3 years

Each team wants its own cluster

Three departments each ask for a separate 30-node Hadoop cluster so that “others don't slow us down”. Finance asks whether that is necessary.

The interviewer is checking: do you understand what YARN was built for?

Show a strong answer
  • Separate clusters sit idle outside each team's busy hours, and data must be copied between them.
  • One shared cluster with YARN queues (Capacity or Fair Scheduler) gives each team a guaranteed share, lets them borrow idle capacity, and keeps one copy of shared data.
  • Isolation concerns are handled with queue limits, pre-emption, and per-team security (Kerberos, Ranger policies).
  • Separate clusters can still make sense for strict regulatory isolation or very different software versions.

Avoid: dismissing the teams' concern; explain how queues address it.

Banking · data correction1–3 years

“Just update the wrong rows in HDFS”

A bug wrote wrong interest amounts into 5,000 rows of a 2 TB table stored as files in HDFS. A manager asks you to “run an UPDATE on those rows”.

The interviewer is checking: do you know HDFS is write-once, and how updates are handled in practice?

Show a strong answer
  • HDFS files can't be edited in the middle. Plain Hive tables on files are corrected by rewriting the affected partitions (for example only the dates involved).
  • Modern table formats (Apache Iceberg, Delta Lake, Hudi) or Hive ACID tables support UPDATE/MERGE by writing new files and tracking which rows are current.
  • Fix the bug first, then reprocess from raw data if possible, keeping the raw layer unchanged.

Avoid: suggesting editing HDFS blocks directly.