You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »

Status

Current stateDiscuss

Discussion thread: here

JIRA

Motivation

In Kafka, there is no general mechanism to change entity configuration without doing a rolling restart of the entire cluster. Currently, only topic configs can be changed dynamically. This proposal attempts to build a unified mechanism for modeling configuration across various entities within Kafka i.e. topics, clients etc.

Public Interfaces

  • We will add a new tool called ConfigChangeCommand that can manage all config changes in ZK. New methods will be added in AdminUtils to change configuration. This will be similar to the TopicCommand tool already present. Going forward, we will also deprecate the TopicCommand tool and have all config changes be driven through ConfigChangeCommand.
  • There will be new zookeeper paths under "config" but they are not considered to be public interfaces.

Proposed Changes

This proposal will generalize all the code in TopicConfigManager to make it possible to handle any kind of config change via Zookeeper. Initially, we will have 2 specific entities:

  • TopicConfigManager - Same as current but using the new generalized code.
  • ClientConfigManager - This will manage per-client configs. This is required for quotas and potentially for managing permissions/authorization in the future.

ZNode Structure:

There will be 2 paths within config
/config/clients/<client_id>
/config/topics/<topic_name>

Internally, the znodes are comma-separated key-value pairs where key represents the configuration property to change.
{"version": x, "config" : {X1 : Y1, X2 : Y2..}}

 

Upon startup, all brokers will load all the configs from zookeeper. In order to receive notifications, it's undesirable to watch every path under the root config directory. We can model change notifications the same way as they are currently handled for topic based configs. Here is the workflow for changing or adding a config of any type:

  • Create a znode (or modify existing) under the required path with the configs that you want to update. Example, if you want to change quotas for producer "Adi", add a path under /config/clients/Adi as shown below.
  • Create a sequential znode under "config/changes/config_change_XX". This will send a notification to all the watchers. The data within the change node should indicate what has changed i.e. topic config + topic name, client config + clientId.
  • The brokers process all the configs for the entity that has changed. 

Config Precedence

Configs in Zookeeper take precedence over any configuration read from the properties file. There is currently no plan to move away from file based configuration for service configs.

Applying Client Config Changes

The first usecase for client configs is to process quota changes per-client. This class will process all notifications and change clientId quotas accordingly. Some changes to the metrics package are also required to allow modification of quotas. Producer and consumer quotas are distinguished by having different properties since it's possible for a producer and consumer to have the same client id.

The client znode will look like this:

{"version" : 1, "config" : {"producer-byte-rate" : 1000, "consumer-byte-rate" : 2000}}

Config Change Notification

Currently, the change notification znode only contains the topic name. We need to add more information to distinguish whether this config change is for a topic, client or other config. Version numbering should also be added.

The notification data can be:
{"version" : 1, "entity":"topic/client", "value" : "topic_name/client_id"}

Compatibility, Deprecation, and Migration Plan

  • TopicConfigManager has a config_change_XX sequential znode under configs/. The format of data within the config_change node is going to change hence it is important to not make any config changes using TopicCommand until the cluster is fully upgraded. 

Rejected Alternatives

Dynamic Service Configs: After plenty of discussion, we've decided to not allow broker(service) configuration be dynamic. There were a couple of approaches:

  • Service Config in ZK
  • Reload config file via SIGHUP

See the attached discussion thread for more details on this decision.

 

  • No labels