Kafka 很强大,但并不总是正确的工具 — 它在高容量事件流、数据管道和事件驱动系统方面表现出色,但增加了运营复杂性,这是更简单的工具所避免的。理解 Kafka 何时合适(何时过度)反映了健全的判断力。
Kafka 何时是一个好的选择
✓ HIGH-VOLUME event streaming / data → millions of events; high throughput needs
✓ DATA PIPELINES → streaming data reliably between many systems (a data backbone)
✓ MULTIPLE CONSUMERS of the same stream → many independent consumers/groups read the data
✓ EVENT-DRIVEN architecture / event sourcing → events as a durable record
✓ REPLAY needed → re-read historical events
✓ REAL-TIME stream processing / analytics
→ Kafka shines for scale, streaming, retention, and multiple consumers
Kafka 何时可能过度
⚠️ Kafka adds OPERATIONAL COMPLEXITY (a distributed cluster to run, tune, monitor):
→ SIMPLE messaging / task queues → a simpler queue (RabbitMQ, SQS, Redis) may suffice
→ LOW volume → Kafka's scale is unneeded; simpler tools are easier
→ request/REPLY, complex routing → traditional queues fit better
→ just need a basic background job queue → don't reach for Kafka
→ don't add Kafka's complexity if you don't need its capabilities (YAGNI)
