Batching (ομαδοποίηση μηνυμάτων) και compression (συμπίεση δεδομένων) είναι βασικές τεχνικές για υψηλή throughput στο Kafka — μειώνουν το κόστος ανά μήνυμα και τα έξοδα δικτύου/αποθήκευσης. Η κατανόησή τους βοηθά στην επίτευξη της υψηλής απόδοσης του 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
