← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · updated 7d
← Back to glossary

Apache Kafka

Messaging Advanced
debt(d7/e7/b7/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints indicate no automated detection (automated: no), and the listed tools (rdkafka, confluent-platform, kafka-php) are Kafka client libraries, not linting or static analysis tools. Misuse patterns — wrong partition count, missing consumer groups, not handling rebalances, or using Kafka for simple task queues — only surface under load or through architectural review, not through any automated tooling.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix frames this as a foundational architectural choice (Kafka vs. SQS/RabbitMQ). Replacing Kafka with a simpler queue, or correcting a too-few-partitions design at scale, requires touching producers, consumers, deployment configuration, and potentially data pipeline integrations across the codebase. It is not a single-file fix.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (e7). Applies to web, cli, and queue-worker contexts per applies_to. Kafka's partitioning model, consumer group semantics, and operational infrastructure (brokers, ZooKeeper/KRaft, schema registry) shape every downstream service and data flow decision. The tags (distributed-systems, streaming) confirm this is load-bearing infrastructure. Every new consumer or producer must conform to Kafka's model.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception field explicitly states: 'Kafka replaces RabbitMQ — they serve different purposes.' A competent developer familiar with message queues will assume Kafka is a drop-in upgrade to RabbitMQ, when in fact they have fundamentally different delivery and consumption semantics. The common_mistakes reinforce multiple non-obvious behavioral gotchas (consumer groups, partition limits, rebalance handling) that contradict intuitions built from other queue systems.

About DEBT scoring →

Also Known As

Kafka event streaming Kafka topics consumer groups

TL;DR

A distributed event streaming platform — topics, partitions, and consumer groups enable high-throughput, fault-tolerant, replayable message streams at massive scale.

Explanation

Kafka differs from RabbitMQ fundamentally: messages are retained for a configurable period (not deleted on consumption), ordered within partitions, and replayable from any offset. Consumers track their own offset — multiple consumer groups can independently read the same topic. Partitions enable parallelism: a topic with 6 partitions supports 6 concurrent consumers in a group. Use Kafka for event sourcing, activity feeds, log aggregation, and stream processing. Use RabbitMQ for task queues where messages should not be replayed.

Diagram

flowchart TD
    P1[Producer] & P2[Producer] --> T[Topic: orders]
    subgraph Partitions
        T --> PA[Partition 0]
        T --> PB[Partition 1]
        T --> PC[Partition 2]
    end
    subgraph Consumer Group A
        PA --> C1[Consumer 1]
        PB --> C2[Consumer 2]
        PC --> C3[Consumer 3]
    end
    subgraph Consumer Group B
        PA & PB & PC --> C4[Consumer 4<br/>independent offset]
    end
style T fill:#6e40c9,color:#fff
style PA fill:#1f6feb,color:#fff
style PB fill:#1f6feb,color:#fff
style PC fill:#1f6feb,color:#fff

Common Misconception

Kafka replaces RabbitMQ — they serve different purposes: Kafka is for high-volume event streams with replay capability; RabbitMQ is for reliable task delivery with complex routing.

Why It Matters

Kafka's replay capability means you can reprocess all historical events when a new service is deployed — impossible with traditional queues where messages are deleted on consumption.

Common Mistakes

  • Too few partitions — you cannot scale consumers beyond the partition count; add partitions before you need them.
  • No consumer group — a consumer without a group reads from the beginning on every restart.
  • Not handling rebalances — partition reassignment during consumer group scaling interrupts processing.
  • Using Kafka for simple task queues — the operational overhead is not justified; use RabbitMQ or SQS.

Code Examples

✗ Vulnerable
// Single partition — only one consumer processes, no parallelism:
$admin->createTopics([new NewTopic('orders', 1, 1)]);
// With 1 partition, adding more consumer instances does nothing
// All 1000 orders/sec go through one consumer
✓ Fixed
// Multiple partitions — parallel processing:
$admin->createTopics([new NewTopic(
    'orders',
    numPartitions: 12,      // 12 partitions = 12 parallel consumers max
    replicationFactor: 3    // Replicated across 3 brokers — fault tolerant
)]);

// Consumer group — each partition assigned to one consumer:
$consumer->subscribe(['orders']);
// 12 consumer instances each get ~1 partition — parallel processing

Added 15 Mar 2026
Edited 22 Mar 2026
Views 100
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings F 2 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 1 ping S 1 ping M 1 ping T 1 ping W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 2 pings F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 1 ping T 0 pings F
No pings yet today
PetalBot 1
Google 9 ChatGPT 8 Perplexity 7 Amazonbot 7 SEMrush 7 Scrapy 7 Ahrefs 6 PetalBot 5 Bing 4 Unknown AI 2 Twitter/X 2 Applebot 2 Majestic 1 Meta AI 1 Brave Search 1
crawler 64 crawler_json 5
🧱 FUNDAMENTALS — new to this? Start with the ground floor.
Channel messaging A channel is a named pipe that carries messages between senders and receivers. One side puts messages in, the other side reads them out.

Channels are how independent parts of a system talk without being wired directly together. Every messaging tool — queues, event buses, chat apps, WebSockets — is built around this idea.

💡 Define channel names as shared constants so sender and receiver can never drift apart.

Ask Codex about Channel →
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: High
⚡ Quick Fix
Use Kafka when you need event log replay, high throughput (millions/sec), or multiple independent consumers reading the same stream — use SQS/RabbitMQ when you just need a job queue
📦 Applies To
any web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
Job queue with high throughput requirements; multiple consumers needing to replay same events; event log needed for audit or CDC
Auto-detectable: ✗ No rdkafka confluent-platform kafka-php
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File Tests: Update


✓ schema.org compliant