Why Spark: Advantages, Challenges, and Modules
Databricks Spark Developer Associate · Lesson 1 of 18 · 3:14
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Associate Developer for Apache Spark exam. In this lesson: why Spark exists, its advantages (distributed, in memory, fault tolerant, and one engine for batch, SQL, streaming, and machine learning), its challenges (shuffles, memory and garbage collection, and data that fits on one machine), and its modules: Spark Core, Spark SQL, Structured Streaming, MLlib, GraphX, and the pandas API on Spark. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Too big for one server
Coralpeak Games runs mobile games for millions of players, and every tap, level, and purchase lands as an event in cloud storage. A single server with pandas used to build the daily report, but the events no longer fit in its memory, and the report now takes all night. This lesson explains what Apache Spark brings, what it costs, and which modules it offers.
What Spark is
Apache Spark is a unified engine for large scale data processing: it splits the data into partitions, and processes them in parallel on the machines of a cluster. It offers high level APIs in Python, Scala, Java, and R, plus SQL, and every language runs on the same optimized engine. Spark keeps intermediate data in memory when it can, instead of writing it to disk between every step, which makes repeated work much faster. It also tolerates failures: Spark remembers how each piece of data was computed, its lineage, so it can compute a lost partition again on another machine. And one engine covers batch jobs, SQL queries, streaming, and machine learning, so Coralpeak does not need one system for each.
Advantages
Spark's advantages start with scale: when the data grows, you add machines, and the same code processes more partitions in parallel. Then speed: processing in memory, and an optimizer that plans the whole query, avoid much of the disk work of older systems. Then one engine for everything: the same DataFrames feed batch reports, SQL, streams, and machine learning. And resilience: a failed task runs again elsewhere, from its lineage, without restarting the whole job.
Challenges
Spark also has challenges, and the exam expects you to know them. Shuffles, which move data between machines for joins and aggregations, write to disk, serialize rows, and use the network, so they are often the slowest part of a job. Memory needs care, since large partitions, skewed keys, or collecting too much on the driver cause out of memory errors and long garbage collection pauses. And a cluster costs money: when the data fits easily on one machine, plain pandas can be simpler and faster.
The modules
Spark Core is the base: it schedules tasks, manages memory, recovers from failures, and offers the low level RDD API, for resilient distributed datasets. Spark SQL works with structured data, through SQL queries and the DataFrame API, and its Catalyst optimizer plans both the same way. The pandas API on Spark lets pandas users keep their familiar syntax on data that no longer fits on one machine. Structured Streaming processes data streams with the same DataFrame operations, as an unbounded table that keeps growing. And MLlib, the machine learning library, offers distributed algorithms and pipelines, while GraphX covers graph processing.
Recap
Let's recap. Spark is a unified engine that processes partitions of data in parallel across a cluster. Its advantages are scale, speed in memory, one engine for every workload, and recovery from lineage. Its challenges are costly shuffles, memory pressure, and a cluster that small data does not need. Spark Core schedules and recovers, and Spark SQL with DataFrames is the main API. And the pandas API on Spark, Structured Streaming, MLlib, and GraphX build on the same engine.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Coralpeak’s report runs on one server with pandas, and the events no longer fit in memory. What does Spark change first?
- It compresses every event so the whole history fits on one server
- It splits the data into partitions processed in parallel on a cluster
- It turns the event files into a relational database
- It runs the same pandas code faster on one core
Show the answer
It splits the data into partitions processed in parallel on a cluster
Spark splits the data into partitions, and processes them in parallel on the machines of a cluster. “It compresses every event so the whole history fits on one server” is wrong, since Spark does not squeeze the data into one machine, it spreads it out. “It turns the event files into a relational database” is wrong, since Spark is a processing engine, not a database. And “It runs the same pandas code faster on one core” is wrong, since Spark runs on many cores and many machines, not on one core.
An analyst wants Spark for a 200 MB CSV file that a laptop handles in seconds. What is the main drawback?
- Spark cannot read CSV files
- The file is too small to split into partitions
- Spark would need a GPU for this file
- A cluster adds cost and overhead for little gain
Show the answer
A cluster adds cost and overhead for little gain
The data fits easily on one machine, so a cluster adds cost, startup time, and scheduling overhead, for little gain. “Spark cannot read CSV files” is wrong, since Spark reads CSV files natively. “The file is too small to split into partitions” is wrong, since Spark can split even a small file, it just gains nothing here. And “Spark would need a GPU for this file” is wrong, since Spark runs on ordinary processors, and does not need a GPU.
Coralpeak’s data scientists know pandas well, and want to keep its syntax on billions of events. Which module fits?
- The pandas API on Spark
- GraphX
- Spark Core and its RDD API
- MLlib
Show the answer
The pandas API on Spark
The pandas API on Spark keeps the pandas syntax, and runs it on Spark across the cluster. “GraphX” is wrong, since GraphX processes graphs. “Spark Core and its RDD API” is wrong, since the RDD API is low level, and nothing like pandas. And “MLlib” is wrong, since MLlib is for machine learning, not for everyday data work in pandas style.