Research Article

A Microservice Resilience Deployment Mechanism Based on Diversity

Algorithm 1

LB-Diversity.
(1)Input: microservices information ms_info
(2)Nodes information node_info
(3)The list of microservices mslist
(4)The list of microservices versions image_versions
(5)The list of nodes nodelist
(6)The number of deployments deploy_num
(7)Output: the deployment on the node node_deploy_info
(8)The deployment of microservices ms_deploy_info
(9)node_deploy_info = [ ]
(10)ms_deploy_info = [ ]
(11)for ms_name in mslist:
(12) sort the image_versions from small to large based on resource consumption according to ms_info ⟶image_versions_sorted
(13)for instance_seq in range (deploy_num):
(14)  choose the least used and minimal resource consumption version ⟶ deploy_version
(15)  node_ candidates ← find the node with minimal deploy number of ms_name
(16)  deploy_node ← the node with minimal load in node_candidates
(17)  while the resource of deploy_node is not enough:
(18)   deploy_node ← find the next node with minimal load in node_candidates
(19)  end while
(20)  update the resource information of node_info
(21)  ms_deploy_info[ms_name][deploy_version] + = 1
(22)  node_deploy_info[deploy_node][‘deployment’][ms_name] + = 1
(23)end for
(24)end for
(25)return node_deploy_info, ms_deploy_info