When we scale up BMI calculator service, requests from BMI web service need to distribute equally to each BMI calculator service. This guide shows how to use load balance with ServiceComb in the BMI application.
Before you start
Walk through Develop microservice application in minutes and have BMI application running.
The simple embedded load balancer will be used by default. No extra configurations needed.
Run one more BMI calculator service with the following command:
mvn spring-boot:run -Drun.jvmArguments="-Dcse.rest.address=0.0.0.0:7778"
To better distinguish different running instances, we added a new interface that returns instance id in the implementation of BMI calculator, details can refer to the implementation of BMI calculator. Besides, a different service port is needed to avoid port conflict.
Now you can see the instance id in the following figures shows up alternately by clicking the Submit button.