internalsGet Pro

Module 08 · Lesson 14 of 14Pro

Design: a nightly job over a billion orders

Level
Advanced
Topic
Batch processing with Spark
Reading time
28 min

When you finish this page you can

  1. Design a nightly Spark job that recomputes metrics over all of history from a change log, and size it against a fixed time window.
  2. Find and remove skew from a hot key by choosing an aggregation over a window function.
  3. Choose between rebuilding every night and updating yesterday’s results, and name the conditions that would flip the choice.
  4. Publish a job’s output and launch it from Airflow so that retries and crashes never leave readers with half a night.
  1. Design: ingesting orders from five sources28 min
  2. Landing CDC data in a warehouse or lakehouse17 min
  3. Spark architecture: driver, executors and tasks17 min
  4. Shuffles: the most expensive step in Spark17 min
  5. Joins at scale: broadcast and sort-merge17 min
  6. Data skew: when one task does all the work18 min

A first order looks like any other order

is an online store in India. It takes about 500,000 orders a day, about 1 billion since launch. Meera, a data engineer, moves that data from the store’s databases to Kartly’s reports and models. Daniel leads finance reporting and reads his report at 07:00.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan