Broker Configuration Parameter Description
The following are the configurations of a CKafka Broker for your reference:
message.max.bytes=1000012
auto.create.topics.enable=false
delete.topic.enable=true
socket.request.max.bytes=16777216
max.connections.per.ip=5000
offsets.retention.minutes=10080
allow.everyone.if.no.acl.found=true
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
Topic Configuration Parameter Description
1. Number of partitions
From the producer's point of view, writes to different partitions are completely in parallel; from the consumer's point of view, the number of concurrencies depends entirely on the number of partitions (if there are more consumers than partitions, there will definitely be idle consumers). It is important to select an appropriate number of partitions to fully play the performance of the CKafka instance.
The number of partitions should be determined based on the throughput of production and consumption, ideally through the following formula:
Note:
Num = max(T/PT, T/CT) = T/min(PT, CT)
Num represents the number of partitions, T the target throughput, PT the maximum production throughput by the producer to a single partition, and CT the maximum consumption throughput by the consumer from a single partition. The number of partitions is equal to T/PT or T/CT, whichever is larger.
In practice, the actual PT is determined by batch size, compression algorithm, acknowledgement mechanism, number of replicas, and so on, while the actual CT is subject to business logic, which varies according to the actual conditions.
We recommend that the number of partitions be greater than or equal to that of consumers to achieve maximum concurrency. For example, if there are 5 consumers, there should be 5 or more partitions. However, having too many partitions will lower production throughput and increase time consumed by elections and thus need to be avoided. See the following for reference:
A single partition can implement sequential writes of messages.
A single partition can only be consumed by a single consumer process in the same consumer group.
A single consumer process can consume multiple partitions simultaneously, so partition limits the concurrency of consumers.
The more partitions there are, the longer it takes to elect a leader upon failure.
Offset can be down to the partition level. The more partitions there are, the more time the offset query consumes.
The number of partitions can be dynamically increased but not reduced. However, an increase will result in message rebalance.
2. Number of replicas
At present, the number of replicas must be at least 2 to ensure availability. To ensure high reliability, we recommend maintaining at least 3 replicas.
Note:
The number of replicas will affect the production/consumption traffic; for example, if there are 3 replicas, the actual traffic will be 3 times the production traffic.
3. Log retention period
The log.retention.ms
configuration of a topic is set through the retention period of the instance in the console.
4. Other topic-level configurations
max.message.bytes=1000012
message.format.version=0.10.2-IV0
unclean.leader.election.enable=true
min.insync.replicas=1
Producer Configuration Guide
The following describes common parameter settings for the Producer client. We recommend adjusting them based on your actual business scenarios:
batch.size=16384
acks=1
timeout.ms=30000
buffer.memory=33554432
max.block.ms=60000
linger.ms=0
max.request.size=1048576
compression.type=[none, snappy, lz4]
request.timeout.ms=30000
max.in.flight.requests.per.connection=5
retries=0
retry.backoff.ms=100
Consumer Configuration Guide
The following describes common parameter settings for the Consumer client. We recommend adjusting them based on your actual business scenarios:
auto.commit.enable=true
auto.commit.interval.ms=5000
auto.offset.reset=latest
group.id=""
session.timeout.ms=10000
heartbeat.interval.ms=3000
max.poll.interval.ms=300000
fetch.min.bytes=1
fetch.max.bytes=52428800
fetch.max.wait.ms=500
max.partition.fetch.bytes=1048576
max.poll.records=500
request.timeout.ms=305000
Was this page helpful?