Designing Batch Processing Systems

1. Designing ETL Pipeline Architecture

StageDetail
ExtractSources: DB, files, APIs
TransformCleanse, normalize, enrich
LoadTarget: DW, lake, search
OrchestratorAirflow, Dagster, Prefect
ComputeSpark, dbt, Beam

2. Designing Data Processing Workflows

ElementDetail
DAGDirected acyclic dependencies
TaskAtomic unit; idempotent
TriggerSchedule, sensor, manual
SLAPer-task deadline; alert on miss

3. Designing Map-Reduce Patterns

PhaseDetail
MapParallel transformation per record
ShufflePartition + sort by key
ReduceAggregate per key
CombinerLocal pre-reduce; reduce shuffle
ModernSpark RDD/DF, Beam, Flink batch

4. Designing Batch Job Scheduling

MechanismDetail
Cron expressionTime-based
SensorWait for file/event
BackfillRun for past intervals
CatchupDisable to skip missed schedules

5. Designing Data Validation and Cleansing

Tool / CheckDetail
Great ExpectationsDeclarative data tests
dbt testsnot_null, unique, accepted_values, relationships
Schema validationJSON Schema, Avro
Anomaly detectionVolume / distribution checks
QuarantineBad rows → side table

6. Designing Idempotent Batch Jobs

TechniqueDetail
Partition overwriteRe-run replaces partition
MERGE / UPSERTSame input → same output
Job-run id in outputDetect/clean prior partial runs
Atomic publishWrite to temp, swap in

7. Designing Batch Job Monitoring

MetricDetail
DurationTrend over time; alert on regression
Rows processedOutput volume sanity
Success ratePer-task
CostCluster hours / DBUs
LineageUpstream/downstream impact

8. Designing Incremental Processing

ApproachDetail
Watermark columnProcess WHERE updated_at > last_run
CDCOnly changed rows
Change feedsIceberg/Delta/Hudi changelog
Snapshot diffCompare with previous full

9. Designing Batch Job Failure Handling

ActionDetail
Retry with backoffTransient infra issues
Skip + alertBad input row; quarantine
Resume from checkpointDon't restart whole pipeline
Manual rerunBackfill specific partition

10. Designing Distributed Batch Processing

EngineStrength
Apache SparkGeneral compute, ML
Apache BeamUnified batch + stream
Trino / PrestoFederated SQL
DaskPython-native
Snowflake / BigQueryManaged analytic SQL

11. Designing Batch Job Checkpointing

TechniqueDetail
Per-stage outputsPersist intermediates to storage
Spark checkpoint()Truncate lineage, recover faster
Workflow markersTrack completed steps
Idempotent restartSkip done steps

12. Designing Batch Job Parallelization

StrategyDetail
Data partitioningBy date / shard / hash
Right-size partitions~128MB–1GB each
Avoid skewSalt heavy keys
Adaptive query (Spark AQE)Auto-rebalance
Resource sizingMemory/CPU per executor