Big Data Lab
MapReduce, partitioning and Spark concepts through honest teaching simulations.
- 3lessons
- 3experiments
- 5terms
Scientific introduction
Big data is processed by splitting it across nodes. The experiments here are teaching simulations of the algorithmic logic (map, shuffle, reduce) running in your browser; they do not measure real cluster performance.
Learning objectives
- Explain the MapReduce stages
- Understand partitioning and its effect on balance
- Tell Spark transformations from actions
- Know when a distributed system is and is not needed
Topics
- MapReduce
- Partitioning
- Spark
Core concepts
- MapReduce
- A programming model that processes data in map, shuffle and reduce stages.
- Shuffle
- Moving data between nodes to group equal keys.
- Partition
- A slice of data handled by a single worker.
- Data skew
- Unequal partition sizes so one slow task delays the whole job.
- Lazy evaluation
- Deferring execution until a result is actually requested.
Theory
The MapReduce model
The stages
1. Map: each record becomes (key, value) pairs.
2. Shuffle: pairs with the same key are grouped and sent to the same worker.
3. Reduce: the values of each key are combined.
The simplicity allows parallel execution and recovery from node failure by re-running tasks. The shuffle (network transfer) is often the largest cost. This page explains the logic; it does not measure a real cluster.
Partitioning and balance
Distribution methods
- Hash: usually even, but does not preserve order.
- Range: preserves order and suits range queries, but is prone to skew.
- Round-robin: perfect balance, ignoring the key.
Skew (a hot key taking a large share) leaves one node slow and slows the whole job. Watch the distribution of partition sizes, not just the mean.
Spark concepts
Transformations and actions
In Spark, transformations (filter, map, groupBy) are lazy: they only build an execution plan. Actions (count, collect, write) trigger it. The plan allows global optimisation and recomputing what was lost.
The simulators in this center show the idea for teaching; they do not run Spark or measure its performance. For data that fits on one machine, pandas or local SQL is often enough.
Worked examples
Word count
The classic example: map emits (word,1), shuffle groups equal keys, reduce sums the values. The experiment shows each stage.
Interactive experiments
MapReduce simulator
Learning goal: Follow map, shuffle and reduce on text with control over workers and the local combiner.
Explanation and scientific documentation
Text is split into chunks and the MapReduce logic is really run on each, showing the exchanged pairs.
Data: A computer simulation with random numbers whose seed you can change; no real data.
A local combiner reduces the number of pairs sent across the network.
Limits: A logical simulation; it measures neither time nor the speed of a real cluster.
Data partitioning
Learning goal: Compare hash, range and round-robin partitioning and see the effect of skew.
Explanation and scientific documentation
A synthetic table is distributed across partitions and each size and a balance coefficient are shown.
Data: A computer simulation with random numbers whose seed you can change; no real data.
Balance factor = largest partition ÷ mean partition; 1 means perfect balance.
Limits: No real network distribution and no timing.
Spark-style DataFrame simulator
Learning goal: Understand a chain of lazy transformations followed by the action that runs it.
Explanation and scientific documentation
You build a chain (filter, select, groupBy, sort); the plan is shown and the result appears on the "action".
Data: Synthetic data generated in your browser with an editable seed; the relationships are planted on purpose for learning and are not real data.
Transformations do not run until an action such as count or show is requested.
Limits: This is not Spark: simplified teaching logic in the browser, with no real performance or distribution.
Related algorithms and methods
MapReduce
A programming model: map, shuffle, reduce.
Hash partitioning
Distributes keys across partitions with a hash function.
Suitable datasets
- Sales (synthetic) Synthetic, generated in the browser
Practical projects
Assessment questions
Sources and references
- Dean, J., & Ghemawat, S. (2008). MapReduce: simplified data processing on large clusters. Communications of the ACM, 51(1), 107-113 DOI (bibliographic data entered by the editor, not machine-checked)
- Zaharia, M., et al. (2016). Apache Spark: a unified engine for big data processing. Communications of the ACM, 59(11), 56-65 DOI (bibliographic data entered by the editor, not machine-checked)
- Kleppmann, M. (2017). Designing Data-Intensive Applications. O'Reilly Media (bibliographic data entered by the editor, not machine-checked)
