Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Overcoming Common Performance Issues in Apache Spark
Rating: 4.4 out of 5(43 ratings)
540 students

Overcoming Common Performance Issues in Apache Spark

Speed up your Spark Scripts and overcome errors
Created byKieran Keene
Last updated 4/2023
English
English [Auto],

What you'll learn

  • The three main causes of performance issues in Apache Spark
  • How to overcome shuffle induced performance issues in Apache Spark
  • How to overcome skew induced performance issues in Apache Spark
  • How to overcome spill induced performance issues in Apache Spark

Course content

1 section21 lectures39m total length
  • Introduction1:01

    Explore the Spark architecture and job structure to see how components interact, then identify common performance issues—data shuffle, data skew, and data spill—and how to tackle them.

  • Spark Architecture2:33

    Explore spark architecture by identifying the driver, cluster manager, and executors. Learn how the driver creates a spark session, submits jobs, and the resource manager allocates resources and monitors progress.

  • Spark Performance & Config Changes Article1:15
  • Deployment Modes in Spark2:55

    Explore spark deployment modes—local, client, and cluster—and learn their use cases, trade-offs, and suitability for testing, debugging, interactive development, and production deployments.

  • Reviewing Cluster vs Client Deployment Modes0:56

    Compare cluster mode and client mode in Apache Spark. In cluster mode, the driver and executors reside inside the cluster; in client mode, the driver runs externally and submits jobs.

  • Jobs, Stages & Tasks in Spark3:56

    Spark jobs are submitted by the driver and split into stages and tasks that run in parallel on executors, with lazy execution until actions like count or save trigger them.

  • Introduction to Performance Concerns in Spark1:09

    Examine the three main performance concerns in Spark—skew, shuffle, and spill—and learn how to identify and mitigate their impact on your jobs.

  • What is Shuffle?1:47

    Understand how shuffle in Spark moves data across the cluster to enable aggregations and joins. Identify memory pressure, spill to disk, and network traffic as common bottlenecks.

  • Further Insight into Shuffle2:11

    Discover how Spark shuffles data to group by a key, creating partitions by color. Learn why shuffles are costly, and how data skew and memory pressure can cause spills.

  • How do we identify Shuffle?1:19

    Identify shuffle by analyzing spark UI shuffle read and write metrics during transformations like group by or join to detect data movement across the cluster and guide mitigation.

  • Resolve Shuffle: Broadcast Joins1:19

    Learn how to fix shuffle with broadcast joins in Spark, copy the small table to all executors so the join runs locally and results return to the driver.

  • Resolve Shuffle: ReduceBy()2:58

    Switch from group by to reduce by to minimize shuffle in Spark and boost performance. Reduce by shuffles only summaries, unlike group by which shuffles all data for each key.

  • Resolve Shuffle: Config1:35

    Increase spark partitions to maximize parallelism and reduce data shuffled, lowering skew and speeding processing, by setting spark.sql.shuffle.partitions, while noting higher memory and network usage.

  • What is Skew1:55

    Skew occurs when a few partitions hold most of the data, causing uneven workload, reduced parallelism, and higher memory and disk I/O, with updates and deletes worsening distribution.

  • More About Skew1:26

    Explore how skewed data concentrates on the red value, causing a single executor to process more data, triggering memory spills to disk and slowing the Spark job.

  • How to Identify Skew1:44

    Identify skew by grouping by partition id and counting rows to reveal uneven partitions, and inspect Spark UI task times to spot long-running executors signaling shuffle skew.

  • How to Resolve Skew4:13

    Learn how to resolve skew in Spark by repartitioning data frames, coalescing with caution, salting keys, and increasing partitions to distribute data more evenly and reduce shuffles.

  • Coalesce Vs Repartitioning Article1:46
  • What is Spill1:29

    Explore how spill moves data from RAM to disk and back when partitions exceed memory, including skew, causing performance bottlenecks and higher memory and disk I/O in Apache Spark.

  • How To Prevent Spill1:29

    Identify spill in the spark UI by the stage’s spilled data, and prevent it by increasing executor memory or, preferably, repartitioning the data for even distribution using repartition or coalesce.

  • Wrapping up!1:01

    Wrap up by reviewing the Spark architecture—driver, executor, cluster manager—and deployment modes, then cover jobs, stages, tasks, shuffle, skew, and spill to improve performance.

Requirements

  • Apache Spark Programming

Description

Spark is a powerful framework for processing large datasets in parallel. But, with the complex architecture come frequent performance issues.


In my experience, it can be frustrating looking everywhere, trying to find a resource online that is worded in such a way that you fully understand the inner workings of Spark and how to address these issues. So, I created this course!


This is not a code-along course. This course assumes you already know how to code in Spark. Here, we're talking about how you resolve the performance issues that you encounter during your development journey! We will walk through all of the theory & you'll have actionable steps to take to resolve your performance issues.


In this course, we will cover off:

  • The Apache Spark Architecture

  • The type of deployment modes in Apache Spark

  • The structure of jobs in Apache Spark

  • How to handle the three main performance concerns in Spark

If you don't yet know how to code in Spark, you can join my 60 minute crash course in PySpark, here on Udemy.


Let's get to work understanding why your scripts are not performing as you may hope and resolve your performance issues together. Shuffle, Skew and Spill will be concerns of the past after this course!

Who this course is for:

  • Spark developers looking to improve performance of their scripts