Skip to content

Commit 3f0e574

Browse files
authored
Update kafka properties template; disable group rebalance delay (#2471)
1 parent 872c1d3 commit 3f0e574

File tree

18 files changed

+828
-396
lines changed

18 files changed

+828
-396
lines changed

servers/0.11.0.0/resources/kafka.properties

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
# The ASF licenses this file to You under the Apache License, Version 2.0
55
# (the "License"); you may not use this file except in compliance with
66
# the License. You may obtain a copy of the License at
7-
#
7+
#
88
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
9+
#
1010
# Unless required by applicable law or agreed to in writing, software
1111
# distributed under the License is distributed on an "AS IS" BASIS,
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
1516
# see kafka.server.KafkaConfig for additional details and defaults
1617

1718
############################# Server Basics #############################
@@ -21,6 +22,12 @@ broker.id={broker_id}
2122

2223
############################# Socket Server Settings #############################
2324

25+
# The address the socket server listens on. It will get the value returned from
26+
# java.net.InetAddress.getCanonicalHostName() if not configured.
27+
# FORMAT:
28+
# listeners = listener_name://host_name:port
29+
# EXAMPLE:
30+
# listeners = PLAINTEXT://your.host.name:9092
2431
listeners={transport}://{host}:{port}
2532
security.inter.broker.protocol={transport}
2633

@@ -38,22 +45,18 @@ allow.everyone.if.no.acl.found=true
3845
# The port the socket server listens on
3946
#port=9092
4047

41-
# Hostname the broker will bind to. If not set, the server will bind to all interfaces
42-
#host.name=localhost
43-
44-
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
45-
# value for "host.name" if configured. Otherwise, it will use the value returned from
46-
# java.net.InetAddress.getCanonicalHostName().
47-
#advertised.host.name=<hostname routable by clients>
48+
# Hostname and port the broker will advertise to producers and consumers. If not set,
49+
# it uses the value for "listeners" if configured. Otherwise, it will use the value
50+
# returned from java.net.InetAddress.getCanonicalHostName().
51+
#advertised.listeners=PLAINTEXT://your.host.name:9092
4852

49-
# The port to publish to ZooKeeper for clients to use. If this is not set,
50-
# it will publish the same port that the broker binds to.
51-
#advertised.port=<port accessible by clients>
53+
# Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
54+
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
5255

53-
# The number of threads handling network requests
56+
# The number of threads that the server uses for receiving requests from the network and sending responses to the network
5457
num.network.threads=3
55-
56-
# The number of threads doing disk I/O
58+
59+
# The number of threads that the server uses for processing requests, which may include disk I/O
5760
num.io.threads=8
5861

5962
# The send buffer (SO_SNDBUF) used by the socket server
@@ -68,7 +71,7 @@ socket.request.max.bytes=104857600
6871

6972
############################# Log Basics #############################
7073

71-
# A comma seperated list of directories under which to store log files
74+
# A comma separated list of directories under which to store log files
7275
log.dirs={tmp_dir}/data
7376

7477
# The default number of log partitions per topic. More partitions allow greater
@@ -81,14 +84,25 @@ default.replication.factor={replicas}
8184
replica.lag.time.max.ms=1000
8285
replica.socket.timeout.ms=1000
8386

87+
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
88+
# This value is recommended to be increased for installations with data dirs located in RAID array.
89+
num.recovery.threads.per.data.dir=1
90+
91+
############################# Internal Topic Settings #############################
92+
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
93+
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.
94+
offsets.topic.replication.factor=1
95+
transaction.state.log.replication.factor=1
96+
transaction.state.log.min.isr=1
97+
8498
############################# Log Flush Policy #############################
8599

86100
# Messages are immediately written to the filesystem but by default we only fsync() to sync
87-
# the OS cache lazily. The following configurations control the flush of data to disk.
101+
# the OS cache lazily. The following configurations control the flush of data to disk.
88102
# There are a few important trade-offs here:
89103
# 1. Durability: Unflushed data may be lost if you are not using replication.
90104
# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
91-
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks.
105+
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.
92106
# The settings below allow one to configure the flush policy to flush data after a period of time or
93107
# every N messages (or both). This can be done globally and overridden on a per-topic basis.
94108

@@ -105,17 +119,17 @@ replica.socket.timeout.ms=1000
105119
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
106120
# from the end of the log.
107121

108-
# The minimum age of a log file to be eligible for deletion
122+
# The minimum age of a log file to be eligible for deletion due to age
109123
log.retention.hours=168
110124

111-
# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
112-
# segments don't drop below log.retention.bytes.
125+
# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
126+
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
113127
#log.retention.bytes=1073741824
114128

115129
# The maximum size of a log segment file. When this size is reached a new log segment will be created.
116130
log.segment.bytes=1073741824
117131

118-
# The interval at which log segments are checked to see if they can be deleted according
132+
# The interval at which log segments are checked to see if they can be deleted according
119133
# to the retention policies
120134
log.retention.check.interval.ms=300000
121135

@@ -145,3 +159,13 @@ zookeeper.connect={zk_host}:{zk_port}/{zk_chroot}
145159
zookeeper.connection.timeout.ms=30000
146160
# We want to expire kafka broker sessions quickly when brokers die b/c we restart them quickly
147161
zookeeper.session.timeout.ms=500
162+
163+
164+
############################# Group Coordinator Settings #############################
165+
166+
# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
167+
# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.
168+
# The default value for this is 3 seconds.
169+
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
170+
# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.
171+
group.initial.rebalance.delay.ms=0

servers/0.11.0.1/resources/kafka.properties

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
# The ASF licenses this file to You under the Apache License, Version 2.0
55
# (the "License"); you may not use this file except in compliance with
66
# the License. You may obtain a copy of the License at
7-
#
7+
#
88
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
9+
#
1010
# Unless required by applicable law or agreed to in writing, software
1111
# distributed under the License is distributed on an "AS IS" BASIS,
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
1516
# see kafka.server.KafkaConfig for additional details and defaults
1617

1718
############################# Server Basics #############################
@@ -21,6 +22,12 @@ broker.id={broker_id}
2122

2223
############################# Socket Server Settings #############################
2324

25+
# The address the socket server listens on. It will get the value returned from
26+
# java.net.InetAddress.getCanonicalHostName() if not configured.
27+
# FORMAT:
28+
# listeners = listener_name://host_name:port
29+
# EXAMPLE:
30+
# listeners = PLAINTEXT://your.host.name:9092
2431
listeners={transport}://{host}:{port}
2532
security.inter.broker.protocol={transport}
2633

@@ -38,22 +45,18 @@ allow.everyone.if.no.acl.found=true
3845
# The port the socket server listens on
3946
#port=9092
4047

41-
# Hostname the broker will bind to. If not set, the server will bind to all interfaces
42-
#host.name=localhost
43-
44-
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
45-
# value for "host.name" if configured. Otherwise, it will use the value returned from
46-
# java.net.InetAddress.getCanonicalHostName().
47-
#advertised.host.name=<hostname routable by clients>
48+
# Hostname and port the broker will advertise to producers and consumers. If not set,
49+
# it uses the value for "listeners" if configured. Otherwise, it will use the value
50+
# returned from java.net.InetAddress.getCanonicalHostName().
51+
#advertised.listeners=PLAINTEXT://your.host.name:9092
4852

49-
# The port to publish to ZooKeeper for clients to use. If this is not set,
50-
# it will publish the same port that the broker binds to.
51-
#advertised.port=<port accessible by clients>
53+
# Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
54+
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
5255

53-
# The number of threads handling network requests
56+
# The number of threads that the server uses for receiving requests from the network and sending responses to the network
5457
num.network.threads=3
55-
56-
# The number of threads doing disk I/O
58+
59+
# The number of threads that the server uses for processing requests, which may include disk I/O
5760
num.io.threads=8
5861

5962
# The send buffer (SO_SNDBUF) used by the socket server
@@ -68,7 +71,7 @@ socket.request.max.bytes=104857600
6871

6972
############################# Log Basics #############################
7073

71-
# A comma seperated list of directories under which to store log files
74+
# A comma separated list of directories under which to store log files
7275
log.dirs={tmp_dir}/data
7376

7477
# The default number of log partitions per topic. More partitions allow greater
@@ -81,14 +84,25 @@ default.replication.factor={replicas}
8184
replica.lag.time.max.ms=1000
8285
replica.socket.timeout.ms=1000
8386

87+
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
88+
# This value is recommended to be increased for installations with data dirs located in RAID array.
89+
num.recovery.threads.per.data.dir=1
90+
91+
############################# Internal Topic Settings #############################
92+
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
93+
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.
94+
offsets.topic.replication.factor=1
95+
transaction.state.log.replication.factor=1
96+
transaction.state.log.min.isr=1
97+
8498
############################# Log Flush Policy #############################
8599

86100
# Messages are immediately written to the filesystem but by default we only fsync() to sync
87-
# the OS cache lazily. The following configurations control the flush of data to disk.
101+
# the OS cache lazily. The following configurations control the flush of data to disk.
88102
# There are a few important trade-offs here:
89103
# 1. Durability: Unflushed data may be lost if you are not using replication.
90104
# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
91-
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks.
105+
# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.
92106
# The settings below allow one to configure the flush policy to flush data after a period of time or
93107
# every N messages (or both). This can be done globally and overridden on a per-topic basis.
94108

@@ -105,17 +119,17 @@ replica.socket.timeout.ms=1000
105119
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
106120
# from the end of the log.
107121

108-
# The minimum age of a log file to be eligible for deletion
122+
# The minimum age of a log file to be eligible for deletion due to age
109123
log.retention.hours=168
110124

111-
# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
112-
# segments don't drop below log.retention.bytes.
125+
# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
126+
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
113127
#log.retention.bytes=1073741824
114128

115129
# The maximum size of a log segment file. When this size is reached a new log segment will be created.
116130
log.segment.bytes=1073741824
117131

118-
# The interval at which log segments are checked to see if they can be deleted according
132+
# The interval at which log segments are checked to see if they can be deleted according
119133
# to the retention policies
120134
log.retention.check.interval.ms=300000
121135

@@ -145,3 +159,13 @@ zookeeper.connect={zk_host}:{zk_port}/{zk_chroot}
145159
zookeeper.connection.timeout.ms=30000
146160
# We want to expire kafka broker sessions quickly when brokers die b/c we restart them quickly
147161
zookeeper.session.timeout.ms=500
162+
163+
164+
############################# Group Coordinator Settings #############################
165+
166+
# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
167+
# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.
168+
# The default value for this is 3 seconds.
169+
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
170+
# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.
171+
group.initial.rebalance.delay.ms=0

0 commit comments

Comments
 (0)