Kafka 1.0 upgrade
Kafka internal topics
settings optimization
system update
technology maintenance

Recommended settings for Kafka Internal Topics after upgrade to 1.0

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

When upgrading Apache Kafka to version 1.0 or higher, it's important to optimize the settings for internal topics to ensure stability, performance, and durability of your Kafka cluster. Internal topics in Kafka, such as __consumer_offsets and Kafka Streams internal topics, play a crucial role in the operation and efficiency of Kafka.

Understanding Internal Topics in Kafka

Internal topics in Kafka are used for:

  • Broker coordination: Used by brokers to manage cluster metadata and configurations.
  • Offset tracking: The __consumer_offsets topic stores offsets for each topic-partition that consumers have read. This is crucial for maintaining consumer state across different sessions.
  • Kafka Streams: Topics like __transaction_state are used to manage Kafka Streams application states and transactional messaging.

Recommended Settings for Internal Kafka Topics Post-Upgrade

After upgrading to Kafka 1.0, some configurations and defaults have changed or been improved. Below are the recommended settings that should be considered for internal topics:

1. Topic Replication Factor

For all internal topics, the replication factor should be set according to the number of broker nodes in your cluster to ensure high availability. A common practice is to use at least a replication factor of 3 for fault tolerance.

 
replication.factor=3

2. Cleanup Policies

For the __consumer_offsets topic, a compacted cleanup policy is recommended. This helps in maintaining only the latest offset commit per partition while preventing the topic from growing indefinitely.

 
cleanup.policy=compact

For other internally created topics like those used in Kafka Streams, a combination of deletion and compaction might be recommended depending on the use case.

3. Segment Configuration

Configuring the segment size and time can help manage the log cleanup process more efficiently, especially in high-throughput environments. Suitable segment sizes and roll out times minimize the overhead during log compaction and cleanup.

 
segment.bytes=<appropriate size in bytes>
segment.ms=<appropriate time in milliseconds>

4. Retention Settings

For __consumer_offsets, because it uses log compaction, the retention time setting does not apply as for other topics. For Kafka Streams internal topics, configure retention settings based on how long you need to retain stateful information.

 
retention.ms=172800000 (2 days)

5. Min ISR (In-Sync Replicas)

Setting min.insync.replicas to at least 2 ensures that data is written to at least two replicas before an acknowledgment is returned to the producer, enhancing data durability.

 
min.insync.replicas=2

Ensuring Smooth Upgrade and Configuration

When upgrading, ensure that these settings are applied not only to newly created internal topics but also existing ones, particularly if they were created with less optimal default settings in older versions. This might involve re-creating topics or altering topic configurations dynamically.

Summary Table

SettingRecommended ValueDescription
replication.factor3Ensures data is replicated across three brokers for fault tolerance.
cleanup.policy for __consumer_offsetscompactMaintains only the latest offsets, optimizing space.
segment.bytesSpecific to your throughput and storage needsControls the log segment file size.
segment.msSpecific to your requirementsControls the time after which a new log segment is rolled out.
retention.ms for Kafka Streams topicsAt least 172800000 (2 days) or as per state retention needsDetermines how long data is retained for stateful operations in Kafka Streams.
min.insync.replicas2Ensures data durability by requiring at least two replicas to acknowledge writes.

Additional Considerations

  • Monitor and adjust: Post-upgrade, actively monitor your Kafka cluster and adjust configurations as necessary based on actual usage and performance metrics.
  • Backup before upgrade: Always ensure data is backed up before applying significant configuration changes or upgrades.

Following these guidelines ensures your Kafka 1.0 deployment maintains robust, efficient, and resilient internal topic configurations, facilitating smooth operations and minimal downtime.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.