Skip to main content
← PROBLEMS / ARCHITECTURE
An end-to-end domain learning journey

Design a Sub-Second Distributed OLAP Query
Engine on Parquet & S3.

Prune S3 partitions via an Iceberg/catalog metadata index, cache Parquet footers and hot column pages on worker NVMe via consistent hashing, shuffle with Arrow Flight, and spill skewed hash tables to NVMe.
Start the journey5 stages· Last modified Nov 28, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When designing a sub-second S3 OLAP engine, pair Iceberg metadata pruning with consistent-hashed NVMe caches, Arrow Flight shuffles, and NVMe spill guards.

TL;DR30-second simplified summary
▾

Iceberg manifests cut discovery from 5s to 11 ms, consistent hashing hits 94% NVMe cache locality, Arrow Flight shuffles without serde, and skew splitting + NVMe spill prevent OOMs.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Arrow Flight & Vectorized Execution
Know 2,048-row SIMD execution, Selection Vectors, and zero-copy Arrow Flight shuffles.
Parquet Row Groups & Min/Max Statistics
Understand that Parquet stores column min/max stats and Bloom filters in the file Footer.
Full walkthrough · 5 stages
01
L4 · FUNDAMENTALS

R & E · Requirements, S3 Pruning & NVMe Cache Math.

500 TB of Parquet (~500,000 files at 1 GB/file or 2M files at 256 MB/file) cannot be LISTed from S3 per query (1,000 keys/LIST = 2,000 S3 API calls = 10+ seconds).

Illustrative Sizing: An Iceberg/Delta metadata catalog keeps partition + file min/max stats in Coordinator RAM (~2 GB for 2M files), pruning a typical dashboard query (last 7 days, region='US') down to ~200 MB of actual column chunks! With 50 workers x 2 TB NVMe = 100 TB of aggregate NVMe cache (20% of total 500 TB dataset), consistent-hashed task routing hits local NVMe at ~3 GB/s per worker—reading 200 MB in ~15–40 ms instead of 200+ ms over S3.

Cold S3 vs. Warm NVMe

Per-Query S3 LIST + Download (5s+) vs. Catalog Prune + Consistent NVMe (<500 ms)

Before · Naive S3 Scan
  • S3 LIST + Footer GETs take 3–5s
  • Zero worker cache locality
  • Skewed join OOMs 64 GB RAM
After · Iceberg Prune + NVMe + Spill
  • <15 ms metadata pruning
  • >90% local NVMe cache hits
  • Dynamic NVMe spill prevents OOM
02
L4 · FUNDAMENTALS

S · Storage: Consistent-Hashed NVMe Cache & Parquet Coalescing.

If the Coordinator schedules file_42.parquet onto Worker 1 on Query A and Worker 37 on Query B, every worker ends up caching duplicate copies of the same hot files.

The Coordinator assigns (s3_uri, row_group_id) via Bounded-Load Consistent Hashing across the 50 workers. Worker 1 always owns file_42, caching its Parquet Footer + hot Zstd column pages on its 2 TB local NVMe. On a cache miss, the worker issues Coalesced S3 Byte-Range GETs (merging nearby column offsets within 1 MB into one HTTP request) to cut S3 request fees and RTTs.

Storage & Cache Affinity

Iceberg Catalog -> Consistent Hash Affinity -> Worker NVMe -> Coalesced S3

Iceberg MetadataConsistent Hash2 TB Worker NVMeS3 Range Coalesce
03
L5 · APPLIED DESIGN

H & A · Coordinator DAG, Arrow Flight Shuffle & BI Streaming.

The SQL Coordinator parses SQL, builds a vectorized physical DAG (Scan -> Filter -> HashJoin -> PartialAgg -> FinalAgg), and dispatches stage tasks to workers.

