Data Architecture, Pipelines, and ETL
For cloud SaaS applications, data architecture is the foundation that enables personalization, analytics, compliance, and real-time operations. As applications grow from thousands to millions of users, the path data takes β from generation to consumption β becomes increasingly complex.
This lesson follows the natural data lifecycle: ingestion β storage β security β DR β processing β ML.
The Hard Problems
Modern SaaS faces data problems that classic enterprise systems mostly didnβt:
Ingestion
How data enters the system. Three primary patterns:
Micro-batch splits the difference: small batches every few minutes for near-real-time analytics. Many production systems combine all three β stream critical user events, batch reference data nightly.
Streaming platforms
These platforms handle millions of events per second while preserving order and durability. The append-only log model means once data is written, it stays for replay and recovery β making debugging dramatically easier.
Batch platforms
Storage
Storage system categories
The lakehouse value
The lakehouse pattern earns its keep through:
- Schema evolution β handle changing data structures without breaking existing queries.
- Time travel β query historical versions for audit and debugging.
- ACID transactions β consistency during complex multi-step operations.
- Unified analytics β single system for batch and stream workloads.
Security
Security isnβt an afterthought in modern data architecture β itβs a foundational requirement that shapes every design decision.
Privacy-preserving techniques
- Anonymization β strip PII before analytics use.
- Pseudonymization β replace identifiers with tokens; reversible only with secure mapping.
- Differential privacy β add controlled noise to aggregate stats; protect individuals while preserving statistical accuracy.
- Synthetic data β generate fake data with the statistical properties of real data, for testing/dev.
Disaster Recovery
DR planning is required, not optional. Two key metrics:
DR strategies, from cheapest to most expensive:
| Strategy | RTO | RPO | Cost |
|---|---|---|---|
| Backup & restore | Hours-days | Hours | Low |
| Pilot light | Tens of minutes | Minutes | Medium |
| Warm standby | Minutes | Seconds-minutes | Medium-high |
| Active-active | Seconds | Near-zero | High |
For multi-tenant SaaS, regulatory tier and tenant SLA often dictate which strategy applies β different tiers may get different DR commitments.
Processing
Three architectural styles for transformation:
What the stream engine is actually doing
A stream processor is not a batch job on a shorter timer. It runs continuously, keeps state across events, and has to accept late and out-of-order records. Aggregations are windows: tumbling windows do not overlap, sliding windows do, and session windows close after a gap. Fault tolerance is a checkpoint of that state, not βstart the file over.β When a sink slows down, the engine applies backpressure instead of buffering without a bound. Flink, Kafka Streams, and the managed stream-analytics services are built around those properties. A batch engine such as Spark or a warehouse load sees the whole dataset, runs on a schedule, and restarts a failed stage from a checkpoint. Minutes of latency are acceptable; throughput is the point.
| Lambda | Kappa | |
|---|---|---|
| Paths | A batch layer (Spark or Hadoop) recomputes history. A speed layer (Flink or Storm) serves the recent tail. A serving layer merges the two answers. | One stream processor. What looks like batch is a replay of the append-only log through that same job. |
| When it hurts | The serving merge hides disagreement between the two paths until the numbers diverge. | Reprocessing has to fit in the streaming system, including state that is larger than a single window. |
ELT wins because storing raw files is cheap and transforming bytes on the way in is not. A later question can use the raw set instead of a new extract. dbt is the usual SQL layer, with tests in version control; Spark and Flink still cover jobs that are too large or too streaming for warehouse SQL.
Medallion layers
Lakehouse pipelines usually persist three copies instead of one transform:
- Bronze stores the raw records, audit trail included, and tolerates schema change.
- Silver is cleaned, validated, and enriched. Quality checks live here.
- Gold is shaped for one business question, often pre-aggregated.
Retention applies the same layering to time. Transaction logs may be kept for years; debug logs for about thirty days. Tiering moves bytes from hot to warm, cold, and archive. Archive classes such as Glacier are cited around 80 to 90 percent cheaper, paid for in restore time. A deletion has to follow one user id through the lake, the warehouse, caches, and every gold table. A copy the job does not know about is still there.
ML and AI Considerations
Modern SaaS data architectures need to support ML workloads alongside traditional analytics.
Multi-Tenancy in Data Layer
For multi-tenant SaaS, data architecture decisions interact with tenancy:
- Per-tenant data warehouses for big enterprise tenants β easy GDPR-style data deletion.
- Shared warehouse with tenant_id partitioning for the long tail β efficient at scale.
- Hybrid β usually correct in practice.
The key tension: cost-efficiency wants shared infrastructure; isolation/compliance wants separation. Most platforms blend.
Recap
- The data lifecycle: ingest β store β secure β DR-protect β process β ML.
- Ingestion patterns: batch, streaming, micro-batch. Most production systems mix all three.
- Storage categories: operational DBs, data lakes, warehouses, lakehouses. None of these alone is enough; youβll likely use all four.
- Security is foundational: classification, encryption, zero trust, audit. Privacy techniques (anonymization, differential privacy) protect individuals.
- DR is non-negotiable; tier strategies by criticality (cost-RTO trade-off).
- Processing: Lambda, Kappa, or modern unified. ELT > ETL in modern warehouse stacks.
- ML adds new requirements: feature stores, vector DBs, online-offline parity.
- Multi-tenancy interacts with every layer; per-tenant separation for isolation, shared infrastructure for efficiency.