摘要
The microservices architecture has been proposed to overcome the drawbacks of the traditional monolithic architecture.Scalability is one of the most attractive features of microservices.Scaling in the microservices architecture requires the scaling of specified services only,rather than the entire application.Scaling services can be achieved by deploying the same service multiple times on different physical machines.However,problems with load balancing may arise.Most existing solutions of microservices load balancing focus on individual tasks and ignore dependencies between these tasks.In the present paper,we propose TCLBM,a task chainbased load balancing algorithm for microservices.When an Application Programming Interface(API)request is received,TCLBM chooses target services for all tasks of this API call and achieves load balancing by evaluating the system resource usage of each service instance.TCLBM reduces the API response time by reducing data transmissions between physical machines.We use three heuristic algorithms,namely,Particle Swarm Optimization(PSO),Simulated Annealing(SA),and Genetic Algorithm(GA),to implement TCLBM,and comparison results reveal that GA performs best.Our findings show that TCLBM achieves load balancing among service instances and reduces API response times by up to 10%compared with existing methods.