Module · 5 lessons

Why Distributed?

Find the honest ceiling of one machine, then meet the engine built for what lies past it: Spark's driver-and-executor model, local mode, your first SparkSession over ten million real taxi trips, and a measured answer to when Spark wins — and when pandas still does.

At a glance

Level
Intermediate
Lessons
5 lessons
Time to complete
1 week
Cost
Free forever · no sign-up

Welcome to Why Distributed?, the first module — which starts by taking the other side of an argument this path just won. The previous course proved a laptop can process ten million trips under a strict memory budget, and that “too big for pandas” is usually a solvable problem, not a wall. All of that remains true. And yet every serious data team eventually runs Spark, Snowflake, BigQuery, or something like them — engines built to spread work across many machines. This module is about why, honestly: not because one machine is weak, but because it is one — one set of cores that parallelism can saturate but never exceed, one disk with one throughput, one memory ceiling that streaming defers but never removes, and one failure domain for a job that must finish tonight.

Apache Spark is the tool this course uses to cross that line, and its best teaching feature is that you don’t need a cluster to learn it truthfully. Spark’s local mode runs the genuine article — the same driver, the same optimizer, the same DataFrame API, the same execution plans — with your CPU cores standing in for a cluster’s executors. Code written this way moves to a real cluster by changing one connection string, which means everything you measure here is real Spark behaviour, not a simulation of it.

Across five lessons you’ll find the ceiling with real measurements, learn Spark’s architecture well enough to predict what it does before it does it, start your first SparkSession over CityFlow’s full taxi quarter, and run an honest pandas-versus-Spark comparison — one that includes the JVM startup cost and shows exactly where Spark is the wrong tool. The guided project ends with CityFlow’s first Spark artifact: the whole quarter loaded, profiled, and sanity-checked against the numbers the previous course established. Start with Lesson 1, where the machine that just handled ten million trips meets the limits no technique can optimize away.

Lessons in this module

1 The Ceiling of One Machine Re-verify Course 1's quarter — 9,554,778 trips, $256,692,373.14 to the cent — with a parallel aggregation, then measure the four limits no single-machine technique removes: a speedup curve that peaks at 6.86x on exactly 10 cores and gets worse at 20 workers, a 2.7 GB/s disk that would need over ten hours to scan 100 TB it cannot even store, a dedup answer that costs 557 MB for one month and outgrows 16 GB of RAM by arithmetic, and one failure domain. 2 Driver, Executors & Local Mode Learn Spark's cast — the driver that plans, the executors that execute — and prove local mode is the real engine: interrogate a live session on 10 cores, watch one aggregation over January's 2,964,624 real trips become two jobs and 21 scheduled tasks, catch getOrCreate() silently ignoring a config, and measure local[2] vs local[*] on the 9,554,778-trip quarter. 3 Your First SparkSession Install PySpark 4.2 and a JDK it can live with — including the real UnsupportedClassVersionError an old Java throws — then build a SparkSession config by config, read CityFlow's full quarter in one 59 ms call, match Course 1's 9,554,778 rows and January's top zones to the trip, and watch toPandas() on a single month kill a 1 GB driver with java.lang.OutOfMemoryError. 4 When Spark Wins (and Loses) Time the same zone-hour revenue report in three engines at three sizes on the real taxi quarter — Spark passes a naive pandas load just under 2 months of data (2.71 s vs 2.99 s at 3 months), never catches streaming pandas (0.60 s), and a fresh Spark script pays a measured 8.75-second fixed cost before its first warm second of work. 5 Guided Project: The Quarter in Spark Build CityFlow's first Spark artifact: one re-runnable script that loads all 9,554,778 real Q1-2024 taxi trips in a single read, counts 56 stray timestamps and 115,895 fare reversals without dropping a row, ranks the busiest zones by real name, and cross-checks every number — down to $256,692,373.14 of revenue — against Course 1's ground truth.
Achievement

Complete all 5 lessons to finish the Why Distributed? module.

Start module
Sponsor

Keep DATATWEETS free. Help fund practical data, AI, and engineering lessons for learners worldwide.

Buy Me a Coffee at ko-fi.com