NotionJustin LeeProblem & solution
Balancing cost and reliability for Spark on Kubernetes
Summary
Notion describes how it reduced Spark compute costs on Kubernetes while maintaining reliability across production workloads. After moving from fixed EC2 clusters on Amazon EMR to EMR on EKS, it used Karpenter, EKS Auto Mode, and the MostAllocated scheduler for dynamic provisioning and bin-packing. Spot Instances then exposed a failure mode: one interruption could remove many bin-packed executors, causing shuffle loss and expensive recomputation. Spot Balancer addresses this by labeling executor creation through a Kubernetes webhook and maintaining each job’s configured spot-to-on-demand ratio, with per-job counts stored in Redis. Named stability weights make the cost-reliability trade-off explicit, and reported savings reached 60–90 percent while jobs that previously failed from interruptions finished reliably.
Context
As Notion’s Spark workloads grew, fixed EC2-based Amazon EMR clusters became limiting, while aggressive use of Spot Instances caused failures when interruptions removed many bin-packed executors simultaneously. Spark could retry individual executor failures, but simultaneous losses led to shuffle loss, expensive recomputation, and failed jobs.
Approach / What changed
Notion moved to EMR on EKS and used Karpenter, EKS Auto Mode, and the MostAllocated scheduler for dynamic provisioning and bin-packing. Spot Balancer manages each Spark job’s executor distribution between Spot and on-demand capacity, using a Kubernetes webhook to label executor creation, Redis to track counts, and configurable or named stability ratios.
Takeaways
Spot interruptions were especially disruptive when many executors from one Spark job were bin-packed onto a single Spot Instance, potentially causing simultaneous executor loss and shuffle recomputation.
Spot Balancer lets each Spark job specify a target Spot-to-on-demand ratio, limiting the expected impact of interruptions while allowing longer or more critical jobs to use more stable capacity.
Notion reports 60–90 percent Spark compute cost savings after combining Kubernetes-based provisioning, bin-packing, and controlled Spot usage; previously failing jobs finished reliably.
Source and freshness
- Source
- notion.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.