Browse Source

KAFKA-2666: Docs: Automatically generate documentation from config classes

…the way we always planned to

Author: Gwen Shapira <cshapi@gmail.com>

Reviewers: Jun Rao, Guozhang Wang

Closes #382 from gwenshap/KAFKA-2666
pull/382/merge
Gwen Shapira 9 years ago
parent
commit
b4e1bdf48b
  1. 22
      build.gradle
  2. 500
      docs/configuration.html
  3. 9
      docs/documentation.html

22
build.gradle

@ -301,13 +301,33 @@ project(':core') { @@ -301,13 +301,33 @@ project(':core') {
into "$buildDir/dependant-libs-${scalaVersion}"
}
task siteDocsTar(type: Tar) {
tasks.create(name: "genProducerConfigDocs", dependsOn:jar, type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'org.apache.kafka.clients.producer.ProducerConfig'
standardOutput = new File('docs/producer_config.html').newOutputStream()
}
tasks.create(name: "genConsumerConfigDocs", dependsOn:jar, type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'org.apache.kafka.clients.consumer.ConsumerConfig'
standardOutput = new File('docs/consumer_config.html').newOutputStream()
}
tasks.create(name: "genKafkaConfigDocs", dependsOn:jar, type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'kafka.server.KafkaConfig'
standardOutput = new File('docs/kafka_config.html').newOutputStream()
}
task siteDocsTar(dependsOn: ['genProducerConfigDocs', 'genConsumerConfigDocs', 'genKafkaConfigDocs'], type: Tar) {
classifier = 'site-docs'
compression = Compression.GZIP
from project.file("../docs")
into 'site-docs'
}
tasks.create(name: "releaseTarGz", dependsOn: configurations.archives.artifacts, type: Tar) {
into "kafka_${baseScalaVersion}-${version}"
compression = Compression.GZIP

500
docs/configuration.html

@ -28,431 +28,11 @@ The essential configurations are the following: @@ -28,431 +28,11 @@ The essential configurations are the following:
Topic-level configurations and defaults are discussed in more detail <a href="#topic-config">below</a>.
<table class="data-table">
<tbody><tr>
<th>Property</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>broker.id</td>
<td></td>
<td>Each broker is uniquely identified by a non-negative integer id. This id serves as the broker's "name" and allows the broker to be moved to a different host/port without confusing consumers. You can choose any number you like so long as it is unique.
</td>
</tr>
<tr>
<td>log.dirs</td>
<td nowrap>/tmp/kafka-logs</td>
<td>A comma-separated list of one or more directories in which Kafka data is stored. Each new partition that is created will be placed in the directory which currently has the fewest partitions.</td>
</tr>
<tr>
<td>port</td>
<td>9092</td>
<td>The port on which the server accepts client connections.</td>
</tr>
<tr>
<td>zookeeper.connect</td>
<td>null</td>
<td>Specifies the ZooKeeper connection string in the form <code>hostname:port</code>, where hostname and port are the host and port for a node in your ZooKeeper cluster. To allow connecting through other ZooKeeper nodes when that host is down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.
<p>
ZooKeeper also allows you to add a "chroot" path which will make all kafka data for this cluster appear under a particular path. This is a way to setup multiple Kafka clusters or other applications on the same ZooKeeper cluster. To do this give a connection string in the form <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code> which would put all this cluster's data under the path <code>/chroot/path</code>. Note that consumers must use the same connection string.</td>
</tr>
<tr>
<td>message.max.bytes</td>
<td>1000000</td>
<td>The maximum size of a message that the server can receive. It is important that this property be in sync with the maximum fetch size your consumers use or else an unruly producer will be able to publish messages too large for consumers to consume.</td>
</tr>
<tr>
<td>num.network.threads</td>
<td>3</td>
<td>The number of network threads that the server uses for handling network requests. You probably don't need to change this.</td>
</tr>
<tr>
<td>num.io.threads</td>
<td>8</td>
<td>The number of I/O threads that the server uses for executing requests. You should have at least as many threads as you have disks.</td>
</tr>
<tr>
<td>background.threads</td>
<td>10</td>
<td>The number of threads to use for various background processing tasks such as file deletion. You should not need to change this.</td>
</tr>
<tr>
<td>queued.max.requests</td>
<td>500</td>
<td>The number of requests that can be queued up for processing by the I/O threads before the network threads stop reading in new requests.</td>
</tr>
<tr>
<td>host.name</td>
<td>null</td>
<td>
<p>Hostname of broker. If this is set, it will only bind to this address. If this is not set, it will bind to all interfaces, and publish one to ZK.</p>
</td>
</tr>
<tr>
<td>advertised.host.name</td>
<td>null</td>
<td>
<p>If this is set this is the hostname that will be given out to producers, consumers, and other brokers to connect to.</p>
</td>
</tr>
<tr>
<td>advertised.port</td>
<td>null</td>
<td>
<p>The port to give out to producers, consumers, and other brokers to use in establishing connections. This only needs to be set if this port is different from the port the server should bind to.</p>
</td>
</tr>
<tr>
<td>socket.send.buffer.bytes</td>
<td>100 * 1024</td>
<td>The SO_SNDBUFF buffer the server prefers for socket connections.</td>
</tr>
<tr>
<td>socket.receive.buffer.bytes</td>
<td>100 * 1024</td>
<td>The SO_RCVBUFF buffer the server prefers for socket connections.</td>
</tr>
<tr>
<td>socket.request.max.bytes</td>
<td>100 * 1024 * 1024</td>
<td>The maximum request size the server will allow. This prevents the server from running out of memory and should be smaller than the Java heap size.</td>
</tr>
<tr>
<td>num.partitions</td>
<td>1</td>
<td>The default number of partitions per topic if a partition count isn't given at topic creation time.</td>
</tr>
<tr>
<td>log.segment.bytes</td>
<td nowrap>1024 * 1024 * 1024</td>
<td>The log for a topic partition is stored as a directory of segment files. This setting controls the size to which a segment file will grow before a new segment is rolled over in the log. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.roll.{ms,hours}</td>
<td>24 * 7 hours</td>
<td>This setting will force Kafka to roll a new log segment even if the log.segment.bytes size has not been reached. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.cleanup.policy</td>
<td>delete</td>
<td>This can take either the value <i>delete</i> or <i>compact</i>. If <i>delete</i> is set, log segments will be deleted when they reach the size or time limits set. If <i>compact</i> is set <a href="#compaction">log compaction</a> will be used to clean out obsolete records. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.retention.{ms,minutes,hours}</td>
<td>7 days</td>
<td>The amount of time to keep a log segment before it is deleted, i.e. the default data retention window for all topics. Note that if both log.retention.minutes and log.retention.bytes are both set we delete a segment when either limit is exceeded. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.retention.bytes</td>
<td>-1</td>
<td>The amount of data to retain in the log for each topic-partitions. Note that this is the limit per-partition so multiply by the number of partitions to get the total data retained for the topic. Also note that if both log.retention.hours and log.retention.bytes are both set we delete a segment when either limit is exceeded. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.retention.check.interval.ms</td>
<td>5 minutes</td>
<td>The period with which we check whether any log segment is eligible for deletion to meet the retention policies.</td>
</tr>
<tr>
<td>log.cleaner.enable</td>
<td>false</td>
<td>This configuration must be set to true for log compaction to run.</td>
</tr>
<tr>
<td>log.cleaner.threads</td>
<td>1</td>
<td>The number of threads to use for cleaning logs in log compaction.</td>
</tr>
<tr>
<td>log.cleaner.io.max.bytes.per.second</td>
<td>Double.MaxValue</td>
<td>The maximum amount of I/O the log cleaner can do while performing log compaction. This setting allows setting a limit for the cleaner to avoid impacting live request serving.</td>
</tr>
<tr>
<td>log.cleaner.dedupe.buffer.size</td>
<td>500*1024*1024</td>
<td>The size of the buffer the log cleaner uses for indexing and deduplicating logs during cleaning. Larger is better provided you have sufficient memory.</td>
</tr>
<tr>
<td>log.cleaner.io.buffer.size</td>
<td>512*1024</td>
<td>The size of the I/O chunk used during log cleaning. You probably don't need to change this.</td>
</tr>
<tr>
<td>log.cleaner.io.buffer.load.factor</td>
<td>0.9</td>
<td>The load factor of the hash table used in log cleaning. You probably don't need to change this.</td>
</tr>
<tr>
<td>log.cleaner.backoff.ms</td>
<td>15000</td>
<td>The interval between checks to see if any logs need cleaning.</td>
</tr>
<tr>
<td>log.cleaner.min.cleanable.ratio</td>
<td>0.5</td>
<td>This configuration controls how frequently the log compactor will attempt to clean the log (assuming <a href="#compaction">log compaction</a> is enabled). By default we will avoid cleaning a log where more than 50% of the log has been compacted. This ratio bounds the maximum space wasted in the log by duplicates (at 50% at most 50% of the log could be duplicates). A higher ratio will mean fewer, more efficient cleanings but will mean more wasted space in the log. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.cleaner.delete.retention.ms</td>
<td>1 day</td>
<td>The amount of time to retain delete tombstone markers for <a href="#compaction">log compacted</a> topics. This setting also gives a bound on the time in which a consumer must complete a read if they begin from offset 0 to ensure that they get a valid snapshot of the final stage (otherwise delete tombstones may be collected before they complete their scan). This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.index.size.max.bytes</td>
<td>10 * 1024 * 1024</td>
<td>The maximum size in bytes we allow for the offset index for each log segment. Note that we will always pre-allocate a sparse file with this much space and shrink it down when the log rolls. If the index fills up we will roll a new log segment even if we haven't reached the log.segment.bytes limit. This setting can be overridden on a per-topic basis (see <a href="#topic-config">the per-topic configuration section</a>).</td>
</tr>
<tr>
<td>log.index.interval.bytes</td>
<td>4096</td>
<td>The byte interval at which we add an entry to the offset index. When executing a fetch request the server must do a linear scan for up to this many bytes to find the correct position in the log to begin and end the fetch. So setting this value to be larger will mean larger index files (and a bit more memory usage) but less scanning. However the server will never add more than one index entry per log append (even if more than log.index.interval worth of messages are appended). In general you probably don't need to mess with this value.</td>
</tr>
<tr>
<td>log.flush.interval.messages</td>
<td>Long.MaxValue</td>
<td>The number of messages written to a log partition before we force an fsync on the log. Setting this lower will sync data to disk more often but will have a major impact on performance. We generally recommend that people make use of replication for durability rather than depending on single-server fsync, however this setting can be used to be extra certain.</td>
</tr>
<tr>
<td>log.flush.scheduler.interval.ms</td>
<td>Long.MaxValue</td>
<td>The frequency in ms that the log flusher checks whether any log is eligible to be flushed to disk.</td>
</tr>
<tr>
<td>log.flush.interval.ms</td>
<td>Long.MaxValue</td>
<td>The maximum time between fsync calls on the log. If used in conjuction with log.flush.interval.messages the log will be flushed when either criteria is met.</td>
</tr>
<tr>
<td>log.delete.delay.ms</td>
<td>60000</td>
<td>The period of time we hold log files around after they are removed from the in-memory segment index. This period of time allows any in-progress reads to complete uninterrupted without locking. You generally don't need to change this.</td>
</tr>
<tr>
<td>log.flush.offset.checkpoint.interval.ms</td>
<td>60000</td>
<td>The frequency with which we checkpoint the last flush point for logs for recovery. You should not need to change this.</td>
</tr>
<tr>
<td>log.segment.delete.delay.ms</td>
<td>60000</td>
<td>the amount of time to wait before deleting a file from the filesystem.</td>
</tr>
<tr>
<td>auto.create.topics.enable</td>
<td>true</td>
<td>Enable auto creation of topic on the server. If this is set to true then attempts to produce data or fetch metadata for a non-existent topic will automatically create it with the default replication factor and number of partitions.</td>
</tr>
<tr>
<td>controller.socket.timeout.ms</td>
<td>30000</td>
<td>The socket timeout for commands from the partition management controller to the replicas.</td>
</tr>
<tr>
<td>controller.message.queue.size</td>
<td>Int.MaxValue</td>
<td>The buffer size for controller-to-broker-channels</td>
</tr>
<tr>
<td>default.replication.factor</td>
<td>1</td>
<td>The default replication factor for automatically created topics.</td>
</tr>
<tr>
<td>replica.lag.time.max.ms</td>
<td>10000</td>
<td>If a follower hasn't sent any fetch requests for this window of time, the leader will remove the follower from ISR (in-sync replicas) and treat it as dead.</td>
</tr>
<tr>
<td>replica.socket.timeout.ms</td>
<td>30 * 1000</td>
<td>The socket timeout for network requests to the leader for replicating data.</td>
</tr>
<tr>
<td>replica.socket.receive.buffer.bytes</td>
<td>64 * 1024</td>
<td>The socket receive buffer for network requests to the leader for replicating data.</td>
</tr>
<tr>
<td>replica.fetch.max.bytes</td>
<td nowrap>1024 * 1024</td>
<td>The number of byes of messages to attempt to fetch for each partition in the fetch requests the replicas send to the leader.</td>
</tr>
<tr>
<td>replica.fetch.wait.max.ms</td>
<td>500</td>
<td>The maximum amount of time to wait time for data to arrive on the leader in the fetch requests sent by the replicas to the leader.</td>
</tr>
<tr>
<td>replica.fetch.min.bytes</td>
<td>1</td>
<td>Minimum bytes expected for each fetch response for the fetch requests from the replica to the leader. If not enough bytes, wait up to replica.fetch.wait.max.ms for this many bytes to arrive.</td>
</tr>
<tr>
<td>num.replica.fetchers</td>
<td>1</td>
<td>
<p>Number of threads used to replicate messages from leaders. Increasing this value can increase the degree of I/O parallelism in the follower broker.</p>
</td>
</tr>
<tr>
<td>replica.high.watermark.checkpoint.interval.ms</td>
<td>5000</td>
<td>The frequency with which each replica saves its high watermark to disk to handle recovery.</td>
</tr>
<tr>
<td>fetch.purgatory.purge.interval.requests</td>
<td>1000</td>
<td>The purge interval (in number of requests) of the fetch request purgatory.</td>
</tr>
<tr>
<td>producer.purgatory.purge.interval.requests</td>
<td>1000</td>
<td>The purge interval (in number of requests) of the producer request purgatory.</td>
</tr>
<tr>
<td>zookeeper.session.timeout.ms</td>
<td>6000</td>
<td>ZooKeeper session timeout. If the server fails to heartbeat to ZooKeeper within this period of time it is considered dead. If you set this too low the server may be falsely considered dead; if you set it too high it may take too long to recognize a truly dead server.</td>
</tr>
<tr>
<td>zookeeper.connection.timeout.ms</td>
<td>6000</td>
<td>The maximum amount of time that the client waits to establish a connection to zookeeper.</td>
</tr>
<tr>
<td>zookeeper.sync.time.ms</td>
<td>2000</td>
<td>How far a ZK follower can be behind a ZK leader.</td>
</tr>
<tr>
<td>controlled.shutdown.enable</td>
<td>true</td>
<td>Enable controlled shutdown of the broker. If enabled, the broker will move all leaders on it to some other brokers before shutting itself down. This reduces the unavailability window during shutdown.</td>
</tr>
<tr>
<td>controlled.shutdown.max.retries</td>
<td>3</td>
<td>Number of retries to complete the controlled shutdown successfully before executing an unclean shutdown.</td>
</tr>
<tr>
<td>controlled.shutdown.retry.backoff.ms</td>
<td>5000</td>
<td>Backoff time between shutdown retries.</td>
</tr>
<tr>
<td>auto.leader.rebalance.enable</td>
<td>true</td>
<td>If this is enabled the controller will automatically try to balance leadership for partitions among the brokers by periodically returning leadership to the "preferred" replica for each partition if it is available.</td>
</tr>
<tr>
<td>leader.imbalance.per.broker.percentage</td>
<td>10</td>
<td>The percentage of leader imbalance allowed per broker. The controller will rebalance leadership if this ratio goes above
the configured value per broker.</td>
</tr>
<tr>
<td>leader.imbalance.check.interval.seconds</td>
<td>300</td>
<td>The frequency with which to check for leader imbalance.</td>
</tr>
<tr>
<td>offset.metadata.max.bytes</td>
<td>4096</td>
<td>The maximum amount of metadata to allow clients to save with their offsets.</td>
</tr>
<tr>
<td>max.connections.per.ip</td>
<td>Int.MaxValue</td>
<td>The maximum number of connections that a broker allows from each ip address.</td>
</tr>
<tr>
<td>max.connections.per.ip.overrides</td>
<td></td>
<td>Per-ip or hostname overrides to the default maximum number of connections.</td>
</tr>
<tr>
<td>connections.max.idle.ms</td>
<td>600000</td>
<td>Idle connections timeout: the server socket processor threads close the connections that idle more than this.</td>
</tr>
<tr>
<td>log.roll.jitter.{ms,hours}</td>
<td>0</td>
<td>The maximum jitter to subtract from logRollTimeMillis.</td>
</tr>
<tr>
<td>num.recovery.threads.per.data.dir</td>
<td>1</td>
<td>The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.</td>
</tr>
<tr>
<td>unclean.leader.election.enable</td>
<td>true</td>
<td>Indicates whether to enable replicas not in the ISR set to be elected as leader as a last resort, even though doing so may result in data loss.</td>
</tr>
<tr>
<td>delete.topic.enable</td>
<td>false</td>
<td>Enable delete topic.</td>
</tr>
<tr>
<td>offsets.topic.num.partitions</td>
<td>50</td>
<td>The number of partitions for the offset commit topic. Since changing this after deployment is currently unsupported, we recommend using a higher setting for production (e.g., 100-200).</td>
</tr>
<tr>
<td>offsets.topic.retention.minutes</td>
<td>1440</td>
<td>Offsets that are older than this age will be marked for deletion. The actual purge will occur when the log cleaner compacts the offsets topic.</td>
</tr>
<tr>
<td>offsets.retention.check.interval.ms</td>
<td>600000</td>
<td>The frequency at which the offset manager checks for stale offsets.</td>
</tr>
<tr>
<td>offsets.topic.replication.factor</td>
<td>3</td>
<td>The replication factor for the offset commit topic. A higher setting (e.g., three or four) is recommended in order to ensure higher availability. If the offsets topic is created when fewer brokers than the replication factor then the offsets topic will be created with fewer replicas.</td>
</tr>
<tr>
<td>offsets.topic.segment.bytes</td>
<td>104857600</td>
<td>Segment size for the offsets topic. Since it uses a compacted topic, this should be kept relatively low in order to facilitate faster log compaction and loads.</td>
</tr>
<tr>
<td>offsets.load.buffer.size</td>
<td>5242880</td>
<td>An offset load occurs when a broker becomes the offset manager for a set of consumer groups (i.e., when it becomes a leader for an offsets topic partition). This setting corresponds to the batch size (in bytes) to use when reading from the offsets segments when loading offsets into the offset manager's cache.</td>
</tr>
<!--
<tr>
<td>offsets.topic.compression.codec</td>
<td>none</td>
<td>(Should not be used until KAFKA-1374 is implemented.) Compression codec for the offsets topic. Compression should be enabled in order to achieve "atomic" commits.</td>
</tr>
-->
<tr>
<td>offsets.commit.required.acks</td>
<td>-1</td>
<td>The number of acknowledgements that are required before the offset commit can be accepted. This is similar to the producer's acknowledgement setting. In general, the default should not be overridden.</td>
</tr>
<tr>
<td>offsets.commit.timeout.ms</td>
<td>5000</td>
<td>The offset commit will be delayed until this timeout or the required number of replicas have received the offset commit. This is similar to the producer request timeout.</td>
</tr>
<tr>
<td>inter.broker.protocol.version</td>
<td>0.9.0</td>
<td>Version of the protocol brokers will use to communicate with each other. This will default for the current version of the broker, but may need to be set to older versions during a rolling upgrade process. In that scenario, upgraded brokers will use the older version of the protocol and therefore will be able to communicate with brokers that were not yet upgraded. See <a href="#upgrade">upgrade section</a> for more details.</td>
</tr>
</tbody></table>
<!--#include virtual="kafka_config.html" -->
<p>More details about broker configuration can be found in the scala class <code>kafka.server.KafkaConfig</code>.</p>
<h4><a id="topic-config">Topic-level configuration</a></h3>
<p><a id="topic-config">Topic-level configuration</a></h3>
Configurations pertinent to topics have both a global default as well an optional per-topic override. If no per-topic configuration is given the global default is used. The override can be set at topic creation time by giving one or more <code>--config</code> options. This example creates a topic named <i>my-topic</i> with a custom max message size and flush rate:
<pre>
@ -736,8 +316,18 @@ The essential consumer configurations are the following: @@ -736,8 +316,18 @@ The essential consumer configurations are the following:
<p>More details about consumer configuration can be found in the scala class <code>kafka.consumer.ConsumerConfig</code>.</p>
<h3><a id="producerconfigs">3.3 Producer Configs</a></h3>
Essential configuration properties for the producer include:
<h3><a id="newconsumerconfigs">3.3 New Consumer Configs</a></h3>
Since 0.9.0.0 we have been working on a replacement for our existing simple and high-level consumers. The code can be considered beta quality. Below is the configuration for the new consumer: </p>
<!--#include virtual="consumer_config.html" -->
<h3><a id="producerconfigs">3.4 Kafka Producer Configs</a></h3>
We recommend using KafkaProducer as SyncProducer and AsyncProducer will be deprecated in the next release. Below is the configuration for the new producer:</p>
<!--#include virtual="producer_config.html" -->
<h3><a id="oldproducerconfigs">3.5 Old Producer Configs</a></h3>
We recommend not to use the Scala SyncProducer and AsyncProducer as they will be deprecated in the next release. Below you can see their configuration:
<ul>
<li><code>metadata.broker.list</code>
<li><code>request.required.acks</code>
@ -865,64 +455,4 @@ Essential configuration properties for the producer include: @@ -865,64 +455,4 @@ Essential configuration properties for the producer include:
<td>The client id is a user-specified string sent in each request to help trace calls. It should logically identify the application making the request.</td>
</tr>
</tbody></table>
<p>More details about producer configuration can be found in the scala class <code>kafka.producer.ProducerConfig</code>.</p>
<h3><a id="newproducerconfigs">3.4 New Producer Configs</a></h3>
We are working on a replacement for our existing producer. The code is available in trunk now and can be considered beta quality. Below is the configuration for the new producer.
<table class="data-table">
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Importance</th>
<th>Description</th>
</tr>
<tr>
<td>bootstrap.servers</td><td>list</td><td></td><td>high</td><td>A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. Data will be load balanced over all servers irrespective of which servers are specified here for bootstrapping&mdash;this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form <code>host1:port1,host2:port2,...</code>. Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down). If no server in this list is available sending data will fail until on becomes available.</td></tr>
<tr>
<td>acks</td><td>string</td><td>1</td><td>high</td><td>The number of acknowledgments the producer requires the leader to have received before considering a request complete. This controls the durability of records that are sent. The following settings are common: <ul> <li><code>acks=0</code> If set to zero then the producer will not wait for any acknowledgment from the server at all. The record will be immediately added to the socket buffer and considered sent. No guarantee can be made that the server has received the record in this case, and the <code>retries</code> configuration will not take effect (as the client won't generally know of any failures). The offset given back for each record will always be set to -1. <li><code>acks=1</code> This will mean the leader will write the record to its local log but will respond without awaiting full acknowledgement from all followers. In this case should the leader fail immediately after acknowledging the record but before the followers have replicated it then the record will be lost. <li><code>acks=all</code> This means the leader will wait for the full set of in-sync replicas to acknowledge the record. This guarantees that the record will not be lost as long as at least one in-sync replica remains alive. This is the strongest available guarantee. <li>Other settings such as <code>acks=2</code> are also possible, and will require the given number of acknowledgements but this is generally less useful.</td></tr>
<tr>
<td>buffer.memory</td><td>long</td><td>33554432</td><td>high</td><td>The total bytes of memory the producer can use to buffer records waiting to be sent to the server. If records are sent faster than they can be delivered to the server the producer will either block or throw an exception based on the preference specified by <code>block.on.buffer.full</code>. <p>This setting should correspond roughly to the total memory the producer will use, but is not a hard bound since not all memory the producer uses is used for buffering. Some additional memory will be used for compression (if compression is enabled) as well as for maintaining in-flight requests.</td></tr>
<tr>
<td>compression.type</td><td>string</td><td>none</td><td>high</td><td>The compression type for all data generated by the producer. The default is none (i.e. no compression). Valid values are <code>none</code>, <code>gzip</code>, or <code>snappy</code>. Compression is of full batches of data, so the efficacy of batching will also impact the compression ratio (more batching means better compression).</td></tr>
<tr>
<td>retries</td><td>int</td><td>0</td><td>high</td><td>Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error. Note that this retry is no different than if the client resent the record upon receiving the error. Allowing retries will potentially change the ordering of records because if two records are sent to a single partition, and the first fails and is retried but the second succeeds, then the second record may appear first.</td></tr>
<tr>
<td>key.serializer</td><td>string</td><td></td><td>high</td><td>The serializer class for keys. The provided class must implement <code>org.apache.kafka.common.serialization.Serializer</code>. Default implementations are available in <code>org.apache.kafka.common.serialization</code>.</td></tr>
<tr>
<td>value.serializer</td><td>string</td><td></td><td>high</td><td>The serializer class for messages. The provided class must implement <code>org.apache.kafka.common.serialization.Serializer</code>. Default implementations are available in <code>org.apache.kafka.common.serialization</code>.</td></tr>
<tr>
<td>batch.size</td><td>int</td><td>16384</td><td>medium</td><td>The producer will attempt to batch records together into fewer requests whenever multiple records are being sent to the same partition. This helps performance on both the client and the server. This configuration controls the default batch size in bytes. <p>No attempt will be made to batch records larger than this size. <p>Requests sent to brokers will contain multiple batches, one for each partition with data available to be sent. <p>A small batch size will make batching less common and may reduce throughput (a batch size of zero will disable batching entirely). A very large batch size may use memory a bit more wastefully as we will always allocate a buffer of the specified batch size in anticipation of additional records.</td></tr>
<tr>
<td>client.id</td><td>string</td><td></td><td>medium</td><td>The id string to pass to the server when making requests. The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included with the request. The application can set any string it wants as this has no functional purpose other than in logging and metrics.</td></tr>
<tr>
<td>linger.ms</td><td>long</td><td>0</td><td>medium</td><td>The producer groups together any records that arrive in between request transmissions into a single batched request. Normally this occurs only under load when records arrive faster than they can be sent out. However in some circumstances the client may want to reduce the number of requests even under moderate load. This setting accomplishes this by adding a small amount of artificial delay&mdash;that is, rather than immediately sending out a record the producer will wait for up to the given delay to allow other records to be sent so that the sends can be batched together. This can be thought of as analogous to Nagle's algorithm in TCP. This setting gives the upper bound on the delay for batching: once we get <code>batch.size</code> worth of records for a partition it will be sent immediately regardless of this setting, however if we have fewer than this many bytes accumulated for this partition we will 'linger' for the specified time waiting for more records to show up. This setting defaults to 0 (i.e. no delay). Setting <code>linger.ms=5</code>, for example, would have the effect of reducing the number of requests sent but would add up to 5ms of latency to records sent in the absense of load.</td></tr>
<tr>
<td>max.request.size</td><td>int</td><td>1048576</td><td>medium</td><td>The maximum size of a request. This is also effectively a cap on the maximum record size. Note that the server has its own cap on record size which may be different from this. This setting will limit the number of record batches the producer will send in a single request to avoid sending huge requests.</td></tr>
<tr>
<td>receive.buffer.bytes</td><td>int</td><td>32768</td><td>medium</td><td>The size of the TCP receive buffer to use when reading data</td></tr>
<tr>
<td>send.buffer.bytes</td><td>int</td><td>131072</td><td>medium</td><td>The size of the TCP send buffer to use when sending data</td></tr>
<tr>
<td>timeout.ms</td><td>int</td><td>30000</td><td>medium</td><td>The configuration controls the maximum amount of time the server will wait for acknowledgments from followers to meet the acknowledgment requirements the producer has specified with the <code>acks</code> configuration. If the requested number of acknowledgments are not met when the timeout elapses an error will be returned. This timeout is measured on the server side and does not include the network latency of the request.</td></tr>
<tr>
<td>block.on.buffer.full</td><td>boolean</td><td>true</td><td>low</td><td>When our memory buffer is exhausted we must either stop accepting new records (block) or throw errors. By default this setting is true and we block, however in some scenarios blocking is not desirable and it is better to immediately give an error. Setting this to <code>false</code> will accomplish that: the producer will throw a BufferExhaustedException if a recrord is sent and the buffer space is full.</td></tr>
<tr>
<td>metadata.fetch.timeout.ms</td><td>long</td><td>60000</td><td>low</td><td>The first time data is sent to a topic we must fetch metadata about that topic to know which servers host the topic's partitions. This configuration controls the maximum amount of time we will block waiting for the metadata fetch to succeed before throwing an exception back to the client.</td></tr>
<tr>
<td>metadata.max.age.ms</td><td>long</td><td>300000</td><td>low</td><td>The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.</td></tr>
<tr>
<td>metric.reporters</td><td>list</td><td>[]</td><td>low</td><td>A list of classes to use as metrics reporters. Implementing the <code>MetricReporter</code> interface allows plugging in classes that will be notified of new metric creation. The JmxReporter is always included to register JMX statistics.</td></tr>
<tr>
<td>metrics.num.samples</td><td>int</td><td>2</td><td>low</td><td>The number of samples maintained to compute metrics.</td></tr>
<tr>
<td>metrics.sample.window.ms</td><td>long</td><td>30000</td><td>low</td><td>The metrics system maintains a configurable number of samples over a fixed window size. This configuration controls the size of the window. For example we might maintain two samples each measured over a 30 second period. When a window expires we erase and overwrite the oldest window.</td></tr>
<tr>
<td>reconnect.backoff.ms</td><td>long</td><td>10</td><td>low</td><td>The amount of time to wait before attempting to reconnect to a given host when a connection fails. This avoids a scenario where the client repeatedly attempts to connect to a host in a tight loop.</td></tr>
<tr>
<td>retry.backoff.ms</td><td>long</td><td>100</td><td>low</td><td>The amount of time to wait before attempting to retry a failed produce request to a given topic partition. This avoids repeated sending-and-failing in a tight loop.</td></tr>
<tr>
<td>max.in.flight.requests.per.connection</td><td>int</td><td>5</td><td>low</td><td>The number of "in-flight requests" on a given connection is the number of requests currently awaiting acknowledgement on that connection. When the number of in-flight requests is equal to this number, the client will wait for one of them to be acknowledged before sending the next request to that node. It's important to note that one request corresponds to a batch of messages, so increasing this number too much can cause suboptimal batching behavior in the client. This is because the client will not wait long enough to let messages batch together into large batches, and will instead send many small requests which are much less efficient to process. You can explicitly instruct the client to wait a certain amount of time until more messages are available to batch by setting <code>linger.ms</code>. In addition, setting this number high increase throughput but can cause out-of-order message arrivals.</td></tr>
</table>
<p>More details about producer configuration can be found in the scala class <code>kafka.producer.ProducerConfig</code>.</p>

9
docs/documentation.html

@ -39,10 +39,11 @@ Prior releases: <a href="/07/documentation.html">0.7.x</a>, <a href="/08/documen @@ -39,10 +39,11 @@ Prior releases: <a href="/07/documentation.html">0.7.x</a>, <a href="/08/documen
</ul>
<li><a href="#configuration">3. Configuration</a>
<ul>
<li><a href="#brokerconfigs">3.1 Broker Configs</a>
<li><a href="#consumerconfigs">3.2 Consumer Configs</a>
<li><a href="#producerconfigs">3.3 Producer Configs</a>
<li><a href="#newproducerconfigs">3.4 New Producer Configs</a>
<li><a href="#brokerconfigs">3.1 Broker Configs</a>
<li><a href="#consumerconfigs">3.2 Consumer Configs</a>
<li><a href="#newconsumerconfigs">3.3 New Consumer Configs</a>
<li><a href="#producerconfigs">3.4 Kafka Producer Configs</a>
<li><a href="#oldproducerconfigs">3.5 Old Producer Configs</a>
</ul>
<li><a href="#design">4. Design</a>
<ul>

Loading…
Cancel
Save