Producer Basics (Python)

acks, batching, compression, idempotence — the four knobs that matter.

0/3 done

Four knobs

Anatomy of a producer

A Kafka producer batches records per partition, optionally compresses, and sends asynchronously. The four configuration knobs you must understand:

  • acks — durability contract (see L1).
  • linger.ms + batch.size — throughput vs latency.
  • compression.typesnappy, lz4, zstd, gzip.
  • enable.idempotence=true — guarantees no per-partition duplicates on retry.

Send 10k orders with confluent-kafka-python

Author a tiny producer that pushes JSON order.placed records keyed by order_id. It must be configured for durability (acks=all + idempotence) and emit a small delivery-report callback so you can detect failures.

Reading in progress · 0 of 3 activities done