For small dimension tables (<100 MB), the Coordinator chooses a Broadcast Join (sending the small table once to all 50 workers, zero shuffle on the big fact table!). For large-to-large joins, workers hash-partition output RecordBatches by join key and stream them directly peer-to-peer over Arrow Flight.

Distributed Query DAG

BI Client -> Coordinator (Prune) -> Workers (NVMe + Flight Shuffle) -> Result

BI / Flight SQLSQL CoordinatorScan Workers (NVMe)Join Workers(Flight)1. Submit SQL Query2. Prune S3 + dispatch consistenttasks3. Arrow Flight zero-copy shuffle4. Stream RecordBatches (<500 ms)
04
L5 · APPLIED DESIGN

D · Detailed Design: Skewed-Join Splitting & Dynamic NVMe Spill.

In real analytics, 1% of keys (like tenant_id = 'anonymous' or NULL) often account for 70% of rows. A standard hash shuffle sends all 70% to ONE worker, blowing past its 48 GB RAM limit.

Two defenses eliminate OOMs: (1) Adaptive Skewed-Join Splitting: if runtime stats detect one partition receiving >5x average bytes, split that hot key across K sub-workers (salting the probe side and replicating the hot build key K times); (2) Dynamic Spill-to-NVMe: every operator registers with a per-query MemoryPool. If pool usage crosses 75%, the hash join/aggregation spills its largest in-memory hash partitions to local NVMe as Arrow IPC files and merges them via external sort/hash!

Memory & Spill Guard

In-Memory Vectorized (<75% RAM) -> Spill Partition to NVMe -> External Merge

pool > 75% RAMstream partitions backquery completeIn-Memory Hash(<75%)Spill LargestPartitionsExternal NVMeMerge
Engineering Decision Framework
Problem
How to hit <500 ms p95 over 500 TB S3 Parquet while surviving skewed joins and 100 concurrent users.
Naive Solution
Scan S3 directly on every query and hold all hash join tables purely in RAM.
Why It Fails
S3 LIST/footer I/O blows past 500 ms immediately, and skewed keys OOM 64 GB workers.
Alternatives
Direct S3 + In-Memory-Only vs. Iceberg Prune + Consistent NVMe Cache + Dynamic Spill.
Engineering Decision
Prune via cached Iceberg manifests, route tasks via Bounded-Load Consistent Hashing to 2 TB NVMe caches, shuffle over Arrow Flight, and spill to NVMe at 75% RAM.
Trade-Offs
Spilling to NVMe slows down extreme skewed queries from <500 ms to a few seconds in exchange for zero OOM crashes.
Decision Exercise · Make the Call

During a JOIN between events (10B rows) and users (50M rows), 49 workers finish in 200 ms while Worker 17 OOM-crashes because 40% of events have user_id = NULL. How do you fix this?

05
L6 · SCALE & TRADE-OFFS

E & D · Evaluation, Assumptions, Limitations & Glossary.

The <500 ms p95 SLA applies to selective dashboard queries where Iceberg pruning narrows scans to <=1–2 GB and the hot working set fits in the 100 TB NVMe cache.

Assumptions & Limitations: Full-table unpruned scans across all 500 TB (e.g., SELECT COUNT(DISTINCT raw_url) FROM all_5_years) are fundamentally bound by S3/NVMe aggregate bandwidth (~150 GB/s across 50 workers = ~3,300 seconds cold, or minutes warm) and should route to a separate heavy-batch resource group with pre-computed HyperLogLog/rollups.

End-to-End OLAP Engine

Coordinator (Iceberg Prune) -> 50 Workers (NVMe + SIMD) -> Arrow Flight -> BI

Coordinator +Icebergingress50x NVMe Cache (100TB)storageSIMD Vectorized +SpillcomputeArrow FlightShuffle/Outcontrolbounded consistenthash2048-row vectorszero-copy shuffle & BI
Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why does reading an Iceberg/Delta metadata manifest beat calling S3 `LIST` + reading Parquet footers at query time?

Recommended Learning Flow