Big Data Processing
βBig dataβ used to mean Hadoop clusters and bespoke MapReduce code. Today it means cloud data warehouses, managed Spark, streaming engines, and a mature ecosystem thatβs accessible without building a Hadoop cluster.
This lesson surveys the patterns and tools for processing data at scale β TB to PB β and how they fit into modern SaaS data platforms.
The Two Modes
When the volume is actually βbigβ
Three properties decide whether a warehouse or a cluster is warranted. Volume is size: queries that were fine at 10 GB start to time out around 100 GB and need another architecture at terabytes. Velocity is arrival rate, such as clickstream or a fraud check that must finish in milliseconds. Variety is mixed shape in one product: JSON logs, CSV, binary, metrics, ticket text, images. Veracity, whether the data is trustworthy, is a problem at every scale; a small error rate becomes a large incident once the pipeline holds petabytes.
For a dataset that still fits in memory, a single process is often faster than Spark or Hadoop. Scheduling and shuffle overhead dominate the actual work. The cluster earns its place when the data does not fit, and when a failed worker must be retried automatically.
MapReduce, including inside a SQL warehouse
The engines under Athena, BigQuery, and Snowflake still split work into a map, a shuffle, and a reduce.
- Map. Each worker reads its own slice, talks to no other mapper, and emits key-value pairs. A session log can emit country and duration.
- Shuffle and sort. Keys are partitioned onto reducers, each reducerβs input is sorted, and the bytes cross the network. This stage is usually most of the runtime and most of the bandwidth. A combiner pre-aggregates on the mapper so fewer bytes move.
- Reduce. All values for a key arrive together, in order, and the reducer emits the aggregate, such as average duration per country. A failed task is run again on another node.
Spark keeps map and reduce and schedules them as a DAG, chaining stages in memory so intermediate boundaries stay off HDFS. That is the change that makes iterative algorithms practical. Tez is the DAG engine under Hive and Pig. Catalyst rewrites a DataFrame plan with both rule-based and cost-based choices, and Adaptive Query Execution in Spark 3+ revises the plan from runtime statistics when a key is skewed. Flink and Storm run the same distributed transform on an unbounded stream, using watermarks to decide when a window can close.
Major Frameworks
Apache Spark β The Workhorse
Apache Flink β The Streaming Specialist
Apache Beam β The Portable API
Cloud Data Warehouses
For most SaaS, the analytical workload lives in a cloud DW (Snowflake/BigQuery/Redshift) rather than a Spark cluster. Spark/Flink are reserved for things the warehouse canβt do efficiently.
Architectural Patterns
Lambda Architecture (Classic)
βββ [ Batch layer (Spark) ] ββ [ Batch view ]
[ Source ] βββ€ β
βββ [ Speed layer (streaming) ] β [ Speed view ]
β
[ Serving layer ]
Two parallel pipelines: batch for accuracy and reprocessing, speed for low latency. Outputs merged at query time. Two codebases, double maintenance.
Kappa Architecture (Modern)
[ Source ] β [ Stream processing (Flink) ] β [ State / View ]
Single streaming pipeline. Treats batch as a bounded stream. Reprocessing means replaying the stream from the beginning. Simpler operationally; requires processing engine that can handle replay.
Modern Data Stack (Pragmatic)
[ Sources ]
β
βΌ (Fivetran, Airbyte, custom CDC)
[ Cloud Warehouse: Snowflake/BigQuery/Redshift ]
β
βββΊ [ Transformation: dbt (SQL) ]
β
βββΊ [ Reverse ETL (Hightouch, Census) ] β [ Operational systems ]
β
βββΊ [ BI (Looker, Mode, Tableau) ]
β
βββΊ [ ML platforms (Snowpark, BigQuery ML, SageMaker) ]
The pattern most modern SaaS uses. The warehouse is the central hub; tools around it handle ingestion, transformation, activation, BI, ML. Less ops than Spark/Flink for analytical use cases.
ETL vs. ELT
For most modern SaaS data stacks, ELT with dbt is the right answer. Raw data in the warehouse is reusable; SQL-defined transformations are version-controlled and testable.
Streaming Concepts Youβll Need
Choosing for SaaS
| Use case | Default choice |
|---|---|
| Analytical queries on TB data | Cloud warehouse (Snowflake/BigQuery/Redshift) |
| Heavy ETL transforms | dbt or Spark on managed (Databricks/EMR) |
| Real-time analytics, fraud detection | Flink (managed via Confluent or Ververica) |
| Stream processing in AWS | Kinesis Data Analytics or Flink on EKS |
| Stream processing in GCP | Dataflow (Beam) |
| Greenfield data platform | Modern data stack (warehouse + dbt + Fivetran) |
For most SaaS, the analytical workload should live in a cloud warehouse. Reach for streaming engines (Flink, Spark Streaming) when you have genuine real-time requirements.
Recap
- Two modes: batch (bounded data, periodic) vs. streaming (unbounded, continuous). Modern frameworks unify both.
- Major frameworks: Spark (workhorse), Flink (streaming specialist), Beam (portable API).
- Cloud warehouses (Snowflake, BigQuery, Redshift) handle most analytical workloads.
- Architectural patterns: Lambda (two pipelines), Kappa (one streaming pipeline), Modern Data Stack (warehouse-centric).
- ELT > ETL in modern stacks. dbt is the SQL transformation standard.
- Streaming concepts: event time, windows, watermarks, state, backfilling.
- For SaaS: cloud warehouse first. Streaming engines for real-time needs.