Adjust traffic distribution by weight
Dubbo provides the service governance capability of adjusting traffic distribution by weight, and can dynamically adjust traffic distribution by weight without restarting the application.
Dubbo can adjust traffic distribution by weight through XML configuration, annotation configuration, and dynamic configuration. Here we mainly introduce the dynamic configuration method. For other configuration methods, please refer to the old document Configuration
before the start
Please make sure to run Dubbo-Admin successfully
Background Information
In the case of different machine performance, the load of different machines needs to be evaluated systematically, and some machines need to be downgraded. By adjusting the traffic ratio of the machine by weight, the performance of the machine can be reasonably evaluated. Certain services will face traffic shocks. In order to ensure the availability of core services, some services need to be downgraded. Adjust traffic distribution by weight to avoid faults caused by traffic impact.
Steps
Weight Adjustment
- Log in to the Dubbo-Admin console
- In the left navigation bar, select Service Governance > Weight Adjustment.
- Click the Create button, and in the New Weight Rule panel, fill in the rule content, and then click Save.
Detailed Rules
For the scenario of dynamically adjusting traffic distribution through weight, you only need to clarify the following issues to know how to write the configuration:
- Whether you want to modify the configuration of the entire application or a service.
- Application:
scope: application, key: app-name
(you can also useservices
to specify certain services). - Service:
scope: service, key:group+service+version
.
- Application:
- Whether the address list configuration takes effect only for some specific instances.
- All instances:
addresses: ["0.0.0.0"]
oraddresses: ["0.0.0.0:*"]
depends on the side value. - Specified instances:
addersses[list of instance addresses]
.
- All instances:
- The weight to modify.
Result validation
Select the application related to the weight configuration to trigger the call verification.