DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
In the case that the defined set of non-sensitive configuration is still too sensitive, users can override the default list with the new configuration configsconfig.push.allowed.keys which is a comma separated list of configuration to send instead. configsconfig.push.allowed.keys is itself not sent to the server unless it is explicitly included in the override value.
...
In the case that a given configuration (either default or from configsconfig.push.allowed.keys) meets the above sensitive criteria, the client logs a warning message and the configuration value for that key is not sent to the broker. In the case that all configuration is deemed sensitive, the client does not send anything configuration-related to the broker (i.e. it doesn’t send a request with an empty set of configuration).
...
The client establishes a connection to the broker
The client sends an
ApiVersionsrequestIf
client.configsconfig.policy.class.nameis configured, the broker advertises support for thePushConfigRPC in theApiVersionsresponseThe client collects the configuration values, constructs a
PushConfigrequest, and sends it to the broker.The broker validates the
PushConfigrequest and invokesClientConfigPolicy.process()to handle the configuration.In this example, the implementation writes the configuration snapshot to external storage for observability.
ClientConfigPolicy.process()completes successfully.The broker returns a successful
PushConfigresponse. The client completes initialization and is ready for user API calls (e.g.,send(),poll()).
...
| Code Block |
|---|
package org.apache.kafka.server.policy.clientconfig; /** * An interface for intercepting and enforcing client configuration. * * <p/> * * If <code>client.configsconfig.policy.class.name</code> is defined, Kafka will * create an instance of the specified class using the default constructor and * will then pass the broker configs to its <code>configure()</code> method. * During broker shutdown, the <code>close()</code> method will be invoked * so that resources can be released (if necessary). */ @InterfaceStability.Evolving public interface ClientConfigPolicy extends Reconfigurable, AutoCloseable { /** * Receive the {@link ClientPushConfigData} data for observability. * <p/> * <em>Note 1</em>: the implementation of this method must not block. * <p/> * <em>Note 2</em>: this method will <em>not</em> be invoked if the {@code Config} array * of the {@link ClientPushConfigData} was larger than {@code client.configsconfig.max.bytes}. */ void process(AuthorizableRequestContext context, ClientConfigData pushConfigData); } |
...
| Code Block |
|---|
package org.apache.kafka.common.errors; /** * This exception indicates that the size of the client configuration data exceeded the * broker's client.configsconfig.max.bytes configuration. */ public class ClientConfigTooLargeException extends ApiException { public ClientConfigTooLargeException(String message) { super(message); } } |
...
Configuration
Broker
Setting client.configsconfig.policy.class.name to null disables the feature on the broker.
Configuration name | Description | Values |
|---|---|---|
| The client configuration policy class. The class must implement the | Type: Default: |
| Maximum size for the configuration, in bytes | Type: Default: |
...
Configuration name | Description | Values |
|---|---|---|
| This configuration controls whether the client performs the configuration handshake during the establishment of a new client connection. | Type: Default: |
| Overrides the default set of configuration keys with the list from this configuration. | Type: Default: |
...
The following error is new for this RPC:
Exception | Error Code | Description | Client Action |
|---|---|---|---|
|
| Client sent a request in which the |
| Log the error in |
PushConfigRequest
| Code Block |
|---|
{
"apiKey": NEXT,
"type": "request",
"listeners": ["broker"],
"name": "PushConfigRequest",
"validVersions": "0",
"flexibleVersions": "0+",
"fields": [
{ "name": "Configs", "type": "[]Config", "versions": "0+",
"about": "The client configuration entries.", "fields": [
{ "name": "ConfigKey", "type": "string", "versions": "0+",
"about": "The configuration key."},
{ "name": "ConfigValue", "type": "string", "versions": "0+",
"about": "The configuration value."},
{ "name": "ConfigType", "type": "int8", "versions": "0+",
"about": "ConfigDef.Type of the ConfigValue field."},
{ "name": "IsDefault", "type": "bool", "versions": "0+",
"about": "Boolean where true means the configuration value wasn't changed by the user."},
]}
]
} |
...
This feature can be disabled on the broker and the client. For the broker, remove client.configsconfig.policy.class.name or set its value to null. When this configuration is missing, the ApiVersions response will not include support for the feature, so the client doesn’t send configuration. For the client, set enable.configsconfig.push to false, in which case the client skips the entire configuration handshake.
...
If a broker is configured with client.configsconfig.policy.class.name, the ApiVersions response advertises support for the PushConfig RPC. Whenever a client sends a PushConfig request, the broker calls the policy with the client configuration for observability.
...
As described below, client implementations should not attempt to send a payload that is too large in the first place. But as a backup means of preventing the client from sending too much data, the broker checks the new configuration client.configsconfig.max.bytes prior to invoking the policy. If the size of the PushConfig request exceeds client.configsconfig.max.bytes, the broker returns the CONFIG_TOO_LARGE error to the client.
After analyzing the different Java clients’ configuration, a default of 10 KB for client.configsconfig.max.bytes provides more than sufficient capacity:
...
Client connects to broker
Send
ApiVersionsrequest (internal, automatic)Receive
ApiVersionsresponse to determine which features broker supportsIf
enable.configsconfig.pushis set and configuration push is supported by the brokerCollect requested client configuration values
Send
PushConfigwith configurationReceive
PushConfigresponse
User requests can now be sent
...
Older clients (no support): No impact
Don't check for config push APIs
Behavior identical to pre-KIP
Newer clients with feature disabled: No impact
enable.configsconfig.push=falseHandshake skipped
Behaviorally identical to older clients
Newer clients with feature enabled (default): Minor impact
Additional RTT during connection setup (
PushConfig)Estimated 10-50ms added latency to first user request (depends on network RTT)
One-time cost per client instance lifetime
...
Test producer, consumer, admin, and Kafka Streams client with
enable.configsconfig.pushset totrueperforms handshakeTest producer, consumer, admin, and Kafka Streams client with
enable.configsconfig.pushset tofalseskip handshake entirelyTest Kafka Streams does not perform separate handshake for embedded producer/consumer/admin clients
Broker Configuration
Test broker with
client.configsconfig.policy.class.nameset advertises APIs inApiVersionsTest broker without policy (
null) does not advertise config push APIsTest broker with policy invokes
process()on successfulPushConfig
...
Test config payload near
client.configsconfig.max.byteslimitTest config payload exceeding
client.configsconfig.max.bytesreturnsCONFIG_TOO_LARGE
...