Bird
0
0

You have a Kafka topic with 4 partitions. Your producer code uses a custom partitioner but messages always go to partition 0. What is the likely issue?

medium📝 Debug Q6 of 15
Kafka - Performance Tuning
You have a Kafka topic with 4 partitions. Your producer code uses a custom partitioner but messages always go to partition 0. What is the likely issue?
AThe partition count must be set to 0 for custom partitioners
BThe topic only has 1 partition despite configuration
CThe producer is not connected to the Kafka cluster
DThe custom partitioner always returns 0 regardless of key
Step-by-Step Solution
Solution:
  1. Step 1: Analyze custom partitioner behavior

    If all messages go to partition 0, the partitioner likely returns 0 always.
  2. Step 2: Check other options for plausibility

    Topic has 4 partitions, so B is incorrect; producer connection issues cause errors, not fixed partition; D is valid.
  3. Final Answer:

    The custom partitioner always returns 0 regardless of key -> Option D
  4. Quick Check:

    Partitioner logic controls partition choice [OK]
Quick Trick: Check partitioner return values for correct partition assignment [OK]
Common Mistakes:
MISTAKES
  • Assuming topic has fewer partitions
  • Ignoring partitioner logic
  • Thinking partition count 0 is valid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes