Skip to content
tezvyn:

Design a Real-Time Analytics Pipeline for Mobile Events

Source: dagster.ioHardHow cards are made

Design a Real-Time Analytics Pipeline for Mobile Events

Tests your grasp of low-latency, high-throughput design. A strong answer outlines ingestion (Kafka), stream processing (Flink), and a real-time OLAP database (Druid/ClickHouse). A red flag is proposing a slow, batch-only architecture.

What's really being asked

This question tests your understanding of real-time data architectures (like the Kappa architecture), not just traditional batch ETL. The interviewer wants to see if you can select appropriate technologies for each stage of a low-latency pipeline and justify your choices based on trade-offs like throughput, latency, cost, and operational complexity. They are probing for experience beyond simple database writes and looking for an end-to-end vision.

The full answer

A strong answer walks through the pipeline in order, addressing the 'seconds' latency requirement at each step. First, ingestion from millions of clients, using a scalable message queue like Apache Kafka or AWS Kinesis to act as a durable buffer and decouple producers from consumers. Second, stream processing using a framework like Apache Flink or Spark Streaming to perform transformations, filtering, or aggregations in real-time as data flows through. Third, storage in a specialized database, specifically a real-time OLAP datastore like Apache Druid or ClickHouse, which are designed for fast analytical queries over time-series data and high-volume ingestion. Finally, the dashboard layer that queries this OLAP database.

The mistakes people make

A huge red flag is suggesting a traditional batch processing architecture. For example, 'We'll log events to files, then run a nightly job to load them into our data warehouse.' This completely misses the 'within seconds' requirement. Another common mistake is choosing a general-purpose OLTP database like Postgres or MySQL for the final storage. These databases will not scale for the analytical query patterns and high ingest volume required, leading to slow dashboards and query timeouts. Simply naming a technology, like 'We'll use Kafka,' without explaining its role and how it connects to other components is a junior-level response.

What usually comes next

Expect questions about scalability, reliability, and cost. How do you handle backpressure if a downstream component slows down? How do you ensure exactly-once processing semantics to avoid data loss or duplication? How would you handle schema evolution when the mobile app changes its event format? How would you monitor this pipeline for data quality and end-to-end latency? What are the cost implications of your chosen cloud services at 1 million events per second?

A concrete example

For a mobile app generating 100,000 events per second, we'd use a client-side SDK to batch events and send them to a load-balanced endpoint that publishes to a Kafka topic with 50 partitions. A Flink job consumes from Kafka, performing a simple sessionization transformation in a 5-minute tumbling window. The aggregated results are written to Apache Druid, which can ingest millions of events per second and provide P95 query latencies under 2 seconds. The dashboard itself could be a tool like Superset or a custom React app that generates Druid SQL queries.

Interview question

Which technology is specifically designed to serve as the final analytical data store for a real-time mobile event pipeline requiring sub-second query latency on high-volume, time-series data?

  • a.PostgreSQL
  • b.Apache Kafka
  • c.Apache DruidCorrect
  • d.Apache Hadoop HDFS
Why?

Apache Druid is explicitly mentioned as a real-time OLAP datastore designed for fast analytical queries over time-series data and high-volume ingestion, making it ideal for this scenario. PostgreSQL is a general-purpose OLTP database unsuitable for the analytical query patterns and high ingest volume required, while Kafka is an ingestion layer and HDFS is a batch-oriented storage system.

Just read this? Test yourself on what you have been reading.

Read the original → dagster.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on system design — each one lists the topics its interview covers.

See open roles