Explain at-most-once, at-least-once and exactly-once processing, and how you achieve effectively-once results in practice.
What the interviewer wants to hear
- Defines the three delivery semantics
- Explains failure points: before or after committing offsets
- Exactly-once within Kafka uses idempotent producers and transactions
- End to end needs idempotent or transactional sinks
- Checkpointing in Flink or Spark
Model answer
At-most-once means a message is processed zero or one time: you commit the offset before processing, so a crash loses it. At-least-once commits after processing, so a crash causes a replay and possible duplicates. Exactly-once means each message affects the result once, even with failures. Inside Kafka, idempotent producers and transactions let a consume-transform-produce job commit output and offsets atomically. Engines like Flink and Spark Structured Streaming use checkpoints that store offsets and state together and replay from the last checkpoint. But end-to-end exactly-once also needs the sink to cooperate: either a transactional sink that commits with the checkpoint, like Flink two-phase commit, or an idempotent sink, such as upserting by a unique event ID. In practice, I design for at-least-once delivery plus idempotent writes, which gives effectively-once results and is simpler to reason about.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Data Engineer questions
- Design a data platform for a fast-growing startup with 20 data sources and a small team. What would you choose and why?
- A user asks to delete all their personal data. Your data is spread across a data lake, warehouse and backups. How do you handle it?
- How do you choose partitioning and clustering for a very large table? What can go wrong?
- The CEO's revenue dashboard showed wrong numbers for two days before anyone noticed. How do you fix this and prevent it from happening again?
- Design a pipeline that ingests 200,000 clickstream events per second and powers both a real-time dashboard and daily analytics.
- You must migrate a company from an on-premise warehouse to Snowflake or BigQuery without breaking hundreds of reports. How would you plan it?
- Leadership asks you to cut the cloud warehouse bill by 40 percent without hurting the business. What do you do?
- A metric definition changed and you must backfill two years of a large fact table while the daily pipeline keeps running. How do you do it safely?
- Design a CDC pipeline that replicates a busy PostgreSQL database into Iceberg or Delta tables, including updates and deletes. What are the tricky parts?