9bNine Bits

Hadoop vs Spark: What Each Does and When to Use Which

Hadoop vs Spark is mostly not an either-or choice: Hadoop supplies storage (HDFS), cluster scheduling (YARN) and batch processing (MapReduce), while Spark is the processing engine that runs on YARN or standalone and reads data from HDFS and other stores. Spark uses Hadoop's client libraries and is routinely run inside Hadoop clusters. Keep Hadoop components for storage and scheduling where they already exist, and choose Spark for new processing work.
Hadoop vs Spark: What Each Does and When to Use Which

Hadoop vs Spark: decision summary

Apache Hadoop is a platform with three documented parts: HDFS for distributed storage, YARN for cluster resource management, and MapReduce for batch processing. Apache Spark is a unified analytics engine for large-scale data processing. Spark's own FAQ calls it a fast and general processing engine compatible with Hadoop data, and says it can run in Hadoop clusters through YARN or in its own standalone mode. The two are complementary, so the practical question is usually which layer to use for storage, scheduling and processing.

CriterionHadoopSpark
What it isStorage (HDFS), resource management (YARN) and batch processing (MapReduce)Processing engine; no storage layer of its own
Cluster managementYARNRuns on YARN or in standalone mode
Processing modelMapReduce: map and reduce phases with disk between stagesIn-memory execution of multi-stage pipelines, with disk when data does not fit
APIs and librariesMapReduce tutorial, commands, REST APIs, Application Master and History ServerJava, Scala, Python and R; Spark SQL, pandas API on Spark, MLlib, GraphX, Structured Streaming
Storage it readsHDFS, plus connectors for Amazon S3, Azure Blob Storage, Azure Data Lake Storage, Aliyun OSS, Tencent COS, Huaweicloud OBS and VolcanoEngine TOSHDFS, HBase, Cassandra, Hive and any Hadoop InputFormat; object stores, local files and JDBC sources
ScaleHorizontal, with block replication in HDFSClusters of thousands of nodes (largest known: 8,000); works well up to petabytes
Current release3.5.0, released April 2, 2026, Apache License 2.04.3.0, released October 30, 2026 (3.5.10 released November 22, 2026 on the 3.5 line)
Runtime requirements3.5.0: Java 17 on the server side; Java 17 and 21 on the client4.3.0: Java 17, 21 or 25; Scala 2.13; Python 3.11+; R 4.0+ (deprecated)
Typical roleDurable storage and scheduling for a clusterBatch, streaming, interactive queries and machine learning

HDFS, YARN and MapReduce: what Hadoop provides

Hadoop bundles three separable pieces. HDFS splits files into blocks and replicates them across worker nodes, so losing a disk or node does not lose data; Hadoop also documents erasure coding as an alternative to replication. YARN is the cluster's resource manager: it hands out CPU and memory to applications and arbitrates between them, so a cluster can serve mixed workloads instead of one job at a time. MapReduce is the original processing model. A job is split into a map phase and a reduce phase, and intermediate results are written to disk between stages. That disk I/O is durable but slow for iterative algorithms or interactive queries that revisit the same data.

Because the pieces are separable, a cluster can run HDFS and YARN without executing a single MapReduce job. Many clusters do exactly that, with Spark doing the processing.

Hadoop 3.5.0 is the first stable release of the 3.5 line. It is the first Hadoop release with full Java 17 support, adds a Google Cloud Storage FileSystem, and removes the deprecated WASB FileSystem in favor of ABFS.

Spark's in-memory engine and how it runs on YARN

Spark's core abstraction is the resilient distributed dataset (RDD) and, at a higher level, the DataFrame. Instead of writing every intermediate result to disk, Spark builds a graph of transformations and keeps data in memory across steps when it fits. If an executor fails, Spark recomputes the lost partition from lineage rather than reading a replicated file. Spark's FAQ reports that it sorted 100 TB three times faster than Hadoop MapReduce on a tenth of the machines, winning the 2014 Daytona GraySort Benchmark.

Spark does not replace YARN. It runs on top of it as another YARN application, and it uses Hadoop's client libraries for HDFS and YARN. When you submit with --master yarn, YARN allocates containers for the Spark driver and executors, so Spark can be adopted inside an existing Hadoop cluster without new hardware.

