Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started

Optimize Slow Spark ETL Pipeline

HardPipelines00:00
Practice interviewer
In session
5 left
00:00

Whenever you're ready, walk me through how you'd approach this.

You need to log in / sign up to chat or submit.

Problem

Context

A data platform customer runs a nightly ETL pipeline on a cloud data platform to transform raw product, order, and clickstream data into lakehouse tables used by finance and growth analytics. The current pipeline, implemented as a scheduled Spark job with Spark SQL and PySpark notebooks, has regressed from 45 minutes to over 3 hours, causing SLA misses for downstream dashboards and model features.

You are asked to diagnose and redesign the pipeline for performance while preserving correctness and operational simplicity. Assume the pipeline reads from Bronze tables, builds Silver business entities, and publishes Gold aggregates in a centralized data catalog.

Scale Requirements

  • Input volume: 12 TB/day across 3 Bronze tables
  • Daily rows processed: ~18 billion records
  • Peak skew: top 0.5% of customer IDs account for 35% of events
  • SLA: Gold tables available by 6:00 AM UTC
  • Current runtime: 3+ hours; target is under 60 minutes
  • Cluster: Managed Spark compute, 20 workers, i3.xlarge equivalent, hardware acceleration enabled where possible
  • Retention: 180 days in Bronze, 2 years in Gold

Requirements

  1. Identify likely Spark bottlenecks across joins, shuffles, file layout, skew, and inefficient transformations.
  2. Propose an optimized cloud data pipeline design using lakehouse tables, workflow orchestration, and a centralized data catalog.
  3. Explain how you would tune partitioning, caching, broadcast joins, Adaptive Query Execution, and file compaction.
  4. Define how to validate that optimizations do not change row counts, business logic, or idempotency.
  5. Include monitoring for stage runtime, shuffle spill, skewed tasks, small files, and table health.
  6. Describe how you would handle backfills and rollback if a performance change degrades correctness.

Constraints

  • Prefer native platform capabilities over external tools.
  • Budget allows at most a 20% increase in compute spend.
  • PII is governed in the centralized data catalog; no unmanaged copies outside approved storage.
  • The team wants notebook-to-production migration into reusable pipeline code within one quarter.