Improve Network Efficiency
Apache Kafka is a high-throughput distributed messaging system that powers many real-time applications. However, Kafka's performance can often be constrained by inefficient network usage—especially in high-throughput or multi-region deployments. Improving Kafka’s network efficiency means optimizing how data flows between clients and brokers, reducing bandwidth usage, minimizing latency, and ultimately ensuring cost-effective and reliable data pipelines.
At Superstream, we can make it easier to manage and optimize Kafka networking, particularly through our open-source superstream-clients-java
library. This guide walks through how to use the library to boost network efficiency when interacting with Kafka.
Superstream Client For Java
A Java library for automatically optimizing Kafka producer configurations based on topic-specific recommendations.
Overview
Superstream Clients works as a Java agent that intercepts Kafka producer creation and applies optimized configurations without requiring any code changes in your application. It dynamically retrieves optimization recommendations from Superstream and applies them based on impact analysis.
Supported Libraries
Works with any Java library that depends on kafka-clients
, including:
Apache Kafka Clients
Spring Kafka
Alpakka Kafka (Akka Kafka)
Kafka Streams
Kafka Connect
Any custom wrapper around the Kafka Java client
Features
Zero-code integration: No code changes required in your application
Dynamic configuration: Applies optimized settings based on topic-specific recommendations
Intelligent optimization: Identifies the most impactful topics to optimize
Graceful fallback: Falls back to default settings if optimization fails
Installation
Step 1: Add Superstream package
Maven
Gradle
Step 2: Add Environment Variables
Required Environment Variables
SUPERSTREAM_TOPICS_LIST
: Comma-separated list of topics your application produces to
Optional Environment Variables
SUPERSTREAM_LATENCY_SENSITIVE
: Set to "true" to prevent any modification to linger.ms valuesSUPERSTREAM_DISABLED
: Set to "true" to disable optimization
Example:
Step 3: Run
Add the Java agent to your application's startup command:
Common example:
Docker Integration
When using Superstream Clients with containerized applications, include the agent in your Dockerfile:
Alternatively, you can use a multi-stage build to download the agent from Maven Central:
SUPERSTREAM_LATENCY_SENSITIVE Explained
The linger.ms parameter follows these rules:
If SUPERSTREAM_LATENCY_SENSITIVE is set to true:
Linger value will never be modified, regardless of other settings
If SUPERSTREAM_LATENCY_SENSITIVE is set to false or not set:
If no explicit linger exists in original configuration: Use Superstream's optimized value
If explicit linger exists: Use the maximum of original value and Superstream's optimized value
Prerequisites
Java 11 or higher
Kafka cluster that is connected to the Superstream's console
Read and write permissions to the
superstream.*
topics
License
This project is licensed under the Apache License 2.0.
Last updated
Was this helpful?