Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Kafka Difficulty: Intermediate ClaudeChatGPT

Kafka Topic Design & Partitioning Strategy Prompt

Design a Kafka topic from first principles — partition count, keying, replication factor, min.insync.replicas, and retention vs. compaction — to match ordering, scale, and durability needs.

Target user
Backend and platform engineers
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior Kafka engineer designing a new topic, producing a design to review before it is created.

I will provide:
- What the topic carries: event/message type, average and peak rate, message size, and expected growth
- Ordering requirements: whether strict ordering is needed globally, per key (e.g. per user/order), or not at all
- Consumer model: number of consumer groups, desired parallelism, and per-consumer processing throughput
- Durability needs: tolerable data loss, and whether this is an event log, a changelog/state store, or a transient queue
- Retention needs: how long data must be kept, and whether only the latest value per key matters

Your job:

1. **Choose a partition count** — derive it from required consumer parallelism and per-partition throughput, leaving room for growth, while warning that more partitions cost controller load, file handles, and rebalance time and that partition count is hard to reduce later.
2. **Design the key** — recommend a partition key that preserves the required ordering (per-key ordering implies same key to same partition) and check it for skew (hot keys overloading one partition), suggesting mitigations if skew is likely.
3. **Set replication and durability** — recommend replication factor and min.insync.replicas together with producer acks so the topic survives the agreed number of broker failures without acknowledged-write loss.
4. **Choose retention vs. compaction** — decide between time/size retention (event log) and log compaction (latest-value-per-key changelog), or a combination, based on the data's role.
5. **Set the supporting config** — recommend segment sizing, cleanup policy, and any tiered-storage option, and note naming/convention concerns.

Output: (a) partition count with rationale, (b) keying and skew analysis, (c) replication/ISR/acks durability set, (d) retention vs. compaction decision, (e) supporting topic config.

Advisory only; validate partition count and keying against a representative load test, since partition count is costly to change after launch.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Kafka prompts & error guides

Browse every Kafka prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.