spark-submit \
  --master yarn \
  --deploy-mode cluster \
  --num-executors 20 \
  --executor-memory 8g \
  my_job.py

Spark also runs in standalone mode, which needs only Java on each node, so YARN is an option rather than a requirement. On a cluster you still need some form of shared filesystem, such as NFS mounted at the same path on every node.

Reading HDFS or object storage from the same code

Spark treats storage as pluggable. The same DataFrame API reads from HDFS or an object store, and the main differences are the URI scheme and the connector configuration. Spark's downloads come pre-packaged for popular Hadoop versions, and a "Hadoop free" binary works with any Hadoop version by adding Hadoop to Spark's classpath.

# Reading from HDFS
df = spark.read.parquet("hdfs://namenode:<port>/data/events")

# Reading the same data from object storage
df = spark.read.parquet("s3a://my-bucket/data/events")

That portability lets a team move data to separately scaled object storage without rewriting the processing code that runs against it.

What has replaced Hadoop pieces in modern stacks

Spark is widely run inside Hadoop clusters as a YARN application, and it reads object stores as readily as HDFS. In that setup MapReduce is the piece Spark takes over, while HDFS and YARN stay in place.

Storage is the other shift, and it is a choice inside Hadoop as much as a move away from it. Hadoop ships connectors for Amazon S3, Azure Blob Storage, Azure Data Lake Storage, Aliyun OSS, Tencent COS, Huaweicloud OBS and VolcanoEngine TOS, along with DistCp for bulk copying. A team can therefore keep Hadoop tooling and still put the data in an object store.

One caution for existing Spark code: Spark's own execution model is not a transactional database, so transactional behavior depends on the table format or catalog underneath. Also, the older Spark Streaming (DStream) engine is a legacy project with no further updates. Structured Streaming is the current engine, and existing DStream pipelines should be migrated.

When Hadoop components still make sense

HDFS and YARN are not obsolete. They fit when a large on-premises cluster already exists and is paid for, when data-residency or regulatory rules rule out cloud storage, or when you need YARN's multi-tenant scheduling across several workloads. HDFS block replication, or erasure coding, is a reasonable fit for large bulk datasets you want to keep on your own hardware.

MapReduce is not deprecated. It is still a documented, shipped component of the current Hadoop release (3.5.0). In practice most new processing work is written for Spark, but that is a market trend rather than a deprecation. Spark can also read HBase data, so an existing HBase deployment does not have to be migrated to adopt Spark.

Migrating or running both together

Migrations usually happen in stages. A common path keeps HDFS and YARN, rewrites MapReduce jobs as Spark jobs that run as YARN applications, and only later evaluates moving storage to an object store. distcp handles bulk copying between HDFS and cloud storage.

Check runtime versions before upgrading Spark. Spark 4 is pre-built with Scala 2.13, and Scala 2.12 support has been dropped, so libraries built for 2.12 need rebuilding. Spark 4.3.0 also needs Java 17, 21 or 25 and Python 3.11 or later.

Running both side by side indefinitely is a valid end state. HDFS can hold bulk data and YARN can schedule it, while Spark does all active processing.

Common questions

Is Spark part of Hadoop?

No. Spark is a separate Apache project. It uses Hadoop's client libraries for HDFS and YARN and can run in Hadoop clusters through YARN, but it also runs in standalone mode.

Does Spark require HDFS?

No, but on a cluster you still need some form of shared filesystem, such as NFS mounted at the same path on each node. Spark can read HDFS, HBase, Cassandra, Hive and any Hadoop InputFormat, and the docs also list object stores, local files and JDBC sources.

Is MapReduce deprecated?

No. MapReduce is still a documented, shipped component of the current Apache Hadoop release (3.5.0). Most new processing work is written for Spark, but that is a trend rather than a deprecation.

Can Hadoop and Spark run on the same cluster?

Yes. Spark runs as a YARN application on an existing Hadoop cluster and reads data from HDFS. Spark downloads are pre-packaged for popular Hadoop versions, and a "Hadoop free" build works with any Hadoop version.

Sources

  1. Apache Spark FAQ
  2. Apache Spark documentation
  3. Apache Hadoop documentation
  4. Apache Hadoop releases

About this page

Last reviewed November 30, 2026 by the Nine Bits editors. Read our editorial policy or report an error.