batching (messages को group करना) और compression (data को compress करना) उच्च Kafka throughput के लिए प्रमुख techniques हैं — per-message overhead और network/storage costs को कम करना। इन्हें समझना Kafka की उच्च performance प्राप्त करने में मदद करता है।
Batching — messages को group करना
BATCHING → the producer groups multiple messages into a single BATCH before sending:
→ fewer, larger requests instead of many tiny ones → much higher THROUGHPUT (less
per-request overhead, fewer network round-trips)
→ controlled by: batch.size (batch size limit) + linger.ms (wait time to accumulate a batch)
→ trade-off: slightly higher LATENCY (waiting to batch) for much higher throughput
→ batching is essential for high-throughput producing
