Interview questions

Data engineering interview questions

62 questions, 62 with model answers. Every member practises all of them free.

Samples

3 of 62 questions.

Your Kafka ingestion pipeline lags by 2 minutes during a traffic surge. Producers are fine, consumers are idle. What's your debug path?

Show the answer

"Producers are fine, consumers are idle" is a critical clue — the data is reaching Kafka but consumers are not processing it. This points to a problem between the broker and the consumer, not the producer side.

Step 1 — Confirm the lag and isolate the partition:

# Check consumer group lag per partition
kafka-consumer-groups.sh \
  --bootstrap-server kafka:9092 \
  --describe --group my-consumer-group

# Output shows: TOPIC, PARTITION, CURRENT-OFFSET, LOG-END-OFFSET, LAG, CONSUMER-ID, HOST
# Look for: which partitions have lag, and whether CONSUMER-ID is blank (no active consumer on that partition)

If CONSUMER-ID is blank for lagging partitions → no consumer is assigned to those partitions — rebalance issue or consumer count < partition count.

Step 2 — Check if consumers are actually idle (not just slow):

# Prometheus metrics (if Kafka consumer metrics are exported)
# kafka_consumer_fetch_manager_records_lag_max
# kafka_consumer_fetch_manager_fetch_latency_avg

# Consumer application logs — are they throwing exceptions? Stuck in a slow processing loop?
kubectl logs <consumer-pod> --tail=200 | grep -E 'ERROR|WARN|rebalance|paused'

Common root causes and fixes:

  1. Consumer group rebalancing loop: during a surge, if consumer pods are added/removed faster than the rebalance stabilizes, consumers spend most of their time rebalancing instead of consuming.
  2. Check: kafka_consumer_coordinator_rebalance_total metric spiking.
  3. Fix: use Static Membership (group.instance.id) — prevents rebalance on brief disconnects. Tune session.timeout.ms (increase to 60s) and heartbeat.interval.ms (set to session.timeout.ms / 3).
  4. Consumer paused due to back-pressure: if the downstream sink (DB, API, cache) is slow, the consumer calls consumer.pause() or the processing loop blocks, causing it to stop polling. Kafka's consumer will be kicked out of the group if it doesn't poll within max.poll.interval.ms (default 5 minutes).
  5. Fix: decouple fetching from processing — use a bounded in-memory queue in the consumer; increase max.poll.interval.ms if processing is legitimately slow.
  6. Partition count < consumer instance count: excess consumers sit idle (one consumer per partition is the ceiling). The surge exposed the lack of parallelism.
  7. Fix: increase partition count (kafka-topics.sh --alter --partitions 24). Note: partition count can only increase, never decrease.
  8. Consumer fetch size too small for surge volume: fetch.min.bytes and fetch.max.bytes defaults may cause many small fetches, not keeping pace.
  9. Fix: increase fetch.max.bytes (default 50MB) and max.partition.fetch.bytes.
  10. GC pauses in consumer JVM: under surge memory pressure, full GC pauses block the poll loop long enough for the coordinator to consider the consumer dead, triggering rebalance.
  11. Check: consumer JVM GC logs (-Xlog:gc*).
  12. Fix: tune heap size, use G1GC or ZGC, or move to a non-JVM consumer (librdkafka-based).
  13. Broker throttling the consumer: check kafka_server_fetch_throttle_time_avg on the broker. If consumers are hitting byte-rate quotas, add a consumer quota or adjust the quota configuration.

Immediate mitigation:

  • Scale out the consumer group (add more instances, up to the partition count).
  • If consumers are stuck in rebalance: do a rolling restart with group.instance.id set to force static membership.
  • Check and reset any consumer offsets that got stuck: kafka-consumer-groups.sh --reset-offsets.

Sudden tail latency on a Redis-based stream session store during a Champions League match — how do you find & fix the bottleneck?

Show the answer

1. Diagnose in real time

redis-cli --latency                        # live latency samples
redis-cli --latency-history -i 1           # per-second history
redis-cli SLOWLOG GET 25                   # last 25 slow commands
redis-cli INFO stats                       # rejected_connections, blocked_clients
redis-cli INFO memory                      # used_memory vs maxmemory
redis-cli LATENCY LATEST                   # requires latency monitoring enabled

Enable latency monitoring if not already on:

redis-cli CONFIG SET latency-monitor-threshold 10

2. Common root causes and fixes

Root CauseSymptomsFix
BGSAVE / BGREWRITEAOF forkSpike every few minutes, high fork_avg_cpumsecDisable RDB (save ""), switch AOF to appendfsync everysec, schedule persistence off-peak
Hot key (single session shard saturated)One key dominating MONITOR outputShard sessions by key prefix across Redis Cluster; add a local in-process cache for read-heavy keys
Memory near maxmemory triggering evictionevicted_keys rising in INFO statsScale memory, or switch eviction policy to allkeys-lru and move cold sessions to a cheaper store

3. Preventive measures for traffic spikes

  • Pre-warm sessions before kick-off so the first wave of reads hits warm keys.
  • Use Redis Cluster to horizontally scale — distribute session keys across shards.
  • Set tcp-backlog 511 and tune OS somaxconn / net.core.somaxconn to handle connection bursts.
  • Monitor connected_clients and alert before hitting maxclients.

Define data modelling and the benefits of implementing a data model?

Show the answer

Data modeling is the process of creating a visual representation of either a whole information system or parts of it to communicate connections between data. Data modeling concepts create a blueprint for how data is organized and managed in your organization. Data models give developers and non-technical stakeholders a simplified way to have meaningful conversations about the needs of the business and how data insights can fuel better decision making.

59 more in the member app, with practice sets and your own marks. Join free

More topics

Other interview topics.