All Products
Search
Document Center

Microservices Engine:What do I do if the modified weight of an application instance does not take effect on an MSE Nacos instance?

Last Updated:Apr 12, 2023

This topic describes how to resolve the issue that the weight of an application instance does not take effect on a Microservices Engine (MSE) Nacos instance after you modify the weight.

Problem description

When an application instance is added or modified in the MSE console, the weight of the application instance is configured for load balancing. When traffic is called, traffic is not distributed based on the modified weight.

Possible causes

  • The application framework that you use does not support weight-based load balancing.

  • Load balancing is implemented based on the load balancing configuration of the application framework, not the weight properties of the MSE Nacos instance.

  • Addressing of the application is not implemented based on the weight value.

Solutions

The weight of the application instance is only a property of the MSE Nacos instance. After you change the weight value, the weight value that is included in the instance information is pushed to the Nacos client. In practice, the weight property may be ignored due to different usage methods.

  • The application framework that you use does not support weight-based traffic distribution. For example, frameworks such as Spring Cloud Alibaba only identify weight values as zero and non-zero values. If the weight value is zero, no traffic is distributed. If the weight value is not zero, traffic is distributed. Load balancing cannot be implemented based on the weight value in the MSE Nacos instance. Use one of the following methods to resolve the issue:

    • Check whether weight-based traffic distribution can be introduced for the application framework. If weight-based traffic distribution can be introduced, this feature can be implemented.

    • Replace the existing application framework with another application framework.

  • The application framework that you use has its load balancing configuration method. The weight properties of the MSE Nacos instance are not supported. The weight properties of the MSE Nacos instance include Dubbo and Spring Cloud Alibaba + Loadbalance.

    You can ask for help from the open source community or refer to the documentation to get started with the steps to configure load balancing.

  • The application framework may not be used for application development, but the application does not use the weight value for addressing when the application processes services.

    • After the application instance list is obtained, enable the application to implement the custom addressing logic based on the weight field.

    • Use the default selectOneHealthyInstance method of the Nacos client to perform addressing. For more information, see Nacos Java SDK.