Same computer room/area priority
Dubbo provides the service management capability of dynamically configuring the priority of the same computer room/region, and can dynamically configure the priority of the same computer room/region without restarting the application.
Dubbo can be configured through XML, annotation configuration, and dynamic configuration in the same computer room/area first. 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
When applications are deployed in multiple different computer rooms/regions, cross-region calls will occur between applications, and cross-region calls will increase the response time. Priority in the same computer room/area means that when an application invokes a service, the service provider in the same computer room/area is called first. Dubbo-Admin provides a dynamic same-computer room/region priority capability, which can help you quickly and dynamically configure the same-computer room/region priority, avoiding network delays caused by cross-regions, thereby reducing call response time.
Steps
Label Routing
- Log in to the Dubbo-Admin console
- In the left navigation pane, select Service Governance > Label Routing.
- Click the Create button, and in the Create New Tag Rule pane, fill in the rule content, and then click Save.
Detailed Rules
Configuration template
---
force: false
runtime: true
enabled: true
key: governance-tagrouter-provider
tags:
- name: tag1
addresses: ["127.0.0.1:20880"]
- name: tag2
addresses: ["127.0.0.1:20881"]
...
For the same computer room/area priority scenario, you only need to clarify the following questions to know how to write the configuration:
- To modify the configuration of the provider application to which the service belongs.
- Application:
scope: application, key: app-name
(you can also useservices
to specify certain services).
- Application:
- When the routing result is empty, whether to force return.
- force=false: When the routing result is empty, downgrade the provider whose tag is empty.
- force=true: When the routing result is empty, an exception will be returned directly.
- Priority of routing rules
- priority=1: The priority of routing rules, used for sorting, the higher the priority, the higher the execution, it can be left blank, the default is 0.
- Whether the configuration takes effect only for certain 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 tag name to modify.
Result validation
Select the application related to the priority configuration of the same computer room/area to trigger the call verification.