At Superstream, we like squeezing every drop of efficiency from data infrastructure. Recently, we tackled an already “optimized” Kafka deployment—and managed to shrink its network footprint by an additional 50%.
Even better? In some cases, we hit 97% reduction when no compression was previously active.
Here’s how we did it—and why the standard approach to Kafka compression leaves so much on the table.
Most teams use Kafka compression by applying a single compression setting (like lz4
or snappy
) across all clients. It’s quick. It works. But it leaves a huge optimization gap.
We realized that every application and workload type interacts differently with compression algorithms.
Some patterns benefit from Zstd’s higher ratio, others from Snappy’s speed.
The problem? No one has the time—or capability—to micro-optimize compression settings per workload.
We flipped the problem around.
Instead of asking developers to tweak every producer, we:
Let's zoom in for a second on batch.size
and linger.ms
producer settings. By increasing batch.size
, we allow the producer to group more records into a single batch before sending it to the broker.
This not only amortizes compression overhead across more data, leading to significantly better compression ratios, but also reduces the number of requests per second, easing the load on brokers.
You might using a serverless version, but that is still something the vendor counts and charge you for, either directly or indirectly. Paired with a higher linger.ms
—which introduces a small delay to allow more records to accumulate before sending—the producer can form larger, more efficient batches, especially under moderate traffic.
While this introduces a slight increase in latency (usually in the range of a few milliseconds), the payoff in network efficiency, CPU usage, and overall throughput is more than worth it for most workloads.
In our benchmarks, these settings were foundational to achieving the 50%+ footprint reduction.
After deploying our optimization across diverse workloads, the numbers speak for themselves:
And this all happens transparently—no refactoring, no downtime.
This isn't just about Kafka. It's a shift in how we think about compression and network optimization.
We believe this pattern—observability-driven, auto-tuned optimization at the infrastructure layer—is the future of high-performance data systems.