Design a near real-time analytics pipeline for a critical metric

This tests your grasp of stream processing trade-offs (latency, cost, correctness). Outline a 4-stage pipeline (ingest, process, store, visualize) with specific tech choices, contrasting its low-latency, high-cost nature with batch.
What's really being asked
This question assesses your ability to design for specific data latency requirements. The interviewer is looking for more than a list of technologies; they want to see you reason about the fundamental differences and trade-offs between stream processing (near real-time) and batch processing. They're testing your understanding of concepts like event time vs. processing time, windowing, state management, and the associated operational costs and complexities.
The full answer
A strong answer walks through a logical four-stage architecture. First, ingestion, using a durable message queue like Apache Kafka to handle high-throughput writes and buffer data. Second, processing, using a stream processor like Apache Flink for its low-latency, stateful processing capabilities to aggregate 'orders per minute'. Third, storage, using a specialized OLAP datastore like Apache Druid or ClickHouse, designed for fast queries over time-series data. Fourth, visualization and alerting, using a tool like Grafana to query the datastore and display the metric, with alerts for anomalies. The answer must also contrast this with a batch system (e.g., ETL jobs orchestrated by Airflow loading a data warehouse like Snowflake daily), highlighting the batch system's simplicity and lower cost but unacceptably high latency for this use case.
The mistakes people make
A major red flag is treating this like a standard web application architecture and suggesting relational databases (like Postgres) for storing and querying the high-frequency event stream; they can't handle the write load or query speed. Another mistake is simply listing tools ('I'd use Kafka, Spark, and Druid') without explaining why each component is chosen and how they connect. A junior answer focuses only on the happy path and ignores challenges like handling late-arriving data, ensuring data quality, or managing the state of the stream processor.
What usually comes next
How would you ensure exactly-once processing semantics? How do you handle schema evolution in the event stream? How would you scale the ingestion layer if traffic triples? What if the business now needs analytics with 50ms latency instead of 1-minute latency? How do you monitor the health of this pipeline itself?
A concrete example
For 'orders per minute', our pipeline needs to handle maybe 100,000 events per second at peak. We'd use Kafka for ingestion, as it can easily handle this throughput. Flink would process these events in one-minute tumbling windows. The output—a single data point per minute with the order count—is then written to Druid. Grafana queries Druid every 10 seconds to refresh the dashboard. The end-to-end latency from order event to dashboard update would be around 65-70 seconds, which fits the 'near real-time' requirement. A daily batch job would have a latency of up to 24 hours.
Interview question
When designing a near real-time analytics pipeline for a critical metric, what is the primary trade-off compared to a traditional batch processing system?
- a.Reduced need for specialized data stores but slower data ingestion rates.
- b.Enhanced data consistency across systems but with reduced data throughput capacity.
- c.Significantly lower data latency at the cost of higher operational complexity and infrastructure.Correct
- d.Simplified data model design but a greater risk of data loss during processing.
Why? this is the answer
The card emphasizes that stream processing provides low latency but entails higher operational costs and complexity. Batch systems, while simpler and cheaper, introduce significantly higher latency, making option C the direct trade-off highlighted.
Just read this? Test yourself on what you have been reading.
Read the original → evermethod.com
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.
We are hiring for this. Open roles that interview on system design — each one lists the topics its interview covers.
See open roles