Lesson · 6 pages · about 5 min
Skew and salting
When one key holds a big share of the rows, one task does most of the work while the cluster waits. Measured: why more executors do not help, and two ways of salting the key.
- What it is
- Skew is when one key, like one huge customer, has a big share of the rows, so one machine gets most of the work. Salting spreads that key out.
- What it is for
- A job is only as fast as its slowest task. One overloaded task can turn a 5-minute job into an 80-minute one while the cluster waits.
- Use it when
- When one task runs far longer than the rest: on sale days, or with a few very large customers, stores or products.
- Not when
- For plain totals: Spark adds up per key inside each task first, so a busy key costs nothing extra there.
Words you’ll learn
- Shuffle
- Broadcast join
- Spill
- Disk
- Skew
- Executor
- Executor-hours
- Salting
- Row
- Hot key