Hazelcast IMDG partial network split
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Hazelcast IMDG (In-Memory Data Grid) plays a critical role in supporting high-speed, scalable, and reliable distributed computing environments. An often challenging situation for such distributed systems is handling partial network splits, also known as network partitioning or "split-brain" scenarios.
Understanding Partial Network Splits
A partial network split occurs when the network that interconnects nodes in a distributed system like Hazelcast is divided into isolated subnetworks. Nodes within each subnetwork can communicate with each other but not with nodes in other subnetworks. This can lead to issues such as:
- Multiple subnetworks believing they are the primary or active cluster, potentially leading to data inconsistency.
- Lost transactions if nodes handling these transactions become isolated.
Hazelcast's Strategies to Combat Split-Brain Scenarios
Hazelcast IMDG addresses split-brain scenarios through its split-brain protection feature, aiming to maintain data integrity and cluster stability. Here are two key strategies:
- Split-Brain Protection Function: It requires a minimum cluster size (Quorum) for a sub-cluster to be considered viable. This means only a cluster segment with the majority can continue functioning normally, reducing the risk of data inconsistency.
- Merge Policy: Upon reconnection, Hazelcast allows for merging data from different sub-clusters based on pre-defined policies like largest-cluster-wins or put-if-absent, which helps resolving any conflicts in data states.
Technical Implementation Steps for Split-Brain Protection
To enable split-brain protection in Hazelcast IMDG, you must configure the splitBrainProtection element in your Hazelcast configuration file (XML/Java-based configuration). Below is an example snippet of such a configuration using XML:
In this configuration, mySplitBrainProtection is set to require a minimum cluster size of 3. Any map or data structure that references this split-brain protection will only operate if the cluster size meets or exceeds this threshold.
Simulation Example
To understand how Hazelcast handles a network split, consider a network of 5 nodes. If a network partition occurs that isolates 2 nodes from the other 3, only the subgroup with 3 nodes will remain active, as it meets the minimum cluster size defined for split-brain protection.
Challenges of Managing Partial Network Splits
While Hazelcast provides tools to handle partial network splits, managing these scenarios involves understanding and addressing several challenges:
- Capacity and Planning: Ensuring that the cluster can function with separated nodes requires careful capacity planning and testing.
- Configuration Management: Incorrect configurations can either lead to false positives in split-brain recognition or lack of adequate protection.
- Integration and Testing: Testing how different split-brain policies affect application behavior is crucial.
Summary Table
| Feature | Description | Impact |
| Minimum Cluster Size | Ensures operation only above a threshold | Prevents data inconsistencies |
| Merge Policy | Defines data reconciliation logic | Solves conflicts when rejoining |
| Configuration | Requires enabling and setting policies | Critical for protection setup |
| Testing & Validation | Necessary for ensuring correct behavior | Avoids surprises during splits |
Conclusion
Hazelcast IMDG's architecture provides robust mechanisms to handle partial network splits, safeguarding against data inconsistency and cluster instability. Proper configuration, alongside thorough testing and capacity planning, is essential to leverage these mechanisms effectively, ensuring that the system remains resilient even under adverse network conditions.

