When do you actually need a cluster?
A TPC-H benchmark across Apache Spark, DuckDB, Polars and DataFusion — five single-machine configurations plus a real 2-worker Spark cluster, all reading identical Parquet.
Headline
Total wall-clock over the 8-query subset at SF10 (docker, 8 vCPU, 16.6 GB RAM):
| Engine | Total (s) | × fastest |
|---|---|---|
| DuckDB | 8.0 | 1.0× |
| DataFusion | 9.8 | 1.2× |
| Polars | 15.3 | 1.9× |
| Spark (default) | 79.6 | 9.9× |
| Spark (tuned) | 88.2 | 11.0× |
| Spark (2-worker cluster) | 125.5 | 15.6× |
Spark on defaults is 9.9× slower than DuckDB here — almost entirely fixed per-query overhead (query planning, task scheduling, JVM start-up, shuffle) that an in-process engine simply doesn't pay. On data this small it never gets the chance to amortise it.
Tuning Spark (shuffle-partition count, broadcast threshold, Kryo) made it 11% worse at SF10; the 2-worker cluster is 1.6× the local-mode time (network shuffle for no extra scale).
How each engine scales
Per query
| Query | DuckDB | Polars | DataFusion | Spark (default) | Spark (tuned) | Spark (2-worker cluster) |
|---|---|---|---|---|---|---|
| Q1 | 1.161 | 4.647 | 0.932 | 4.619 | 4.425 | 6.769 |
| Q3 | 0.833 | 0.953 | 0.730 | 9.107 | 10.247 | 12.313 |
| Q5 | 0.885 | 1.565 | 1.098 | 18.259 | 16.656 | 28.435 |
| Q6 | 0.397 | 0.356 | 0.550 | 1.130 | 1.255 | 1.697 |
| Q9 | 1.980 | 2.401 | 2.052 | 10.027 | 11.216 | 18.043 |
| Q10 | 0.938 | 0.976 | 1.039 | 6.890 | 7.219 | 12.106 |
| Q12 | 0.577 | 0.637 | 0.880 | 4.579 | 4.581 | 6.433 |
| Q18 | 1.275 | 3.795 | 2.538 | 24.954 | 32.558 | 39.696 |
Does tuning Spark close the gap?
Not meaningfully — not at these sizes. Spark's default AQE already coalesces post-shuffle partitions; sizing shuffle parallelism by hand, raising the broadcast threshold and switching to Kryo made it 11% worse. It stays one to two orders of magnitude off the in-process engines either way. The knobs earn their keep on data large enough for the shuffle to dominate — past what a single machine holds — which is exactly where this benchmark stops.
Memory
Reading this
The pattern almost every run shows: in-process engines dominate at the sizes a single modern machine can hold. Spark's architecture — a driver, a scheduler, serialized tasks, a JVM per executor — is built to survive node failure and scale horizontally. On one box, over data that fits in RAM, that machinery is pure overhead, and it shows up as a near-constant per-query tax.
Spark earns its keep when: the working set genuinely exceeds one machine's memory and can't be partitioned away; you need the fault tolerance for multi-hour jobs; or you're already invested in the ecosystem (Delta/Iceberg ACID, a shared catalog, streaming). The measured "you need a cluster" threshold has moved from ~100 GB a few years ago to several TB — this benchmark is one data point on where it sits today.
And a small standalone cluster is the wrong move on one host: this run's 2-worker cluster was slower than local mode, because you've added a network shuffle and RPC round-trips without adding any data that needed distributing.
Setup & method
Reproduce it
git clone https://github.com/aleksamilic-dev/tpch-engine-benchmark cd tpch-engine-benchmark docker compose build docker compose run --rm bench python -m datagen.generate --sf 1 docker compose run --rm bench python -m bench --sf 1 --engines duckdb,polars,datafusion docker compose run --rm bench python -m bench --sf 1 --engines spark docker compose run --rm bench python -m bench --sf 1 --engines spark-tuned # the 2-worker standalone cluster docker compose up -d spark-master spark-worker-1 spark-worker-2 docker compose run --rm --use-aliases bench python -m bench --sf 1 --engines spark-cluster docker compose run --rm bench python -m report.build_report