KatInterview

Design a User Profile Ingestion System: Batch vs. Streaming

System DesignModel answer
EasyModel answerSystem Designsystem designbatch processingevent streaming

Last updated

Design an ingestion and processing pipeline for JSON user profiles, comparing batch file arrivals against a real-time event streaming paradigm.

You are designing an ingestion platform that processes complex user profile records emitted by upstream application services. The records arrive as JSON objects containing personal details, physical addresses, and nested payment instrument arrays.

An example payload is shown below:

{
  "id": "u-001",
  "name": "Sample User",
  "address": {
    "street": "1 Main St",
    "city": "Springfield",
    "postal_code": "00000"
  },
  "payment_methods": [
    {
      "type": "card",
      "brand": "visa",
      "last4": "1111",
      "expires": "2029-08"
    }
  ]
}

Compare and outline the architectural design for processing this data under two distinct ingestion paradigms:

  1. Batch Ingestion: Upstream systems periodically deposit files containing collections of these JSON records into object storage.
  2. Streaming Ingestion: Upstream systems push real-time change events to a message bus as users update their profiles or payment options.

Your architecture should address data storage, processing steps (flattening, validation, PII handling), idempotency/deduplication, out-of-order data handling, and schema validation.

Hints

Hint 1

Focus on how idempotency is guaranteed differently in file-based batch loads versus event-driven streaming.

Hint 2

Consider security and privacy: how are nested PII and payment data sanitized or tokenized during ingestion?

Hint 3

Think about ordering guarantees—how do you ensure late-arriving stream events do not overwrite newer state?