Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

Kafka Consumer Configuration

This guide provides a comprehensive reference for Kafka consumer configuration properties, organized by functional area with production recommendations.


CategoryPurpose
ConnectionBroker connectivity and identification
Session ManagementConsumer group coordination and heartbeats
FetchMessage retrieval behavior
OffsetOffset management and commit behavior
DeserializationMessage decoding
SecurityAuthentication and encryption

PropertyDescriptionExample
bootstrap.serversInitial broker addresseskafka-1:9092,kafka-2:9092
key.deserializerKey deserializer classStringDeserializer
value.deserializerValue deserializer classStringDeserializer
PropertyDefaultDescription
group.id-Consumer group identifier. Required for group consumption.
client.id-Logical identifier for monitoring and logging.
group.instance.id-Static membership identifier (Kafka 2.3+). Reduces rebalances on restarts within session timeout.
client.rack-Rack identifier for follower fetching (requires broker replica.selector.class).
# Basic connection configuration
bootstrap.servers=kafka-1:9092,kafka-2:9092,kafka-3:9092
group.id=order-processors
client.id=order-consumer-1
# Static membership for stable deployments
group.instance.id=order-consumer-pod-1

Session management controls consumer liveness detection and rebalance behavior.

PropertyDefaultDescription
session.timeout.ms45000Time before consumer considered dead
heartbeat.interval.ms3000Frequency of heartbeat to coordinator
max.poll.interval.ms300000Maximum time between poll() calls
Relationship between heartbeat interval, session timeout, and max poll intervalRelationship between heartbeat interval, session timeout, and max poll intervalheartbeat.interval.ms3s (default)session.timeout.ms45s (default)max.poll.interval.ms300s (default)Heartbeat frequencyto coordinatorTime before consumerconsidered deadMax time betweenpoll() calls1/3 of
# Standard configuration
session.timeout.ms=45000
heartbeat.interval.ms=3000
# Relationship requirements:
# heartbeat.interval.ms < session.timeout.ms / 3
# This allows 3 missed heartbeats before timeout
Scenariosession.timeout.msheartbeat.interval.msmax.poll.interval.ms
Low latency10000300030000
Standard4500015000300000
Slow processing6000015000600000
Batch processing120000300001800000

Example starting points; tune based on processing time and SLA.

Processing Time Considerations

If message processing takes longer than max.poll.interval.ms, the consumer is removed from the group. Either increase this timeout or process messages asynchronously.


Fetch configuration controls how the consumer retrieves messages from brokers.

PropertyDefaultDescription
fetch.min.bytes1Minimum data per fetch response
fetch.max.bytes52428800Maximum data per fetch response
max.partition.fetch.bytes1048576Maximum data per partition per fetch
fetch.max.wait.ms500Maximum wait for fetch.min.bytes
PropertyDefaultDescription
max.poll.records500Maximum records per poll() call
# High throughput configuration
fetch.min.bytes=65536
fetch.max.wait.ms=1000
max.poll.records=1000
max.partition.fetch.bytes=4194304
# Low latency configuration
fetch.min.bytes=1
fetch.max.wait.ms=100
max.poll.records=100
max.partition.fetch.bytes=1048576
Tuning Goalfetch.min.bytesfetch.max.wait.msmax.poll.records
Low latency1100100
Balanced1024500500
High throughput6553610001000

Example starting points; tune based on payload size and latency targets.


Offset configuration controls how the consumer tracks and commits progress.

PropertyDefaultDescription
enable.auto.committrueAutomatically commit offsets
auto.commit.interval.ms5000Frequency of auto-commits
auto.offset.resetlatestBehavior when no committed offset exists
# Auto-commit enabled (at-least-once by default)
enable.auto.commit=true
auto.commit.interval.ms=5000
# Manual commit for precise control
enable.auto.commit=false
ValueBehaviorUse Case
earliestStart from oldest messageReprocessing, new consumer groups
latestStart from newest messageReal-time processing, skip history
noneThrow exceptionStrict offset requirement
# New consumer groups start from beginning
auto.offset.reset=earliest
# New consumer groups skip existing messages
auto.offset.reset=latest
# Fail if no offset exists
auto.offset.reset=none

