MESSAGING & EVENT-DRIVEN ARCHITECTURE / SYSTEM CONCEPT BRIEF

Data lake architecture

A data lake is a central repository that stores raw data of any shape (structured tables, JSON events, logs, images) cheaply in object storage such as Amazon S3, in open file formats like Parquet.

IntermediatePhase 06 / Topic 18 of 18RequirementsTrade-offsFailure modes
01

Overview

A data lake is a central repository that stores raw data of any shape (structured tables, JSON events, logs, images) cheaply in object storage such as Amazon S3, in open file formats like Parquet. Unlike a data warehouse, which requires a schema before loading (schema-on-write), a data lake stores data first and applies structure when it is read (schema-on-read).

Modern lakes are organized in layers, often called bronze (raw), silver (cleaned and joined), and gold (business-ready aggregates). A catalog tracks tables and schemas, and query engines (Spark, Athena, Trino) read the files directly. Open table formats such as Apache Iceberg and Delta Lake add ACID transactions, schema evolution, and time travel, turning the lake into a lakehouse.

A reservoir with treatment stages

Rivers (sources) flow into a reservoir (raw zone). Water is filtered (silver) and then bottled for specific uses (gold). You can always go back to the reservoir to treat water differently.

02

When to use it

  • Storing large volumes of diverse data for analytics and machine learning.
  • Keeping raw history cheaply for reprocessing.
  • Decoupling storage from compute so multiple engines share the same data.
  • Building analytics on top of event streams and CDC.
03

Where it shows up in interviews

Analytics platform

Recognize it when: collect everything, analyze later.

  • Design a clickstream analytics platform
  • Design a data platform for ML training
Streaming ingestion

Recognize it when: continuous events into analytics storage.

  • Design an ad click aggregation system
  • Design IoT telemetry storage
04

Where it is used in real software

Netflix

Built its data platform on S3 and created Apache Iceberg to manage petabyte-scale tables with reliable schema evolution.

Databricks lakehouse

Delta Lake on object storage with bronze/silver/gold medallion layers is a common enterprise pattern.

AWS analytics

S3 + Glue Data Catalog + Athena lets teams query files with SQL without managing servers.

05

Key terms

Schema-on-read
Structure applied when querying, not when loading.
Parquet
Columnar file format with compression, ideal for analytics.
Partitioning
Organizing files by keys such as date so queries skip irrelevant data.
Table format (Iceberg, Delta)
Metadata layer adding ACID transactions and schema evolution to files.
Medallion architecture
Bronze (raw), silver (clean), gold (aggregated) layers.
06

How it works, step by step

  1. 1
    Ingest raw data

    Batch loads, CDC from databases, and streams (Kafka, Kinesis) land in the bronze zone.

  2. 2
    Catalog it

    Register tables, schemas, and partitions in a catalog (Glue, Hive Metastore, Unity Catalog).

  3. 3
    Clean and conform

    Deduplicate, validate, and join into silver tables.

  4. 4
    Aggregate for consumers

    Build gold tables for dashboards, reporting, and features.

  5. 5
    Query and govern

    SQL engines and ML jobs read the tables; access control, lineage, and retention policies apply.

Data flowing through lake layers
Step 1 / 4
Sources
Bronze (raw)
Silver (clean)
Gold (aggregated)
Consumers

STEP 1App events, database CDC, and logs land as raw Parquet or JSON in S3, partitioned by date.

07

Data lake vs data warehouse vs lakehouse

Key differences

Step 1 / 5
AspectData lakeData warehouseLakehouse
Data typesAny (raw)StructuredAny
SchemaOn readOn writeOn write with evolution
Storage costLow (object storage)HigherLow
TransactionsNot by defaultYesYes (Iceberg/Delta)
Typical usersData engineers and MLAnalysts and BIBoth

NOWAspect: Data types | Data lake: Any (raw) | Data warehouse: Structured | Lakehouse: Any

Lakehouses combine cheap open storage with warehouse-like reliability.

08

Implementation

-- Silver table in Iceberg, partitioned by dayCREATE TABLE silver.page_views (  event_id STRING,  user_id STRING,  url STRING,  country STRING,  event_time TIMESTAMP)PARTITIONED BY (days(event_time))TBLPROPERTIES ('table_type' = 'ICEBERG'); -- Idempotent upsert from raw events (deduplicate by event_id)MERGE INTO silver.page_views tUSING (SELECT DISTINCT event_id, user_id, url, country, event_time FROM bronze.raw_events WHERE dt = '2026-09-26') sON t.event_id = s.event_idWHEN NOT MATCHED THEN INSERT *; -- Gold aggregate; partition pruning reads only one day of filesINSERT OVERWRITE gold.daily_viewsSELECT date(event_time) AS day, country, count(*) AS views, approx_count_distinct(user_id) AS uniquesFROM silver.page_viewsWHERE event_time >= TIMESTAMP '2026-09-26' AND event_time < TIMESTAMP '2026-09-27'GROUP BY 1, 2;
09

Complexity and performance

Storage cost~$0.02 per GB-month

Object storage standard tier.

Query costProportional to data scanned

Partitioning and columnar formats reduce it dramatically.

10

Trade-offs

Flexibility vs data swamp

Storing everything is cheap and flexible, but without catalogs, quality checks, and ownership, lakes turn into unusable swamps.

Open formats vs managed warehouses

Open formats avoid lock-in and share data across engines; managed warehouses (Snowflake, BigQuery) offer simpler performance tuning and governance.

11

Variants and related techniques

Lakehouse

Iceberg, Delta Lake, or Hudi tables with ACID and time travel.

Data mesh

Domain teams own and publish their data products on shared infrastructure.

12

Common mistakes

  • Millions of tiny files.

    Fix: Batch writes and run compaction jobs into larger Parquet files (128 MB-1 GB).

  • No partitioning or poor partition keys.

    Fix: Partition by commonly filtered columns (date), avoiding high-cardinality keys.

  • Personal data copied everywhere.

    Fix: Classify, mask, and apply retention and access policies from bronze onward.

13

Interview questions

Data lake vs data warehouse?

A data lake stores raw data of any format cheaply in object storage with schema-on-read, great for flexibility and ML. A warehouse stores curated, structured data with schema-on-write and strong SQL performance for BI. Lakehouses add warehouse features like ACID and schema enforcement to lake storage.

How would you design an analytics pipeline for clickstream data?

Stream events into Kafka or Kinesis, land raw data in S3 partitioned by date (bronze), run streaming or batch jobs to deduplicate and clean into Iceberg tables (silver), build aggregates (gold), and query with Athena, Trino, or Spark, with a catalog and access controls.

14

Practice problems

ProblemDifficultyWhat it trains
Design bronze/silver/gold tables for an e-commerce siteMediumLayering and partitioning.
Fix a slow lake query caused by small filesMediumCompaction and pruning.