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

Kafka Producer Throughput & Latency Tuning Prompt

Tune Kafka producer batching, compression, acks, linger, and idempotence to hit a throughput or latency target while keeping the durability guarantees you actually need.

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

The prompt

You are a senior Kafka engineer tuning a producer, producing a configuration recommendation to review before deployment.

I will provide:
- The objective: maximize throughput, minimize tail latency, or hit a specific p99 publish latency at a given rate
- Workload shape: average message size, peak and average produce rate, key distribution, and whether ordering per key matters
- Current producer config: acks, batch.size, linger.ms, compression.type, buffer.memory, max.in.flight.requests.per.connection, enable.idempotence, retries
- Durability requirements: how much data loss (if any) is tolerable on broker failure
- Observed symptoms: timeouts, buffer-full errors, high latency, or low throughput

Your job:

1. **Pin down the trade-off** — restate the throughput-vs-latency goal and the required durability, since they constrain acks and batching choices in opposite directions.
2. **Tune batching** — recommend batch.size and linger.ms together, explaining that larger batches and small linger raise throughput but add latency, and size buffer.memory to absorb bursts.
3. **Choose compression** — compare compression codecs for CPU vs. ratio against the message profile, and note that compression amplifies the benefit of batching.
4. **Set durability and ordering** — recommend acks and min.insync.replicas to match the loss tolerance, and explain how enable.idempotence plus max.in.flight settings preserve ordering without sacrificing throughput.
5. **Handle backpressure and retries** — advise on retries, delivery.timeout.ms, and what buffer-full errors signal, so transient broker slowness does not drop data.
6. **Verify** — describe the before/after metrics (record send rate, request latency, batch size avg) that confirm the tuning worked.

Output: (a) trade-off statement, (b) recommended config with per-knob rationale, (c) durability/ordering settings, (d) backpressure handling, (e) verification metrics.

Advisory only; benchmark the new config against representative traffic before rolling it out fleet-wide.

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.