Question 2 of 50
What problem does Kafka solve?
Question
"What problem does Kafka actually solve, in practice? Why not just call the other services over HTTP?"
What the interviewer wants to assess
Whether you understand the motivation behind event-driven architecture, not just Kafka's technical mechanics. It's common for candidates to know how to operate Kafka without being able to articulate the business problem it solves.
Resposta rápida
Kafka solves the coupling problem: when a business event matters to multiple systems, calling each one via synchronous HTTP creates a direct dependency between the producer and every consumer, and each new consumer requires changing the producer. Kafka decouples this — the producer publishes once, and any number of consumers read independently.
Resposta nível Sênior
In systems with few services, synchronous calls work fine. The problem shows up when the same business event — say, "payment approved" — starts to matter to multiple systems: notifications, antifraud, accounting, analytics. If the payments service calls each one directly, it becomes coupled to all of their availability, and adding a new consumer requires changing the producer's code. Kafka solves this by inverting the model: the producer publishes the event once to a topic and moves on; each interested consumer reads that event at its own pace, without the producer needing to know it exists. This decouples both technically (a slow consumer failing doesn't bring down the producer) and organizationally (teams evolve their consumers without coordinating deploys with the producer's team).
In-depth explanation
See "The problem before Kafka" in Chapter 1 for the full reasoning, including why this isn't primarily a performance question, but a coupling one.
Exemplo financeiro
Before Kafka, adding a cashback system that reacts to "purchase approved" would require changing the
card authorization service to call it directly. With Kafka, the cashback team simply creates a new
consumer on the compras.aprovadas topic — the authorization service doesn't change a single line.
"Kafka solves the volume/performance problem"
Volume is a consequence of the design, not the original motivation. A system can justify Kafka even with moderate volume, just because it has many independent consumers of the same event — the core problem is coupling, not just throughput.
Pode vir a seguir
Be ready for: "couldn't this be solved with a queue?" and "give me a real example where you saw this coupling become a problem."
Related chapters