A balanced leader election algorithm based on replica distribution in Kubernetes cluster

Junnan Liu,Yongkang Ding,Yifan Liu
DOI: https://doi.org/10.1007/s10586-024-04333-6
2024-03-19
Cluster Computing
Abstract:Kubernetes is a well-known open source project that provides a powerful orchestration platform for containerized applications. To ensure high scalability and availability of services, redundant deployment is usually adopted in Kubernetes clusters, creating multiple replicas for each application. Each replica of a stateful application needs to persistently store data and use a leader-based consistency maintenance mechanism to ensure strong consistency among replicas. In this mechanism, the elected leader is responsible for updating data and synchronizing it to the followers, which results in a higher workload for the leader. When there are multiple stateful applications, the Kubernetes leader election algorithm does not consider the distribution of multiple leaders among nodes, which may lead to the phenomenon of too many leaders on some nodes. This can reduce system performance due to the high workload of the leaders themselves. To address this problem, we propose a balanced leader election algorithm based on replica distribution, which enables multiple stateful application leaders to be evenly distributed among the cluster's worker nodes. The algorithm effectively solves the problem of system performance degradation caused by leader concentration and achieves load balancing among nodes. We verify the effectiveness of the algorithm through experiments.
computer science, information systems, theory & methods
What problem does this paper attempt to address?