Batching (ਸੁਨੇਹਿਆਂ ਨੂੰ ਗਰੁੱਪ ਕਰਨਾ) ਅਤੇ compression (ਡਾਟਾ ਨੂੰ ਸੰਕੁਚਿਤ ਕਰਨਾ) ਉੱਚ Kafka throughput ਲਈ ਮੁੱਖ ਤਕਨੀਕਾਂ ਹਨ — ਪ੍ਰਤੀ-ਸੁਨੇਹੇ ਦੇ overhead ਅਤੇ network/storage ਲਾਗਤਾਂ ਨੂੰ ਘਟਾਉਂਦੇ ਹਨ। ਇਨ੍ਹਾਂ ਨੂੰ ਸਮਝਣਾ Kafka ਦੀ ਉੱਚ ਪ੍ਰਦਰਸ਼ਨ ਪ੍ਰਾਪਤ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ।
Batching — ਸੁਨੇਹਿਆਂ ਨੂੰ ਗਰੁੱਪ ਕਰੋ
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
