All jobs / Backend developer / Distributed Systems
Backend developer interview question · 3–5 years
The interviewer asks: “Consumers are slow. The publisher is fast. What do you do?” Strongest answer?
The strongest answer
Apply backpressure: bound the queue, slow or reject producers, scale consumers, drop or shed load with a policy. Unbounded in-memory buffers turn a slow consumer into an OOM.
Why it works
Exactly. Backpressure is how healthy systems refuse work. A bound plus a 429/503 or a load-shed policy is explicit; an unbounded list is an accident.
What a good answer covers
- Bound the buffer; don't grow forever.
- Slow, reject, or shed with a policy.
- Don't stall HTTP on queue depth.
- Don't ack to hide the pile.
Answers that fall short
- Close, but not the strongest: Buffer everything in the publisher process so we never drop work.
Publisher RAM is not a durable queue. You'll OOM and lose the buffer. - Weak: Block the HTTP thread until the queue drains.
Blocking request threads couples user latency to consumer lag and will exhaust the pool. - Red flag: Auto-ack messages so the queue stays small.
Auto-ack to “keep the queue small” is how you drop work on a crash. That's load-shedding by data loss.
Who gets asked this
More Distributed Systems questions
- The interviewer asks: “A message fails every time. The consumer keeps retrying. What now?” Strongest answer?
- Order-status events for the same order are arriving out of order at the consumer. The topic has twelve…
- The interviewer asks: “The user saves a profile then immediately GETs it from another region and sees the old…
- The interviewer asks: “A dependency is failing. How do you stop your service from dying with it?” Strongest…
- The interviewer asks: “The outbox publisher crashed after sending but before marking sent. What happens?”…
- The interviewer asks: “Recommendations are down. Checkout still needs to work. What do you do?” Strongest…
- The interviewer asks: “We're adding a search index. Can the API write DB and Elasticsearch in one request?”…
- What happened, and what actually protects the write?