<a id="cloud-topic-config"></a>

<a id="topic-parameters"></a>

# Configuration Reference for Topics in Confluent Cloud

This page lists the Apache Kafka® [topic](../_glossary.md#term-topic) configurations in
Confluent Cloud. Each definition includes default values, relevant minimum and maximum values,
and whether parameters are editable. To edit topic settings, see [Edit topics](overview.md#edit-topics-cloud).

<style>
  input.search-bar {
    box-sizing: border-box;
    margin-bottom: 30px;
    font-size: 22px;
    padding: 20px;
    padding-left: 60px;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    flex: 1;
    width: 100%;
    color: #3B454F;
    line-height: 27.5px;
    background: #F1FAFF 20px 24px no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGqSURBVHgBrZRBTsJQEIZnHi6AkNiVeYRNDZC4xBMIN9AT0BuIJxBPwBHEExhPQDmB7NFYFiRNcNEFCZu2z5n2EUnpKwSd5KXT8vN15vWfh5AJy7KtSuXMiWNlI8I5AC7osev7Hy4cEbh7I2XrUQgYKAXWvlR5SkU93/c8OAYoZfsZUTn6dkpQNxEg2nS5ISBfgzDE3mo1nxUCuTJqb0griGO4y7Yn5ZUtRDiil9wydLMJL4PAC3KJLK7XW4qXlE0HCoI0k1TXGpo0AiDq6nzq+5/jAh5QhU9JWwj3RiBi3NFiFw7EzlZY7IZcoFLCghOiXIZ8INsBkgrVQTDv9zY32YeAaatCYN/Uxm+EfZ1MTQqh94WXVa2WRiZho9HusLU4p27GRqCu7oE9qBQ69Xrzi2zR3Qq4avYpjeK7fkT+i1wTEHcrIFO/6onIFycv5Y9hHkOxTZbL+UypUo/+9kIrK+RR7MXx2XX6G9LBUZpIadvGCrPBrbI1slXwl0aMJmkn+5UagUVRBD0JWAQ9GWiCluAPsV5/B7XaxRudo3ys2TTGC/iP0EfggPMf4IXM0qeAeMAAAAAASUVORK5CYII=);
    background-clip: padding-box;
    }
 </style>

 <script>
 function filterList() {
     // Get input value and convert to lowercase
     var input = document.getElementById("search-bar").value.toLowerCase();

     // Get all the h2 headers, which are config names.
     var sections = document.getElementsByClassName("section")

     // Loop through all the headers
     for (var i = 0; i < sections.length; i++) {
     var section = sections[i];
     var h2Entries = section.getElementsByTagName("h2")
     // There is only 1 h3 in each section that contains a config value.
     if (h2Entries.length == 1) {
             // Check if the term matches the search input, and if so display the section. Otherwise, hide it.
         var h2text = h2Entries[0].textContent.toLowerCase();
         if (h2text.indexOf(input) > -1)
         section.style.display ="";
         else
         section.style.display = "none";
     }
     }
     }
   window.addEventListener('load', filterList);
 </script><form>

  <input type="text" id="search-bar"
    class="search-bar"
    aria-label="Search"
    placeholder="Search for a configuration property..."
    onkeyup="filterList()"
    autocomplete="off"></input>
 </form>

<a id="topics-cleanup-policy"></a>

## cleanup.policy

This configuration designates the retention policy to use on log segments. You
cannot directly change `cleanup.policy` from `delete` to `compact, delete`. To
set `cleanup.policy` to `compact, delete`, you must first change from `delete`
to `compact`, then change to `compact, delete`.
For more information about how log compaction works, see
[Log Compaction](/kafka/design/log_compaction.html).

#### NOTE
When switching the cleanup policy from `delete` to `compact`, records without
keys are considered invalid and deleted.

- Default: delete
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## compression.type

Specify the final compression type for a given topic.

- Default: producer
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## default.replication.factor

The default replication factor for automatically created topics.

- Default: 3
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## delete.retention.ms

The amount of time to retain delete tombstone markers for log-compacted topics.
For more information about how log compaction works, see
[Log Compaction](/kafka/design/log_compaction.html).
Maximum: 60,566,400,000.

- Default: 86,400,000
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## file.delete.delay.ms

The time to wait, in milliseconds (ms), before deleting a file from the filesystem.

- Default: 60,000
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## flush.messages

This setting specifies an interval at which Kafka forces an fsync of data written to the log.

- Default: 9,223,372,036,854,775,807
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## flush.ms

This setting specifies a time interval at which Kafka forces an fsync of data written to the log.

- Default: 9,223,372,036,854,775,807
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## index.interval.bytes

This setting controls how frequently Kafka adds an index entry to its offset index.

- Default: 4,096
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## max.message.bytes

The largest record batch size allowed by Kafka (after compression, if compression is enabled). The
maximum for this parameter is different, based on the Kafka cluster type.

- Default: 2,097,164
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes
- Dedicated and Enterprise Kafka clusters maximum value:
  20,971,520
- Basic and Standard Kafka clusters maximum value: 8,388,608

<a id="topics-max-compaction-lag-ms"></a>

## max.compaction.lag.ms

The maximum time, in milliseconds (ms), a message remains ineligible for compaction in the log.
Minimum: 21,600,000 ms (six hours) for Dedicated clusters and 604,800,000 ms
(seven days) for Basic, Standard, and Enterprise clusters.
For more information about how log compaction works, see
[Log Compaction](/kafka/design/log_compaction.html).

- Default: 9,223,372,036,854,775,807
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## message.downconversion.enable

This configuration controls whether down-conversion of message formats is enabled to satisfy consume requests.

- Default: true
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## message.timestamp.after.max.ms

The maximum allowable difference that the message timestamp can follow the broker’s timestamp.

- Default: 9,223,372,036,854,775,807
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## message.timestamp.before.max.ms

The maximum allowable difference that the message timestamp can precede or equal the broker’s timestamp.

- Default: 9,223,372,036,854,775,807
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## message.timestamp.difference.max.ms

The maximum difference allowed between the timestamp when a broker receives a message and the timestamp specified in the message.

- Default: 9,223,372,036,854,775,807
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## message.timestamp.type

Define whether the timestamp in the message is message create time or log append time.

- Default: CreateTime
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## min.cleanable.dirty.ratio

This configuration controls how frequently the log compactor attempts to clean the log (assuming log compaction is enabled).

- Default: 0.5
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## min.compaction.lag.ms

The minimum time a message remains uncompacted in the log.
For more information about how log compaction works, see
[Log Compaction](/kafka/design/log_compaction.html#configure-compaction).

- Default: 0
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## min.insync.replicas

This configuration specifies the minimum number of replicas that must acknowledge a
write for the write to be considered successful. You can only set
`min.insync.replicas` to `1` or `2` in Confluent Cloud.

- Default: 2
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

<a id="topics-num-partitions"></a>

## num.partitions

You can change the number of partitions for an existing topic (`num.partitions`) for all cluster types on a per-
topic basis. You can only increase (not decrease) the `num.partitions` value after you create a topic,
using the Confluent Cloud Console, the `kafka-topics` script, or the API.

Limits vary based on the Kafka cluster type. For more information, see [Kafka Cluster Types in Confluent Cloud](../clusters/cluster-types.md#cloud-cluster-types).

- Default: 6
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

To change the number of partitions, you can use the `kafka-topics` script that is part
of the [Kafka command line tools](https://www.confluent.io/blog/using-apache-kafka-command-line-tools-confluent-cloud/)
(installed with Confluent Platform) with the following command:

```none
bin/kafka-topics --bootstrap-server <hostname:port> --command-config <config_file> --alter --topic <topic_name> --partitions <number_partitions>
```

Alternatively, you can use the [Kafka REST APIs](https://docs.confluent.io/cloud/current/ccloud/update-partition-count-kafka-topic/) to
change the number of partitions for an existing topic (`num.partitions`). You need the REST endpoint and the cluster ID for your cluster to make
Kafka REST calls. To find this information with Cloud Console, see
[Find the REST endpoint address and cluster ID](../clusters/broker-config.md#cluster-settings-console). For more on how to use the
REST APIs, see [Kafka REST API Quick Start for Confluent Cloud](../kafka-rest/krest-qs.md#cloud-rest-api-quickstart).

You can also use Terraform Provider for Confluent to edit this topic setting.

For more details, sign in to the [Confluent Support Portal](https://support.confluent.io/) and
search for “How to increase the partition count for a Confluent Cloud hosted topic.”

## preallocate

Set to `true` if the file should be preallocated on disk when creating a new log segment.

- Default: false
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## retention.bytes

This configuration controls the maximum size a partition (which consists of log segments)
can grow to before Kafka discards old log segments to free up space when using the `delete` retention policy.

- Default: -1
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

<a id="topics-retention-ms"></a>

## retention.ms

This configuration controls the maximum time Kafka retains a log before discarding old
log segments to free up space when using the `delete` retention policy. Set to -1 for Infinite Storage.

- Default: 604,800,000
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## segment.bytes

This configuration controls the segment file size for the log.
Minimum: 52,428,800, Maximum: 1,073,741,824 (one gibibyte).

- Default: 104,857,600
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## segment.index.bytes

This configuration controls the size of the index that maps offsets to file positions.

- Default: 10,485,760
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## segment.jitter.ms

The maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling.

- Default: 0
- Editable: No
- Kafka REST API and Terraform Provider Support: No

## segment.ms

This configuration controls the period of time after which Kafka forces the log to
roll even if the segment file is not full to ensure that retention can delete or compact old data.
Minimum: 14,400,000 (four hours). You can set `segment.ms` as low as `600000` (10 minutes),
but the minimum of `14400000` (four hours) is still enforced.

- Default: 604,800,000
- Editable: Yes
- Kafka REST API and Terraform Provider Support: Yes

## unclean.leader.election.enable

Indicates whether to enable replicas not in the in-sync replica (ISR) set to be elected as leader as a last resort,
even though doing so might result in data loss.

- Default: false
- Editable: No
- Kafka REST API and Terraform Provider Support: No

#### IMPORTANT
You can change editable settings after topic creation, but the limits that apply at topic creation still apply.
