0Pricing
Apache Kafka & Stream Processing Fundamentals · Ders

Toplu İşleme, Sıkıştırma ve Linger Ayarı

Üretici toplu işlemesinin, linger.ms'nin ve sıkıştırmanın gecikmeyi aktarım hızıyla nasıl dengelediğini, ağ ve disk kullanımını nasıl azalttığını öğrenin.

Toplu İşleme, Sıkıştırma ve Linger Ayarı, CoddyKit'te ücretsiz bir Apache Kafka & Stream Processing Fundamentals dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Apache Kafka & Stream Processing Fundamentals öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Apache Kafka & Stream Processing Fundamentals kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

The Throughput Lever

Sending one record per network call is slow. Kafka producers batch records per partition before sending, amortizing overhead and dramatically raising throughput.

batch.size

batch.size sets the maximum size (in bytes) of a single batch per partition.

  • Larger batches = better throughput, more memory.
  • A batch is sent when it fills or when linger expires.
// 64 KB batches
props.put(ProducerConfig.BATCH_SIZE_CONFIG, 65536);

linger.ms

linger.ms tells the producer to wait a short time for more records before sending, even if the batch isn't full.

  • 0 (default) = send as soon as possible, lowest latency.
  • A few ms = bigger batches, higher throughput.
props.put(ProducerConfig.LINGER_MS_CONFIG, 10);

How They Interact

Think of it as fill or wait:

  • The batch ships when it reaches batch.size.
  • Or when linger.ms elapses, whichever comes first.

Raising both increases batch sizes at the cost of latency.

Compression Basics

compression.type compresses each batch before it goes over the wire and to disk.

Bigger batches compress better, so compression pairs naturally with linger tuning.

props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4");

Choosing a Codec

Common codecs and their trade-offs:

  • lz4 — fast, good ratio, popular default.
  • snappy — very fast, lower ratio.
  • zstd — best ratio, slightly more CPU.
  • gzip — high ratio, higher CPU.

End-to-End Compression

Kafka stores batches compressed and serves them compressed; consumers decompress.

This means compression saves network, disk, and replication bandwidth — not just the producer link.

buffer.memory

buffer.memory caps total memory for unsent records.

If batches accumulate faster than they ship, the producer blocks (up to max.block.ms) — a sign brokers can't keep up or batching is too aggressive.

props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 33554432);

A High-Throughput Profile

A typical throughput-oriented configuration:

props.put(ProducerConfig.BATCH_SIZE_CONFIG, 131072);
props.put(ProducerConfig.LINGER_MS_CONFIG, 20);
props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "zstd");
props.put(ProducerConfig.ACKS_CONFIG, "all");

Latency vs. Throughput

There is no free lunch:

  • Lower linger.ms and smaller batches = lower latency.
  • Higher values + compression = higher throughput, more latency.

Tune to your SLA, then measure.

Measuring the Effect

Watch producer JMX metrics to confirm tuning works:

  • batch-size-avg — are batches actually larger?
  • compression-rate-avg — how well does data compress?
  • record-queue-time-avg — added latency from linger.

Quick Check

Test your understanding of batching and linger.

Recap

You learned producer batching and compression tuning.

  • batch.size + linger.ms control batch size and the latency trade-off.
  • Compression (lz4/zstd) saves network, disk, and replication bandwidth.
  • buffer.memory bounds in-flight data.
  • Verify with batch-size-avg and compression-rate-avg metrics.

Sıkça Sorulan Sorular

“Toplu İşleme, Sıkıştırma ve Linger Ayarı” dersi ücretsiz mi?

Evet — “Toplu İşleme, Sıkıştırma ve Linger Ayarı” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Apache Kafka & Stream Processing Fundamentals kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Apache Kafka & Stream Processing Fundamentals kursu toplamda 4 dersten oluşur.

“Toplu İşleme, Sıkıştırma ve Linger Ayarı” dersinde ne öğreneceğim?

Üretici toplu işlemesinin, linger.ms'nin ve sıkıştırmanın gecikmeyi aktarım hızıyla nasıl dengelediğini, ağ ve disk kullanımını nasıl azalttığını öğrenin. Apache Kafka & Stream Processing Fundamentals ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Apache Kafka & Stream Processing Fundamentals öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Apache Kafka & Stream Processing Fundamentals, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Toplu İşleme, Sıkıştırma ve Linger Ayarı” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Apache Kafka & Stream Processing Fundamentals dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Apache Kafka & Stream Processing Fundamentals dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Üretici ve Tüketici Performansı
  2. Aracı Yapılandırması ve Ayarlama
  3. Disk G/Ç ve Ağ En İyileştirmesi
  4. Toplu İşleme, Sıkıştırma ve Linger Ayarı
← Apache Kafka & Stream Processing Fundamentals Sayfasına Dön