Lesson 9 of 9 · 22m
When a Simple Queue Beats Kafka
Choose infrastructure from requirements: replay, ordering, fan-out, retention, operational maturity, latency, and whether you need a log or a work queue.
Kafka is excellent infrastructure and a terrible default. I have recommended it for systems that needed replayable event history, multiple independent consumers, high sustained throughput, and stream processing. I have also talked more teams out of Kafka than into it. If the actual requirement is "run this job later," a boring queue or database-backed worker system will often be cheaper, safer, and easier to operate.
Kafka is a log; a queue is a work-distribution primitive
The distinction matters:
Kafka:
producers append -> consumers track offsets -> data retained -> replay possible
multiple independent groups read the same history
Work queue:
producers enqueue -> workers claim tasks -> acknowledgement deletes/completes task
each task is normally processed by one workerIn Kafka, the broker does not know whether your business effect succeeded. In a queue, acknowledgement semantics often sit closer to task completion. Neither is magically correct, but they optimize different workflows.
Choose Kafka when these requirements are real
replay or rebuild downstream state
multiple independent consumers of the same event stream
high sustained throughput
long retention or event-sourced integration
stream processing or change-data-capture pipelines
partition-level ordering across many entitiesTwo or three of those together are a strong signal. "We might need replay someday" alone is not. Kafka's operational cost begins immediately; speculative value arrives maybe never.
Choose a simple queue when the unit is a job
Sending email, generating a PDF, resizing an image, indexing a document, or invoking a webhook are often tasks, not facts about the world. A queue with visibility timeout, redrive policy, and dead-letter queue is direct:
enqueue task -> worker leases it -> success ack -> remove
failure -> visibility expires or retry counter increments -> retry or DLQAmazon SQS, RabbitMQ, Redis-backed job systems, or even Postgres with FOR UPDATE SKIP LOCKED can solve this with far less cognitive surface than a Kafka cluster. The right choice depends on throughput, ordering, durability, and existing operational expertise.
Ordering is where teams lie to themselves
If every task must be globally processed in order, parallelism disappears. If only per-entity ordering matters, Kafka partitioning is strong — but so are keyed job shards in simpler systems. Ask how strict ordering really is. Many systems merely need causal ordering for a few transitions, which application state machines can enforce without pretending the broker provides global truth.
Operational maturity is part of the architecture
Kafka requires care around partitions, replication, rolling upgrades, schema evolution, consumer offsets, lag, disk capacity, and client versions. Managed Kafka reduces hardware work, not conceptual work. If the team cannot yet explain why ordering is per partition, adding Kafka to solve a small asynchronous-job problem is self-harm.
Conversely, if the organization already runs Kafka well and has platform automation, marginal cost may be low. Architecture decisions are local. Copying Netflix's diagram into a five-person team is not maturity.
The hybrid answer is common
Use the database as system of record, emit events through an outbox, consume them into Kafka for analytics and integration, and use a worker queue for imperative tasks. Events say what happened; commands say what someone wants done. Mixing those categories casually creates semantic messes that no broker can repair.
Field notes
- If you cannot state retention, replay, fan-out, and ordering requirements, you are choosing by fashion.
- A simple queue still needs idempotent workers. At-least-once behavior exists outside Kafka too.
- Kafka can implement queue-like workloads, but you will recreate work-completion semantics in application code.
- The cost of Kafka includes on-call expertise, client upgrades, schema governance, capacity planning, and debugging distributed behavior — not just broker instances.
- Prefer the smallest system that honestly satisfies the invariant. Boring infrastructure is a feature when it is correct.
Was this lesson helpful?