PropertyDefaultDescription
partition.assignment.strategyRangeAssignorPartition assignment algorithm
StrategyClassDescription
RangeRangeAssignorConsecutive partitions per topic
RoundRobinRoundRobinAssignorEven distribution across consumers
StickyStickyAssignorMinimizes partition movement
CooperativeStickyCooperativeStickyAssignorIncremental rebalancing (recommended)
# Production recommendation: Cooperative sticky assignment
partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor
# Multiple strategies (fallback)
partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor,org.apache.kafka.clients.consumer.RangeAssignor

For transactional producers, consumers must choose their isolation level.

PropertyDefaultDescription
isolation.levelread_uncommittedTransaction visibility
ValueBehavior
read_uncommittedRead all messages including uncommitted transactions
read_committedOnly read committed transaction messages
# For exactly-once consumers
isolation.level=read_committed

PropertyDefaultDescription
connections.max.idle.ms540000Close idle connections after this time
reconnect.backoff.ms50Initial backoff for reconnection
reconnect.backoff.max.ms1000Maximum reconnection backoff
request.timeout.ms30000Timeout for network requests
default.api.timeout.ms60000Timeout for consumer API calls
socket.receive.buffer.bytes65536Socket receive buffer
# Network tuning for high-latency environments
request.timeout.ms=60000
default.api.timeout.ms=120000
connections.max.idle.ms=300000

PropertyDefaultDescription
exclude.internal.topicstrueExclude internal topics from subscription patterns
allow.auto.create.topicstrueAllow automatic topic creation

PropertyDefaultDescription
interceptor.classes-Consumer interceptor classes
// Custom interceptor for monitoring
public class MetricsInterceptor implements ConsumerInterceptor<String, String> {
@Override
public ConsumerRecords<String, String> onConsume(ConsumerRecords<String, String> records) {
metrics.recordConsumed(records.count());
return records;
}
@Override
public void onCommit(Map<TopicPartition, OffsetAndMetadata> offsets) {
metrics.recordCommit(offsets);
}
}
interceptor.classes=com.example.MetricsInterceptor

# SASL/PLAIN
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="consumer" \
password="secret";
# SASL/SCRAM
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
username="consumer" \
password="secret";
security.protocol=SSL
ssl.truststore.location=/path/to/truststore.jks
ssl.truststore.password=truststore-password
ssl.keystore.location=/path/to/keystore.jks
ssl.keystore.password=keystore-password
ssl.key.password=key-password

Example profile; adjust to your workload.

# Connection
bootstrap.servers=kafka-1:9092,kafka-2:9092,kafka-3:9092
group.id=order-processors
client.id=order-consumer-1
# Session management
session.timeout.ms=45000
heartbeat.interval.ms=15000
max.poll.interval.ms=300000
# Fetch
fetch.min.bytes=1
fetch.max.wait.ms=500
max.poll.records=500
# Offset
enable.auto.commit=false
auto.offset.reset=earliest
# Assignment
partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor
# Deserialization
key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
value.deserializer=org.apache.kafka.common.serialization.StringDeserializer

Example profile; adjust to your workload.

# Connection
bootstrap.servers=kafka-1:9092,kafka-2:9092,kafka-3:9092
group.id=high-throughput-processors
# Session - allow longer processing
session.timeout.ms=60000
heartbeat.interval.ms=15000
max.poll.interval.ms=600000
# Fetch - larger batches
fetch.min.bytes=65536
fetch.max.wait.ms=1000
fetch.max.bytes=104857600
max.partition.fetch.bytes=10485760
max.poll.records=2000
# Offset
enable.auto.commit=false
auto.offset.reset=earliest
# Assignment
partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor

Example profile; adjust to your workload.

# Connection
bootstrap.servers=kafka-1:9092,kafka-2:9092,kafka-3:9092
group.id=low-latency-processors
# Session - faster detection
session.timeout.ms=10000
heartbeat.interval.ms=3000
max.poll.interval.ms=30000
# Fetch - immediate delivery
fetch.min.bytes=1
fetch.max.wait.ms=100
max.poll.records=100
# Offset
enable.auto.commit=false
# Assignment
partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor