Data Engineering Reference/Production Pipeline Operations

Cost Optimization & Pipeline Observability

Spot vs on-demand clusters, right-sizing shuffle, storage lifecycle policies, and the metrics every production DAG should emit.

3/5Overview: 25m

Cost drivers

DriverLever
ComputeRight-size cluster, autoscale, spot/preemptible
ShuffleFewer wide transforms, broadcast joins
StorageLifecycle policies (S3 IA/Glacier), compaction
WarehouseIncremental models, avoid full scans
OrchestrationJob clusters vs always-on

Nightly batch: spin up → process → tear down beats 24/7 interactive cluster.

Right-sizing Spark

  • Dynamic allocation — add executors under load
  • Spot instances — for fault-tolerant batch (with retry)
  • Instance types — memory-heavy for shuffle, compute-heavy for CPU-bound UDFs (avoid UDFs)
  • Partition tuning — too many small tasks = scheduler overhead

Storage lifecycle

Bronze: 90-day hot → archive Silver: 2-year standard Gold: warehouse retention per compliance

Small file compaction reduces list/get costs on object storage.

Pipeline observability

Don't rely only on Airflow task green/red.

MetricTypeAlert
pipeline_freshness_lag_minutesGauge> SLA
rows_writtenCounterAnomaly vs baseline
job_duration_secondsHistogramp95 regression
data_quality_failuresCounter> 0 on block rules
cost_usd_estimateGaugeBudget threshold

Link to Observability for RED/USE, burn-rate alerting — apply to data platform on-call.

On-call for data

Data platform on-call differs from product on-call:

  • Backfill decisions under time pressure
  • Upstream producer coordination
  • Stakeholder comms when freshness misses

Runbooks: "silver late → check sensor → check EMR → escalate to source team."

Interview answer template

"We emit freshness and row-count metrics to Datadog per mart. SLO: gold ready by 6 AM 99.5% of days. Clusters are job-scoped with spot executors; shuffle-heavy jobs get memory-optimized instances. Bronze moves to IA after 90 days."

Further Reading

Hands-On Tasks (Optional)

Pipeline design drills and whiteboard exercises — DAG sketches, partition plans, backfill strategies. Assumes Databases and SQL fundamentals are in place.

  • Define pipeline SLIs

    List 5 SLIs for a critical daily pipeline: task success rate, freshness lag, row count delta, runtime p95, cost per TB. Set example SLO targets.

    15m