Separate zookeeper install or not using kafka 10.2?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
In the realm of distributed systems, Apache Kafka has emerged as a highly popular and efficient streaming platform, facilitating real-time data processing and analytics. One critical component often associated with Kafka has been Apache ZooKeeper, which Kafka has historically used for managing and coordinating its distributed nodes and configurations. However, with the release of Kafka 10.2, the reliance on ZooKeeper has been revisited, leading to significant architectural changes. Here, we explore whether to use a separate ZooKeeper installation with Kafka 10.2 or embrace Kafka’s native capabilities for handling metadata.
Understanding the Role of ZooKeeper in Kafka
Prior to Kafka 10.2, ZooKeeper played a pivotal role in the infrastructure of Kafka. It was responsible for several key tasks, including:
- Cluster Membership Management: ZooKeeper kept track of the status of Kafka brokers in the cluster.
- Metadata Management: It maintained information about topics, partitions, and their respective states.
- Leader Election for Partitions: ZooKeeper helped in electing a leader for each partition, which is crucial for data consistency.
Changes Introduced in Kafka 10.2
Kafka 10.2 has introduced a major shift with the KIP-500 proposal, which aims to remove the dependency on ZooKeeper. Instead, Kafka now relies on an internal Raft protocol to manage its metadata. This internal metadata quorum (also referred to simply as the "KRaft" mode) signifies a significant architectural evolution, offering several benefits:
- Simplified Operations: Eliminates the need to manage and scale a separate ZooKeeper cluster.
- Improved Performance: Reduces the latency involved in metadata operations by avoiding the intermediatory role of ZooKeeper.
- Consolidation and Optimization: Streamlines Kafka's architecture by handling everything within its own ecosystem.
Should You Use a Separate ZooKeeper with Kafka 10.2?
With the advances introduced in Kafka 10.2, the necessity for a separate ZooKeeper configuration is largely obviated. Kafka in KRaft mode can handle its operational requirements without external components. Transitioning to this new mode offers various advantages:
- Lowered Complexity: Managing one system instead of two simplifies deployment and scale.
- Enhanced Resilience and Scalability: Kafka’s internal handling of cluster metadata is more tightly integrated and optimized, potentially reducing the points of failure.
- Future-proofing: Kafka’s development trajectory is clearly steering away from using ZooKeeper, suggesting that newer features and optimizations will be focused on KRaft.
Technical Implementation: Transitioning to KRaft
For new installations of Kafka 10.2, it is advisable to start directly in KRaft mode. However, for existing systems transitioning from older versions of Kafka that relied on ZooKeeper, careful planning is required. The transition involves a series of steps to seamlessly move metadata responsibilities from ZooKeeper to Kafka’s internal mechanisms:
- Ensuring Data Integrity: Before transition, it’s critical to ensure that all existing Kafka data is consistent.
- Configuration Adjustments: Modify Kafka configurations to disable ZooKeeper dependencies.
- Incremental Rollout: Gradually transition brokers to use the new KRaft mode to minimize disruptions.
Summary Table: Considerations for Using ZooKeeper with Kafka 10.2
| Consideration | With ZooKeeper | With KRaft (No ZooKeeper) |
| Complexity | High (manage two systems) | Low (single system management) |
| Performance | Potentially lower (extra hops for metadata) | Higher (direct metadata handling) |
| Scalability | Good (but depends on additional optimization) | Better (inherent scaling with Kafka) |
| Future Support | Decreasing (phasing out ZooKeeper) | Increasing (focus on KRaft enhancements) |
Conclusion
The decision to move away from using ZooKeeper in Kafka setups aligns with a broader trend towards simplification and consolidation in software and systems architecture. For users deploying Kafka 10.2 or upgrading to this version, embracing the native KRaft mode is advisable. This approach not only prepares systems for future Kafka developments but also leverages immediate benefits in terms of performance, scalability, and simplicity.
Related reading
- Separating celery consumer and producer
- Sequence of timestamps in Kafka partition
- Set Kafka log directory property in Windows
- Set timestamp in output with Kafka Streams
- set 'x-message-ttl' in pika python
- Setting a long timeout for RabbitMQ ack message
- Setting Partition Strategy in a Kafka Connector
- Setting up Apache Kafka for developer/integration test environment

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack 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.