Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Split the quota property into two values, one for the leader and one for the follower. This adds consistency with the replicas property changed previously.

...

  • 10th Aug 2016: Switched from a delay-based approach, which uses dedicated throttled fetcher threads, to an inclusion-based approach, which puts throttled and unthrottled replicas in the same request/response
  • 25th Sept 2016: Split throttled replica list into two properties. One for leader side. One for follower side.
  • 30th Sept 2016: Split the quota property into two values, one for the leader and one for the follower. This adds consistency with the replicas property changed previously. 

Motivation

Currently data intensive admin operations like rebalancing partitions, adding a broker, removing a broker or bootstrapping a new machine create an unbounded load on inter-cluster traffic. This affects clients interacting with the cluster when a data movement occurs.

...

The tool, kafka-reassign-partitions.sh, calculates a mapping of topic -> partition-replica for each replica that is either (a) a move origin or (b) a move destination. A leader throttle is applied to all existing replicas that are moving. A follower throttle is applied to replica replicas that are being created as part of the reassignment process (i.e. move destinations). There are independent configs for the leader and follower, but this is wrapped in kafka-reassign-partitions.sh so the admin only need be aware of these if they alter them directly via kafka-configs.sh. 

leader.replication.throttled.replicas = [partIdquota.leader.replication.throttled.replicas = [partId]:[replica], [partId]:[replica]...quota.

follower.replication.throttled.replicas = [partId]:[replica], [partId]:[replica]...

When the tool completes all configs are removed from Zookeeper.  

leader.replication.throttled.rate = 1000000

follower.replication.throttled.rate = 1000000

The admin removes the the throttle from Zookeeper by running the --verify command after completion of the rebalance.  

Alternatively each property can be set independently using kafka-configs.sh (see below)

Public Interfaces

FetchRequest

...

  • LeaderReplicationThrottledRate: The rate of throttled replication for transmitted bytes from a broker. 
  • FollowerReplicationThrottledRate: The rate of throttled replication for transmitted bytes into a broker.
  • PartitionBytesInRate: Equivalent to BytesInPerSec, but at a partition level (i.e. total traffic - throttled and not throttled). This is required for estimating how long a rebalance will take to complete. B/s. See usability section below.
  • SumReplicaLag: This is the sum of all replica lag values on the broker. This metric is used to monitor progress of a rebalance and is particularly useful for determining if the rebalance has become stuck due to an overly harsh throttle value (as the metric will stop decreasing).

Config & Zookeeper

...

  • the metric will stop decreasing).

Config & Zookeeper

Topic-level dynamic config (these properties cannot be set through the Kafka config file, or on topic creation)

bin/kafka-configs … --alter
--add-config 'leader.replication.throttled.replicas=[partId]-[replica], [partId]-[replica]...'

--entity-type topic
--entity-name topic-name

bin/kafka-configs … --alter
--add-config 'quotafollower.leader.replication.throttled.replicas=[partId]-[replica], [partId]-[replica]...'

--entity-type topic
--entity-name topic-name

 

Broker-level dynamic config (these properties cannot be set through the Kafka config file),  unit=B/s

bin/kafka-configs … --alter
--add-config 'quota.followerleader.replication.throttled.replicas=[partId]-[replica], [partId]-[replica]...10000'
--entity-type topicbroker
--entity-name topic-name

...

brokerId

bin/kafka-configs … --alter
--add-config 'replication-quotafollower.replication.throttled.replicas=10000'
--entity-type broker
--entity-name brokerId

 

Wildcard support is also provided for setting a throttle to all replicas:

bin/kafka-configs … --alter
--add-config 'leader.replication.throttled-.replicas=*'
--entity-type topic

...

bin/kafka-configs … --alter
--add-config 'replication-quotaleader.replication.throttled.rate=10000'
--entity-type broker

...

//Sample configuration for throttled replicas
{
"version":1,
"config": {
"quota.leader.replication.throttled.replicas":"0:0,0:1,0:2,1:0,1:1,1:2"
 }
}
//Sample configuration for throttled replicas
{
"version":1,
"config": {
"quota.follower.replication.throttled.replicas":"0:0,0:1,0:2,1:0,1:1,1:2"
 }
}

...