Apache Spark is an open-source distributed compute engine for batch processing, SQL, machine learning, and stream processing across large clusters.
A driver coordinates executors on Standalone, YARN, or Kubernetes; jobs form a DAG of stages with in-memory execution and disk spill. Run it self-managed, through EMR or Dataproc, or on Databricks. It reads and writes Parquet, ORC, Avro, CSV, and JSON natively, and the lakehouse formats through DataSource V2.
How Apache Spark answers the questions each capability turns on.
| How it works | |
| APIs | RDDs, DataFrames and Datasets, SQL; Spark Connect client |
| Data model | Tabular DataFrames over rows; RDDs of objects |
| Execution model | DAG of stages separated by shuffles; in-memory |
| Larger than memory | Spills to disk: MEMORY_AND_DISK storage levels and shuffle spill, so a job is not bounded by RAM |
| Running it | |
| Runtime | JVM; Python over Arrow-based IPC |
| GPU support | GPUs as a scheduled resource since 3.0; SQL and DataFrame offload needs the RAPIDS plugin |
| What you run | A Spark cluster: a driver and executors on Standalone, YARN or Kubernetes |
| Scaling | Dynamic allocation adds and removes executors, off by default and needing the external shuffle service; decommissioning migrates blocks first |
| Failure recovery | Lost partitions are recomputed from lineage; tasks and stages retry, and shuffle files are kept so a retry need not redo them |
| Connections | |
| Table formats | Parquet, ORC, Avro, CSV and JSON natively; Iceberg, Delta Lake and Hudi through DataSource V2 |
| How it works | |
| Processing model | Micro-batch by default; real-time mode since 4.1 runs a long-lived task per partition; continuous processing stays experimental |
| APIs | Structured Streaming (DataFrame/Dataset), SQL; declarative pipelines in SQL or Python |
| Windowing | Tumbling, sliding, session |
| Event time and lateness | Watermarks via withWatermark; rows later than the threshold are dropped, no side outputs |
| State backend | RocksDB, HDFS-backed (default) |
| Delivery guarantee | Exactly-once in micro-batch · sink-dependent; continuous processing is At-least-once |
| Reading results | Through sinks; the memory sink is for debugging only |
| Running it | |
| What you run | A Spark cluster: a driver and executors on Standalone, YARN or Kubernetes |
| Scaling | spark.sql.shuffle.partitions fixes the state partition count, changing it on a stateful query means discarding the checkpoint; stateless queries can change it since 4.1 |
| Connections | |
| Connectors | Kafka and files built in; everything else through foreachBatch or a DataSource V2 connector such as Delta, Iceberg or Kinesis |
vs Apache Spark: Free · Operational complexity: Medium · Streaming · Batch · Java, Python, Go
vs Apache Spark: Streaming · Batch · Java, Scala, Python
vs Apache Spark: Batch · Java