Kafka producers
A producer is the client that writes messages to Kafka. You pick a topic, optionally a key (determines partition via hash — same key, same partition, preserved order), and the payload. The knobs worth knowing: acks — durability level (see replication); batching (linger.ms, batch.size) — producers collect messages for a few ms before sending, which trades latency for massive throughput gains; compression (snappy, lz4, zstd) — compressing batches shrinks network and disk usage significantly; enable.idempotence=true — producer attaches sequence numbers so retries don't create duplicates (critical, enable it always in modern Kafka). For strong ordering with retries, also set max.in.flight.requests.per.connection=5 (any higher risks reordering on retry). The common mistake is tuning for latency on a throughput workload or vice versa — decide which matters and set the batch/linger knobs accordingly.